aws_sdk_lightsail/operation/create_relational_database_from_snapshot/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_relational_database_from_snapshot::_create_relational_database_from_snapshot_output::CreateRelationalDatabaseFromSnapshotOutputBuilder;
3
4pub use crate::operation::create_relational_database_from_snapshot::_create_relational_database_from_snapshot_input::CreateRelationalDatabaseFromSnapshotInputBuilder;
5
6impl crate::operation::create_relational_database_from_snapshot::builders::CreateRelationalDatabaseFromSnapshotInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::create_relational_database_from_snapshot::CreateRelationalDatabaseFromSnapshotOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_relational_database_from_snapshot::CreateRelationalDatabaseFromSnapshotError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_relational_database_from_snapshot();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateRelationalDatabaseFromSnapshot`.
24///
25/// <p>Creates a new database from an existing database snapshot in Amazon Lightsail.</p>
26/// <p>You can create a new database from a snapshot in if something goes wrong with your original database, or to change it to a different plan, such as a high availability or standard plan.</p>
27/// <p>The <code>create relational database from snapshot</code> operation supports tag-based access control via request tags and resource tags applied to the resource identified by relationalDatabaseSnapshotName. For more information, see the <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-controlling-access-using-tags">Amazon Lightsail Developer Guide</a>.</p>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct CreateRelationalDatabaseFromSnapshotFluentBuilder {
30 handle: ::std::sync::Arc<crate::client::Handle>,
31 inner: crate::operation::create_relational_database_from_snapshot::builders::CreateRelationalDatabaseFromSnapshotInputBuilder,
32 config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35 crate::client::customize::internal::CustomizableSend<
36 crate::operation::create_relational_database_from_snapshot::CreateRelationalDatabaseFromSnapshotOutput,
37 crate::operation::create_relational_database_from_snapshot::CreateRelationalDatabaseFromSnapshotError,
38 > for CreateRelationalDatabaseFromSnapshotFluentBuilder
39{
40 fn send(
41 self,
42 config_override: crate::config::Builder,
43 ) -> crate::client::customize::internal::BoxFuture<
44 crate::client::customize::internal::SendResult<
45 crate::operation::create_relational_database_from_snapshot::CreateRelationalDatabaseFromSnapshotOutput,
46 crate::operation::create_relational_database_from_snapshot::CreateRelationalDatabaseFromSnapshotError,
47 >,
48 > {
49 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50 }
51}
52impl CreateRelationalDatabaseFromSnapshotFluentBuilder {
53 /// Creates a new `CreateRelationalDatabaseFromSnapshotFluentBuilder`.
54 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
55 Self {
56 handle,
57 inner: ::std::default::Default::default(),
58 config_override: ::std::option::Option::None,
59 }
60 }
61 /// Access the CreateRelationalDatabaseFromSnapshot as a reference.
62 pub fn as_input(
63 &self,
64 ) -> &crate::operation::create_relational_database_from_snapshot::builders::CreateRelationalDatabaseFromSnapshotInputBuilder {
65 &self.inner
66 }
67 /// Sends the request and returns the response.
68 ///
69 /// If an error occurs, an `SdkError` will be returned with additional details that
70 /// can be matched against.
71 ///
72 /// By default, any retryable failures will be retried twice. Retry behavior
73 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74 /// set when configuring the client.
75 pub async fn send(
76 self,
77 ) -> ::std::result::Result<
78 crate::operation::create_relational_database_from_snapshot::CreateRelationalDatabaseFromSnapshotOutput,
79 ::aws_smithy_runtime_api::client::result::SdkError<
80 crate::operation::create_relational_database_from_snapshot::CreateRelationalDatabaseFromSnapshotError,
81 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82 >,
83 > {
84 let input = self
85 .inner
86 .build()
87 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88 let runtime_plugins =
89 crate::operation::create_relational_database_from_snapshot::CreateRelationalDatabaseFromSnapshot::operation_runtime_plugins(
90 self.handle.runtime_plugins.clone(),
91 &self.handle.conf,
92 self.config_override,
93 );
94 crate::operation::create_relational_database_from_snapshot::CreateRelationalDatabaseFromSnapshot::orchestrate(&runtime_plugins, input).await
95 }
96
97 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
98 pub fn customize(
99 self,
100 ) -> crate::client::customize::CustomizableOperation<
101 crate::operation::create_relational_database_from_snapshot::CreateRelationalDatabaseFromSnapshotOutput,
102 crate::operation::create_relational_database_from_snapshot::CreateRelationalDatabaseFromSnapshotError,
103 Self,
104 > {
105 crate::client::customize::CustomizableOperation::new(self)
106 }
107 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
108 self.set_config_override(::std::option::Option::Some(config_override.into()));
109 self
110 }
111
112 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
113 self.config_override = config_override;
114 self
115 }
116 /// <p>The name to use for your new Lightsail database resource.</p>
117 /// <p>Constraints:</p>
118 /// <ul>
119 /// <li>
120 /// <p>Must contain from 2 to 255 alphanumeric characters, or hyphens.</p></li>
121 /// <li>
122 /// <p>The first and last character must be a letter or number.</p></li>
123 /// </ul>
124 pub fn relational_database_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
125 self.inner = self.inner.relational_database_name(input.into());
126 self
127 }
128 /// <p>The name to use for your new Lightsail database resource.</p>
129 /// <p>Constraints:</p>
130 /// <ul>
131 /// <li>
132 /// <p>Must contain from 2 to 255 alphanumeric characters, or hyphens.</p></li>
133 /// <li>
134 /// <p>The first and last character must be a letter or number.</p></li>
135 /// </ul>
136 pub fn set_relational_database_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137 self.inner = self.inner.set_relational_database_name(input);
138 self
139 }
140 /// <p>The name to use for your new Lightsail database resource.</p>
141 /// <p>Constraints:</p>
142 /// <ul>
143 /// <li>
144 /// <p>Must contain from 2 to 255 alphanumeric characters, or hyphens.</p></li>
145 /// <li>
146 /// <p>The first and last character must be a letter or number.</p></li>
147 /// </ul>
148 pub fn get_relational_database_name(&self) -> &::std::option::Option<::std::string::String> {
149 self.inner.get_relational_database_name()
150 }
151 /// <p>The Availability Zone in which to create your new database. Use the <code>us-east-2a</code> case-sensitive format.</p>
152 /// <p>You can get a list of Availability Zones by using the <code>get regions</code> operation. Be sure to add the <code>include relational database Availability Zones</code> parameter to your request.</p>
153 pub fn availability_zone(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
154 self.inner = self.inner.availability_zone(input.into());
155 self
156 }
157 /// <p>The Availability Zone in which to create your new database. Use the <code>us-east-2a</code> case-sensitive format.</p>
158 /// <p>You can get a list of Availability Zones by using the <code>get regions</code> operation. Be sure to add the <code>include relational database Availability Zones</code> parameter to your request.</p>
159 pub fn set_availability_zone(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
160 self.inner = self.inner.set_availability_zone(input);
161 self
162 }
163 /// <p>The Availability Zone in which to create your new database. Use the <code>us-east-2a</code> case-sensitive format.</p>
164 /// <p>You can get a list of Availability Zones by using the <code>get regions</code> operation. Be sure to add the <code>include relational database Availability Zones</code> parameter to your request.</p>
165 pub fn get_availability_zone(&self) -> &::std::option::Option<::std::string::String> {
166 self.inner.get_availability_zone()
167 }
168 /// <p>Specifies the accessibility options for your new database. A value of <code>true</code> specifies a database that is available to resources outside of your Lightsail account. A value of <code>false</code> specifies a database that is available only to your Lightsail resources in the same region as your database.</p>
169 pub fn publicly_accessible(mut self, input: bool) -> Self {
170 self.inner = self.inner.publicly_accessible(input);
171 self
172 }
173 /// <p>Specifies the accessibility options for your new database. A value of <code>true</code> specifies a database that is available to resources outside of your Lightsail account. A value of <code>false</code> specifies a database that is available only to your Lightsail resources in the same region as your database.</p>
174 pub fn set_publicly_accessible(mut self, input: ::std::option::Option<bool>) -> Self {
175 self.inner = self.inner.set_publicly_accessible(input);
176 self
177 }
178 /// <p>Specifies the accessibility options for your new database. A value of <code>true</code> specifies a database that is available to resources outside of your Lightsail account. A value of <code>false</code> specifies a database that is available only to your Lightsail resources in the same region as your database.</p>
179 pub fn get_publicly_accessible(&self) -> &::std::option::Option<bool> {
180 self.inner.get_publicly_accessible()
181 }
182 /// <p>The name of the database snapshot from which to create your new database.</p>
183 pub fn relational_database_snapshot_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
184 self.inner = self.inner.relational_database_snapshot_name(input.into());
185 self
186 }
187 /// <p>The name of the database snapshot from which to create your new database.</p>
188 pub fn set_relational_database_snapshot_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
189 self.inner = self.inner.set_relational_database_snapshot_name(input);
190 self
191 }
192 /// <p>The name of the database snapshot from which to create your new database.</p>
193 pub fn get_relational_database_snapshot_name(&self) -> &::std::option::Option<::std::string::String> {
194 self.inner.get_relational_database_snapshot_name()
195 }
196 /// <p>The bundle ID for your new database. A bundle describes the performance specifications for your database.</p>
197 /// <p>You can get a list of database bundle IDs by using the <code>get relational database bundles</code> operation.</p>
198 /// <p>When creating a new database from a snapshot, you cannot choose a bundle that is smaller than the bundle of the source database.</p>
199 pub fn relational_database_bundle_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
200 self.inner = self.inner.relational_database_bundle_id(input.into());
201 self
202 }
203 /// <p>The bundle ID for your new database. A bundle describes the performance specifications for your database.</p>
204 /// <p>You can get a list of database bundle IDs by using the <code>get relational database bundles</code> operation.</p>
205 /// <p>When creating a new database from a snapshot, you cannot choose a bundle that is smaller than the bundle of the source database.</p>
206 pub fn set_relational_database_bundle_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
207 self.inner = self.inner.set_relational_database_bundle_id(input);
208 self
209 }
210 /// <p>The bundle ID for your new database. A bundle describes the performance specifications for your database.</p>
211 /// <p>You can get a list of database bundle IDs by using the <code>get relational database bundles</code> operation.</p>
212 /// <p>When creating a new database from a snapshot, you cannot choose a bundle that is smaller than the bundle of the source database.</p>
213 pub fn get_relational_database_bundle_id(&self) -> &::std::option::Option<::std::string::String> {
214 self.inner.get_relational_database_bundle_id()
215 }
216 /// <p>The name of the source database.</p>
217 pub fn source_relational_database_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
218 self.inner = self.inner.source_relational_database_name(input.into());
219 self
220 }
221 /// <p>The name of the source database.</p>
222 pub fn set_source_relational_database_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
223 self.inner = self.inner.set_source_relational_database_name(input);
224 self
225 }
226 /// <p>The name of the source database.</p>
227 pub fn get_source_relational_database_name(&self) -> &::std::option::Option<::std::string::String> {
228 self.inner.get_source_relational_database_name()
229 }
230 /// <p>The date and time to restore your database from.</p>
231 /// <p>Constraints:</p>
232 /// <ul>
233 /// <li>
234 /// <p>Must be before the latest restorable time for the database.</p></li>
235 /// <li>
236 /// <p>Cannot be specified if the <code>use latest restorable time</code> parameter is <code>true</code>.</p></li>
237 /// <li>
238 /// <p>Specified in Coordinated Universal Time (UTC).</p></li>
239 /// <li>
240 /// <p>Specified in the Unix time format.</p>
241 /// <p>For example, if you wish to use a restore time of October 1, 2018, at 8 PM UTC, then you input <code>1538424000</code> as the restore time.</p></li>
242 /// </ul>
243 pub fn restore_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
244 self.inner = self.inner.restore_time(input);
245 self
246 }
247 /// <p>The date and time to restore your database from.</p>
248 /// <p>Constraints:</p>
249 /// <ul>
250 /// <li>
251 /// <p>Must be before the latest restorable time for the database.</p></li>
252 /// <li>
253 /// <p>Cannot be specified if the <code>use latest restorable time</code> parameter is <code>true</code>.</p></li>
254 /// <li>
255 /// <p>Specified in Coordinated Universal Time (UTC).</p></li>
256 /// <li>
257 /// <p>Specified in the Unix time format.</p>
258 /// <p>For example, if you wish to use a restore time of October 1, 2018, at 8 PM UTC, then you input <code>1538424000</code> as the restore time.</p></li>
259 /// </ul>
260 pub fn set_restore_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
261 self.inner = self.inner.set_restore_time(input);
262 self
263 }
264 /// <p>The date and time to restore your database from.</p>
265 /// <p>Constraints:</p>
266 /// <ul>
267 /// <li>
268 /// <p>Must be before the latest restorable time for the database.</p></li>
269 /// <li>
270 /// <p>Cannot be specified if the <code>use latest restorable time</code> parameter is <code>true</code>.</p></li>
271 /// <li>
272 /// <p>Specified in Coordinated Universal Time (UTC).</p></li>
273 /// <li>
274 /// <p>Specified in the Unix time format.</p>
275 /// <p>For example, if you wish to use a restore time of October 1, 2018, at 8 PM UTC, then you input <code>1538424000</code> as the restore time.</p></li>
276 /// </ul>
277 pub fn get_restore_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
278 self.inner.get_restore_time()
279 }
280 /// <p>Specifies whether your database is restored from the latest backup time. A value of <code>true</code> restores from the latest backup time.</p>
281 /// <p>Default: <code>false</code></p>
282 /// <p>Constraints: Cannot be specified if the <code>restore time</code> parameter is provided.</p>
283 pub fn use_latest_restorable_time(mut self, input: bool) -> Self {
284 self.inner = self.inner.use_latest_restorable_time(input);
285 self
286 }
287 /// <p>Specifies whether your database is restored from the latest backup time. A value of <code>true</code> restores from the latest backup time.</p>
288 /// <p>Default: <code>false</code></p>
289 /// <p>Constraints: Cannot be specified if the <code>restore time</code> parameter is provided.</p>
290 pub fn set_use_latest_restorable_time(mut self, input: ::std::option::Option<bool>) -> Self {
291 self.inner = self.inner.set_use_latest_restorable_time(input);
292 self
293 }
294 /// <p>Specifies whether your database is restored from the latest backup time. A value of <code>true</code> restores from the latest backup time.</p>
295 /// <p>Default: <code>false</code></p>
296 /// <p>Constraints: Cannot be specified if the <code>restore time</code> parameter is provided.</p>
297 pub fn get_use_latest_restorable_time(&self) -> &::std::option::Option<bool> {
298 self.inner.get_use_latest_restorable_time()
299 }
300 ///
301 /// Appends an item to `tags`.
302 ///
303 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
304 ///
305 /// <p>The tag keys and optional values to add to the resource during create.</p>
306 /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
307 pub fn tags(mut self, input: crate::types::Tag) -> Self {
308 self.inner = self.inner.tags(input);
309 self
310 }
311 /// <p>The tag keys and optional values to add to the resource during create.</p>
312 /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
313 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
314 self.inner = self.inner.set_tags(input);
315 self
316 }
317 /// <p>The tag keys and optional values to add to the resource during create.</p>
318 /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
319 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
320 self.inner.get_tags()
321 }
322}