aws_sdk_rds/
client.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[derive(Debug)]
3pub(crate) struct Handle {
4    pub(crate) conf: crate::Config,
5    #[allow(dead_code)] // unused when a service does not provide any operations
6    pub(crate) runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
7}
8
9/// Client for Amazon Relational Database Service
10///
11/// Client for invoking operations on Amazon Relational Database Service. Each operation on Amazon Relational Database Service is a method on this
12/// this struct. `.send()` MUST be invoked on the generated operations to dispatch the request to the service.
13/// ## Constructing a `Client`
14///
15/// A [`Config`] is required to construct a client. For most use cases, the [`aws-config`]
16/// crate should be used to automatically resolve this config using
17/// [`aws_config::load_from_env()`], since this will resolve an [`SdkConfig`] which can be shared
18/// across multiple different AWS SDK clients. This config resolution process can be customized
19/// by calling [`aws_config::from_env()`] instead, which returns a [`ConfigLoader`] that uses
20/// the [builder pattern] to customize the default config.
21///
22/// In the simplest case, creating a client looks as follows:
23/// ```rust,no_run
24/// # async fn wrapper() {
25/// let config = aws_config::load_from_env().await;
26/// let client = aws_sdk_rds::Client::new(&config);
27/// # }
28/// ```
29///
30/// Occasionally, SDKs may have additional service-specific values that can be set on the [`Config`] that
31/// is absent from [`SdkConfig`], or slightly different settings for a specific client may be desired.
32/// The [`Builder`](crate::config::Builder) struct implements `From<&SdkConfig>`, so setting these specific settings can be
33/// done as follows:
34///
35/// ```rust,no_run
36/// # async fn wrapper() {
37/// let sdk_config = ::aws_config::load_from_env().await;
38/// let config = aws_sdk_rds::config::Builder::from(&sdk_config)
39/// # /*
40///     .some_service_specific_setting("value")
41/// # */
42///     .build();
43/// # }
44/// ```
45///
46/// See the [`aws-config` docs] and [`Config`] for more information on customizing configuration.
47///
48/// _Note:_ Client construction is expensive due to connection thread pool initialization, and should
49/// be done once at application start-up.
50///
51/// [`Config`]: crate::Config
52/// [`ConfigLoader`]: https://docs.rs/aws-config/*/aws_config/struct.ConfigLoader.html
53/// [`SdkConfig`]: https://docs.rs/aws-config/*/aws_config/struct.SdkConfig.html
54/// [`aws-config` docs]: https://docs.rs/aws-config/*
55/// [`aws-config`]: https://crates.io/crates/aws-config
56/// [`aws_config::from_env()`]: https://docs.rs/aws-config/*/aws_config/fn.from_env.html
57/// [`aws_config::load_from_env()`]: https://docs.rs/aws-config/*/aws_config/fn.load_from_env.html
58/// [builder pattern]: https://rust-lang.github.io/api-guidelines/type-safety.html#builders-enable-construction-of-complex-values-c-builder
59/// # Using the `Client`
60///
61/// A client has a function for every operation that can be performed by the service.
62/// For example, the [`AddRoleToDBCluster`](crate::operation::add_role_to_db_cluster) operation has
63/// a [`Client::add_role_to_db_cluster`], function which returns a builder for that operation.
64/// The fluent builder ultimately has a `send()` function that returns an async future that
65/// returns a result, as illustrated below:
66///
67/// ```rust,ignore
68/// let result = client.add_role_to_db_cluster()
69///     .db_cluster_identifier("example")
70///     .send()
71///     .await;
72/// ```
73///
74/// The underlying HTTP requests that get made by this can be modified with the `customize_operation`
75/// function on the fluent builder. See the [`customize`](crate::client::customize) module for more
76/// information.
77/// # Waiters
78///
79/// This client provides `wait_until` methods behind the [`Waiters`](crate::client::Waiters) trait.
80/// To use them, simply import the trait, and then call one of the `wait_until` methods. This will
81/// return a waiter fluent builder that takes various parameters, which are documented on the builder
82/// type. Once parameters have been provided, the `wait` method can be called to initiate waiting.
83///
84/// For example, if there was a `wait_until_thing` method, it could look like:
85/// ```rust,ignore
86/// let result = client.wait_until_thing()
87///     .thing_id("someId")
88///     .wait(Duration::from_secs(120))
89///     .await;
90/// ```
91#[derive(::std::clone::Clone, ::std::fmt::Debug)]
92pub struct Client {
93    handle: ::std::sync::Arc<Handle>,
94}
95
96impl Client {
97    /// Creates a new client from the service [`Config`](crate::Config).
98    ///
99    /// # Panics
100    ///
101    /// This method will panic in the following cases:
102    ///
103    /// - Retries or timeouts are enabled without a `sleep_impl` configured.
104    /// - Identity caching is enabled without a `sleep_impl` and `time_source` configured.
105    /// - No `behavior_version` is provided.
106    ///
107    /// The panic message for each of these will have instructions on how to resolve them.
108    #[track_caller]
109    pub fn from_conf(conf: crate::Config) -> Self {
110        let handle = Handle {
111            conf: conf.clone(),
112            runtime_plugins: crate::config::base_client_runtime_plugins(conf),
113        };
114        if let Err(err) = Self::validate_config(&handle) {
115            panic!("Invalid client configuration: {err}");
116        }
117        Self {
118            handle: ::std::sync::Arc::new(handle),
119        }
120    }
121
122    /// Returns the client's configuration.
123    pub fn config(&self) -> &crate::Config {
124        &self.handle.conf
125    }
126
127    fn validate_config(handle: &Handle) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
128        let mut cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
129        handle
130            .runtime_plugins
131            .apply_client_configuration(&mut cfg)?
132            .validate_base_client_config(&cfg)?;
133        Ok(())
134    }
135}
136
137///
138/// Waiter functions for the client.
139///
140/// Import this trait to get `wait_until` methods on the client.
141///
142pub trait Waiters {
143    /// Wait for `db_cluster_available`
144    fn wait_until_db_cluster_available(&self) -> crate::waiters::db_cluster_available::DbClusterAvailableFluentBuilder;
145    /// Wait for `db_cluster_deleted`
146    fn wait_until_db_cluster_deleted(&self) -> crate::waiters::db_cluster_deleted::DbClusterDeletedFluentBuilder;
147    /// Wait for `db_cluster_snapshot_available`
148    fn wait_until_db_cluster_snapshot_available(&self) -> crate::waiters::db_cluster_snapshot_available::DbClusterSnapshotAvailableFluentBuilder;
149    /// Wait for `db_cluster_snapshot_deleted`
150    fn wait_until_db_cluster_snapshot_deleted(&self) -> crate::waiters::db_cluster_snapshot_deleted::DbClusterSnapshotDeletedFluentBuilder;
151    /// Wait for `db_instance_available`
152    fn wait_until_db_instance_available(&self) -> crate::waiters::db_instance_available::DbInstanceAvailableFluentBuilder;
153    /// Wait for `db_instance_deleted`
154    fn wait_until_db_instance_deleted(&self) -> crate::waiters::db_instance_deleted::DbInstanceDeletedFluentBuilder;
155    /// Wait for `db_snapshot_available`
156    fn wait_until_db_snapshot_available(&self) -> crate::waiters::db_snapshot_available::DbSnapshotAvailableFluentBuilder;
157    /// Wait for `db_snapshot_deleted`
158    fn wait_until_db_snapshot_deleted(&self) -> crate::waiters::db_snapshot_deleted::DbSnapshotDeletedFluentBuilder;
159    /// Wait for `tenant_database_available`
160    fn wait_until_tenant_database_available(&self) -> crate::waiters::tenant_database_available::TenantDatabaseAvailableFluentBuilder;
161    /// Wait for `tenant_database_deleted`
162    fn wait_until_tenant_database_deleted(&self) -> crate::waiters::tenant_database_deleted::TenantDatabaseDeletedFluentBuilder;
163}
164impl Waiters for Client {
165    fn wait_until_db_cluster_available(&self) -> crate::waiters::db_cluster_available::DbClusterAvailableFluentBuilder {
166        crate::waiters::db_cluster_available::DbClusterAvailableFluentBuilder::new(self.handle.clone())
167    }
168    fn wait_until_db_cluster_deleted(&self) -> crate::waiters::db_cluster_deleted::DbClusterDeletedFluentBuilder {
169        crate::waiters::db_cluster_deleted::DbClusterDeletedFluentBuilder::new(self.handle.clone())
170    }
171    fn wait_until_db_cluster_snapshot_available(&self) -> crate::waiters::db_cluster_snapshot_available::DbClusterSnapshotAvailableFluentBuilder {
172        crate::waiters::db_cluster_snapshot_available::DbClusterSnapshotAvailableFluentBuilder::new(self.handle.clone())
173    }
174    fn wait_until_db_cluster_snapshot_deleted(&self) -> crate::waiters::db_cluster_snapshot_deleted::DbClusterSnapshotDeletedFluentBuilder {
175        crate::waiters::db_cluster_snapshot_deleted::DbClusterSnapshotDeletedFluentBuilder::new(self.handle.clone())
176    }
177    fn wait_until_db_instance_available(&self) -> crate::waiters::db_instance_available::DbInstanceAvailableFluentBuilder {
178        crate::waiters::db_instance_available::DbInstanceAvailableFluentBuilder::new(self.handle.clone())
179    }
180    fn wait_until_db_instance_deleted(&self) -> crate::waiters::db_instance_deleted::DbInstanceDeletedFluentBuilder {
181        crate::waiters::db_instance_deleted::DbInstanceDeletedFluentBuilder::new(self.handle.clone())
182    }
183    fn wait_until_db_snapshot_available(&self) -> crate::waiters::db_snapshot_available::DbSnapshotAvailableFluentBuilder {
184        crate::waiters::db_snapshot_available::DbSnapshotAvailableFluentBuilder::new(self.handle.clone())
185    }
186    fn wait_until_db_snapshot_deleted(&self) -> crate::waiters::db_snapshot_deleted::DbSnapshotDeletedFluentBuilder {
187        crate::waiters::db_snapshot_deleted::DbSnapshotDeletedFluentBuilder::new(self.handle.clone())
188    }
189    fn wait_until_tenant_database_available(&self) -> crate::waiters::tenant_database_available::TenantDatabaseAvailableFluentBuilder {
190        crate::waiters::tenant_database_available::TenantDatabaseAvailableFluentBuilder::new(self.handle.clone())
191    }
192    fn wait_until_tenant_database_deleted(&self) -> crate::waiters::tenant_database_deleted::TenantDatabaseDeletedFluentBuilder {
193        crate::waiters::tenant_database_deleted::TenantDatabaseDeletedFluentBuilder::new(self.handle.clone())
194    }
195}
196
197impl Client {
198    /// Creates a new client from an [SDK Config](::aws_types::sdk_config::SdkConfig).
199    ///
200    /// # Panics
201    ///
202    /// - This method will panic if the `sdk_config` is missing an async sleep implementation. If you experience this panic, set
203    ///   the `sleep_impl` on the Config passed into this function to fix it.
204    /// - This method will panic if the `sdk_config` is missing an HTTP connector. If you experience this panic, set the
205    ///   `http_connector` on the Config passed into this function to fix it.
206    /// - This method will panic if no `BehaviorVersion` is provided. If you experience this panic, set `behavior_version` on the Config or enable the `behavior-version-latest` Cargo feature.
207    #[track_caller]
208    pub fn new(sdk_config: &::aws_types::sdk_config::SdkConfig) -> Self {
209        Self::from_conf(sdk_config.into())
210    }
211}
212
213mod add_role_to_db_cluster;
214
215mod add_role_to_db_instance;
216
217mod add_source_identifier_to_subscription;
218
219mod add_tags_to_resource;
220
221mod apply_pending_maintenance_action;
222
223mod authorize_db_security_group_ingress;
224
225mod backtrack_db_cluster;
226
227mod cancel_export_task;
228
229mod copy_db_cluster_parameter_group;
230
231mod copy_db_cluster_snapshot;
232
233mod copy_db_parameter_group;
234
235mod copy_db_snapshot;
236
237mod copy_option_group;
238
239mod create_blue_green_deployment;
240
241mod create_custom_db_engine_version;
242
243mod create_db_cluster;
244
245mod create_db_cluster_endpoint;
246
247mod create_db_cluster_parameter_group;
248
249mod create_db_cluster_snapshot;
250
251mod create_db_instance;
252
253mod create_db_instance_read_replica;
254
255mod create_db_parameter_group;
256
257mod create_db_proxy;
258
259mod create_db_proxy_endpoint;
260
261mod create_db_security_group;
262
263mod create_db_shard_group;
264
265mod create_db_snapshot;
266
267mod create_db_subnet_group;
268
269mod create_event_subscription;
270
271mod create_global_cluster;
272
273mod create_integration;
274
275mod create_option_group;
276
277mod create_tenant_database;
278
279/// Operation customization and supporting types.
280///
281/// The underlying HTTP requests made during an operation can be customized
282/// by calling the `customize()` method on the builder returned from a client
283/// operation call. For example, this can be used to add an additional HTTP header:
284///
285/// ```ignore
286/// # async fn wrapper() -> ::std::result::Result<(), aws_sdk_rds::Error> {
287/// # let client: aws_sdk_rds::Client = unimplemented!();
288/// use ::http::header::{HeaderName, HeaderValue};
289///
290/// let result = client.add_role_to_db_cluster()
291///     .customize()
292///     .mutate_request(|req| {
293///         // Add `x-example-header` with value
294///         req.headers_mut()
295///             .insert(
296///                 HeaderName::from_static("x-example-header"),
297///                 HeaderValue::from_static("1"),
298///             );
299///     })
300///     .send()
301///     .await;
302/// # }
303/// ```
304pub mod customize;
305
306mod delete_blue_green_deployment;
307
308mod delete_custom_db_engine_version;
309
310mod delete_db_cluster;
311
312mod delete_db_cluster_automated_backup;
313
314mod delete_db_cluster_endpoint;
315
316mod delete_db_cluster_parameter_group;
317
318mod delete_db_cluster_snapshot;
319
320mod delete_db_instance;
321
322mod delete_db_instance_automated_backup;
323
324mod delete_db_parameter_group;
325
326mod delete_db_proxy;
327
328mod delete_db_proxy_endpoint;
329
330mod delete_db_security_group;
331
332mod delete_db_shard_group;
333
334mod delete_db_snapshot;
335
336mod delete_db_subnet_group;
337
338mod delete_event_subscription;
339
340mod delete_global_cluster;
341
342mod delete_integration;
343
344mod delete_option_group;
345
346mod delete_tenant_database;
347
348mod deregister_db_proxy_targets;
349
350mod describe_account_attributes;
351
352mod describe_blue_green_deployments;
353
354mod describe_certificates;
355
356mod describe_db_cluster_automated_backups;
357
358mod describe_db_cluster_backtracks;
359
360mod describe_db_cluster_endpoints;
361
362mod describe_db_cluster_parameter_groups;
363
364mod describe_db_cluster_parameters;
365
366mod describe_db_cluster_snapshot_attributes;
367
368mod describe_db_cluster_snapshots;
369
370mod describe_db_clusters;
371
372mod describe_db_engine_versions;
373
374mod describe_db_instance_automated_backups;
375
376mod describe_db_instances;
377
378mod describe_db_log_files;
379
380mod describe_db_major_engine_versions;
381
382mod describe_db_parameter_groups;
383
384mod describe_db_parameters;
385
386mod describe_db_proxies;
387
388mod describe_db_proxy_endpoints;
389
390mod describe_db_proxy_target_groups;
391
392mod describe_db_proxy_targets;
393
394mod describe_db_recommendations;
395
396mod describe_db_security_groups;
397
398mod describe_db_shard_groups;
399
400mod describe_db_snapshot_attributes;
401
402mod describe_db_snapshot_tenant_databases;
403
404mod describe_db_snapshots;
405
406mod describe_db_subnet_groups;
407
408mod describe_engine_default_cluster_parameters;
409
410mod describe_engine_default_parameters;
411
412mod describe_event_categories;
413
414mod describe_event_subscriptions;
415
416mod describe_events;
417
418mod describe_export_tasks;
419
420mod describe_global_clusters;
421
422mod describe_integrations;
423
424mod describe_option_group_options;
425
426mod describe_option_groups;
427
428mod describe_orderable_db_instance_options;
429
430mod describe_pending_maintenance_actions;
431
432mod describe_reserved_db_instances;
433
434mod describe_reserved_db_instances_offerings;
435
436mod describe_source_regions;
437
438mod describe_tenant_databases;
439
440mod describe_valid_db_instance_modifications;
441
442mod disable_http_endpoint;
443
444mod download_db_log_file_portion;
445
446mod enable_http_endpoint;
447
448mod failover_db_cluster;
449
450mod failover_global_cluster;
451
452mod list_tags_for_resource;
453
454mod modify_activity_stream;
455
456mod modify_certificates;
457
458mod modify_current_db_cluster_capacity;
459
460mod modify_custom_db_engine_version;
461
462mod modify_db_cluster;
463
464mod modify_db_cluster_endpoint;
465
466mod modify_db_cluster_parameter_group;
467
468mod modify_db_cluster_snapshot_attribute;
469
470mod modify_db_instance;
471
472mod modify_db_parameter_group;
473
474mod modify_db_proxy;
475
476mod modify_db_proxy_endpoint;
477
478mod modify_db_proxy_target_group;
479
480mod modify_db_recommendation;
481
482mod modify_db_shard_group;
483
484mod modify_db_snapshot;
485
486mod modify_db_snapshot_attribute;
487
488mod modify_db_subnet_group;
489
490mod modify_event_subscription;
491
492mod modify_global_cluster;
493
494mod modify_integration;
495
496mod modify_option_group;
497
498mod modify_tenant_database;
499
500mod promote_read_replica;
501
502mod promote_read_replica_db_cluster;
503
504mod purchase_reserved_db_instances_offering;
505
506mod reboot_db_cluster;
507
508mod reboot_db_instance;
509
510mod reboot_db_shard_group;
511
512mod register_db_proxy_targets;
513
514mod remove_from_global_cluster;
515
516mod remove_role_from_db_cluster;
517
518mod remove_role_from_db_instance;
519
520mod remove_source_identifier_from_subscription;
521
522mod remove_tags_from_resource;
523
524mod reset_db_cluster_parameter_group;
525
526mod reset_db_parameter_group;
527
528mod restore_db_cluster_from_s3;
529
530mod restore_db_cluster_from_snapshot;
531
532mod restore_db_cluster_to_point_in_time;
533
534mod restore_db_instance_from_db_snapshot;
535
536mod restore_db_instance_from_s3;
537
538mod restore_db_instance_to_point_in_time;
539
540mod revoke_db_security_group_ingress;
541
542mod start_activity_stream;
543
544mod start_db_cluster;
545
546mod start_db_instance;
547
548mod start_db_instance_automated_backups_replication;
549
550mod start_export_task;
551
552mod stop_activity_stream;
553
554mod stop_db_cluster;
555
556mod stop_db_instance;
557
558mod stop_db_instance_automated_backups_replication;
559
560mod switchover_blue_green_deployment;
561
562mod switchover_global_cluster;
563
564mod switchover_read_replica;