aws_sdk_lightsail/operation/update_bucket/_update_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 UpdateBucketInput {
6 /// <p>The name of the bucket to update.</p>
7 pub bucket_name: ::std::option::Option<::std::string::String>,
8 /// <p>An object that sets the public accessibility of objects in the specified bucket.</p>
9 pub access_rules: ::std::option::Option<crate::types::AccessRules>,
10 /// <p>Specifies whether to enable or suspend versioning of objects in the bucket.</p>
11 /// <p>The following options can be specified:</p>
12 /// <ul>
13 /// <li>
14 /// <p><code>Enabled</code> - Enables versioning of objects in the specified bucket.</p></li>
15 /// <li>
16 /// <p><code>Suspended</code> - Suspends versioning of objects in the specified bucket. Existing object versions are retained.</p></li>
17 /// </ul>
18 pub versioning: ::std::option::Option<::std::string::String>,
19 /// <p>An array of strings to specify the Amazon Web Services account IDs that can access the bucket.</p>
20 /// <p>You can give a maximum of 10 Amazon Web Services accounts access to a bucket.</p>
21 pub readonly_access_accounts: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
22 /// <p>An object that describes the access log configuration for the bucket.</p>
23 pub access_log_config: ::std::option::Option<crate::types::BucketAccessLogConfig>,
24 /// <p>Sets the cross-origin resource sharing (CORS) configuration for your bucket. If a CORS configuration exists, it is replaced with the specified configuration. For AWS CLI operations, this parameter can also be passed as a file. For more information, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/configure-cors.html">Configuring cross-origin resource sharing (CORS)</a>.</p><note>
25 /// <p>CORS information is only returned in a response when you update the CORS policy.</p>
26 /// </note>
27 pub cors: ::std::option::Option<crate::types::BucketCorsConfig>,
28}
29impl UpdateBucketInput {
30 /// <p>The name of the bucket to update.</p>
31 pub fn bucket_name(&self) -> ::std::option::Option<&str> {
32 self.bucket_name.as_deref()
33 }
34 /// <p>An object that sets the public accessibility of objects in the specified bucket.</p>
35 pub fn access_rules(&self) -> ::std::option::Option<&crate::types::AccessRules> {
36 self.access_rules.as_ref()
37 }
38 /// <p>Specifies whether to enable or suspend versioning of objects in the bucket.</p>
39 /// <p>The following options can be specified:</p>
40 /// <ul>
41 /// <li>
42 /// <p><code>Enabled</code> - Enables versioning of objects in the specified bucket.</p></li>
43 /// <li>
44 /// <p><code>Suspended</code> - Suspends versioning of objects in the specified bucket. Existing object versions are retained.</p></li>
45 /// </ul>
46 pub fn versioning(&self) -> ::std::option::Option<&str> {
47 self.versioning.as_deref()
48 }
49 /// <p>An array of strings to specify the Amazon Web Services account IDs that can access the bucket.</p>
50 /// <p>You can give a maximum of 10 Amazon Web Services accounts access to a bucket.</p>
51 ///
52 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.readonly_access_accounts.is_none()`.
53 pub fn readonly_access_accounts(&self) -> &[::std::string::String] {
54 self.readonly_access_accounts.as_deref().unwrap_or_default()
55 }
56 /// <p>An object that describes the access log configuration for the bucket.</p>
57 pub fn access_log_config(&self) -> ::std::option::Option<&crate::types::BucketAccessLogConfig> {
58 self.access_log_config.as_ref()
59 }
60 /// <p>Sets the cross-origin resource sharing (CORS) configuration for your bucket. If a CORS configuration exists, it is replaced with the specified configuration. For AWS CLI operations, this parameter can also be passed as a file. For more information, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/configure-cors.html">Configuring cross-origin resource sharing (CORS)</a>.</p><note>
61 /// <p>CORS information is only returned in a response when you update the CORS policy.</p>
62 /// </note>
63 pub fn cors(&self) -> ::std::option::Option<&crate::types::BucketCorsConfig> {
64 self.cors.as_ref()
65 }
66}
67impl UpdateBucketInput {
68 /// Creates a new builder-style object to manufacture [`UpdateBucketInput`](crate::operation::update_bucket::UpdateBucketInput).
69 pub fn builder() -> crate::operation::update_bucket::builders::UpdateBucketInputBuilder {
70 crate::operation::update_bucket::builders::UpdateBucketInputBuilder::default()
71 }
72}
73
74/// A builder for [`UpdateBucketInput`](crate::operation::update_bucket::UpdateBucketInput).
75#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
76#[non_exhaustive]
77pub struct UpdateBucketInputBuilder {
78 pub(crate) bucket_name: ::std::option::Option<::std::string::String>,
79 pub(crate) access_rules: ::std::option::Option<crate::types::AccessRules>,
80 pub(crate) versioning: ::std::option::Option<::std::string::String>,
81 pub(crate) readonly_access_accounts: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
82 pub(crate) access_log_config: ::std::option::Option<crate::types::BucketAccessLogConfig>,
83 pub(crate) cors: ::std::option::Option<crate::types::BucketCorsConfig>,
84}
85impl UpdateBucketInputBuilder {
86 /// <p>The name of the bucket to update.</p>
87 /// This field is required.
88 pub fn bucket_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
89 self.bucket_name = ::std::option::Option::Some(input.into());
90 self
91 }
92 /// <p>The name of the bucket to update.</p>
93 pub fn set_bucket_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
94 self.bucket_name = input;
95 self
96 }
97 /// <p>The name of the bucket to update.</p>
98 pub fn get_bucket_name(&self) -> &::std::option::Option<::std::string::String> {
99 &self.bucket_name
100 }
101 /// <p>An object that sets the public accessibility of objects in the specified bucket.</p>
102 pub fn access_rules(mut self, input: crate::types::AccessRules) -> Self {
103 self.access_rules = ::std::option::Option::Some(input);
104 self
105 }
106 /// <p>An object that sets the public accessibility of objects in the specified bucket.</p>
107 pub fn set_access_rules(mut self, input: ::std::option::Option<crate::types::AccessRules>) -> Self {
108 self.access_rules = input;
109 self
110 }
111 /// <p>An object that sets the public accessibility of objects in the specified bucket.</p>
112 pub fn get_access_rules(&self) -> &::std::option::Option<crate::types::AccessRules> {
113 &self.access_rules
114 }
115 /// <p>Specifies whether to enable or suspend versioning of objects in the bucket.</p>
116 /// <p>The following options can be specified:</p>
117 /// <ul>
118 /// <li>
119 /// <p><code>Enabled</code> - Enables versioning of objects in the specified bucket.</p></li>
120 /// <li>
121 /// <p><code>Suspended</code> - Suspends versioning of objects in the specified bucket. Existing object versions are retained.</p></li>
122 /// </ul>
123 pub fn versioning(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
124 self.versioning = ::std::option::Option::Some(input.into());
125 self
126 }
127 /// <p>Specifies whether to enable or suspend versioning of objects in the bucket.</p>
128 /// <p>The following options can be specified:</p>
129 /// <ul>
130 /// <li>
131 /// <p><code>Enabled</code> - Enables versioning of objects in the specified bucket.</p></li>
132 /// <li>
133 /// <p><code>Suspended</code> - Suspends versioning of objects in the specified bucket. Existing object versions are retained.</p></li>
134 /// </ul>
135 pub fn set_versioning(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136 self.versioning = input;
137 self
138 }
139 /// <p>Specifies whether to enable or suspend versioning of objects in the bucket.</p>
140 /// <p>The following options can be specified:</p>
141 /// <ul>
142 /// <li>
143 /// <p><code>Enabled</code> - Enables versioning of objects in the specified bucket.</p></li>
144 /// <li>
145 /// <p><code>Suspended</code> - Suspends versioning of objects in the specified bucket. Existing object versions are retained.</p></li>
146 /// </ul>
147 pub fn get_versioning(&self) -> &::std::option::Option<::std::string::String> {
148 &self.versioning
149 }
150 /// Appends an item to `readonly_access_accounts`.
151 ///
152 /// To override the contents of this collection use [`set_readonly_access_accounts`](Self::set_readonly_access_accounts).
153 ///
154 /// <p>An array of strings to specify the Amazon Web Services account IDs that can access the bucket.</p>
155 /// <p>You can give a maximum of 10 Amazon Web Services accounts access to a bucket.</p>
156 pub fn readonly_access_accounts(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
157 let mut v = self.readonly_access_accounts.unwrap_or_default();
158 v.push(input.into());
159 self.readonly_access_accounts = ::std::option::Option::Some(v);
160 self
161 }
162 /// <p>An array of strings to specify the Amazon Web Services account IDs that can access the bucket.</p>
163 /// <p>You can give a maximum of 10 Amazon Web Services accounts access to a bucket.</p>
164 pub fn set_readonly_access_accounts(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
165 self.readonly_access_accounts = input;
166 self
167 }
168 /// <p>An array of strings to specify the Amazon Web Services account IDs that can access the bucket.</p>
169 /// <p>You can give a maximum of 10 Amazon Web Services accounts access to a bucket.</p>
170 pub fn get_readonly_access_accounts(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
171 &self.readonly_access_accounts
172 }
173 /// <p>An object that describes the access log configuration for the bucket.</p>
174 pub fn access_log_config(mut self, input: crate::types::BucketAccessLogConfig) -> Self {
175 self.access_log_config = ::std::option::Option::Some(input);
176 self
177 }
178 /// <p>An object that describes the access log configuration for the bucket.</p>
179 pub fn set_access_log_config(mut self, input: ::std::option::Option<crate::types::BucketAccessLogConfig>) -> Self {
180 self.access_log_config = input;
181 self
182 }
183 /// <p>An object that describes the access log configuration for the bucket.</p>
184 pub fn get_access_log_config(&self) -> &::std::option::Option<crate::types::BucketAccessLogConfig> {
185 &self.access_log_config
186 }
187 /// <p>Sets the cross-origin resource sharing (CORS) configuration for your bucket. If a CORS configuration exists, it is replaced with the specified configuration. For AWS CLI operations, this parameter can also be passed as a file. For more information, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/configure-cors.html">Configuring cross-origin resource sharing (CORS)</a>.</p><note>
188 /// <p>CORS information is only returned in a response when you update the CORS policy.</p>
189 /// </note>
190 pub fn cors(mut self, input: crate::types::BucketCorsConfig) -> Self {
191 self.cors = ::std::option::Option::Some(input);
192 self
193 }
194 /// <p>Sets the cross-origin resource sharing (CORS) configuration for your bucket. If a CORS configuration exists, it is replaced with the specified configuration. For AWS CLI operations, this parameter can also be passed as a file. For more information, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/configure-cors.html">Configuring cross-origin resource sharing (CORS)</a>.</p><note>
195 /// <p>CORS information is only returned in a response when you update the CORS policy.</p>
196 /// </note>
197 pub fn set_cors(mut self, input: ::std::option::Option<crate::types::BucketCorsConfig>) -> Self {
198 self.cors = input;
199 self
200 }
201 /// <p>Sets the cross-origin resource sharing (CORS) configuration for your bucket. If a CORS configuration exists, it is replaced with the specified configuration. For AWS CLI operations, this parameter can also be passed as a file. For more information, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/configure-cors.html">Configuring cross-origin resource sharing (CORS)</a>.</p><note>
202 /// <p>CORS information is only returned in a response when you update the CORS policy.</p>
203 /// </note>
204 pub fn get_cors(&self) -> &::std::option::Option<crate::types::BucketCorsConfig> {
205 &self.cors
206 }
207 /// Consumes the builder and constructs a [`UpdateBucketInput`](crate::operation::update_bucket::UpdateBucketInput).
208 pub fn build(
209 self,
210 ) -> ::std::result::Result<crate::operation::update_bucket::UpdateBucketInput, ::aws_smithy_types::error::operation::BuildError> {
211 ::std::result::Result::Ok(crate::operation::update_bucket::UpdateBucketInput {
212 bucket_name: self.bucket_name,
213 access_rules: self.access_rules,
214 versioning: self.versioning,
215 readonly_access_accounts: self.readonly_access_accounts,
216 access_log_config: self.access_log_config,
217 cors: self.cors,
218 })
219 }
220}