Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename aws_types::config::Config to sdk_config::SdkConfig #1241

Merged
merged 13 commits into from
Mar 10, 2022
71 changes: 71 additions & 0 deletions CHANGELOG.next.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,77 @@ references = ["smithy-rs#1225"]
meta = { "breaking" = false, "tada" = false, "bug" = false }
author = "Velfi"

[[aws-sdk-rust]]
message = """
`aws_types::config::Config` has been renamed to `aws_types::sdk_config::SdkConfig`. This is to better differentiate it
from service-specific configs like `aws_sdk_s3::Config`. If you were creating shared configs with
`aws_config::load_from_env()`, then you don't have to do anything. If you were directly referring to a shared config,
update your `use` statements and `struct` names.

_Before:_
```rust
use aws_types::config::Config;

fn main() {
let config = Config::builder()
// config builder methods...
.build()
.await;
}
```

_After:_
```rust
// We re-export this type from the root module so it's easier to reference
use aws_types::SdkConfig;

fn main() {
let config = SdkConfig::builder()
// config builder methods...
.build()
.await;
}
```
"""
references = ["aws-sdk-rust#406"]
meta = { "breaking" = true, "tada" = false, "bug" = false }
author = "Velfi"

[[smithy-rs]]
message = """
`aws_types::config::Config` has been renamed to `aws_types:sdk_config::SdkConfig`. This is to better differentiate it
from service-specific configs like `aws_s3_sdk::Config`. If you were creating shared configs with
`aws_config::load_from_env()`, then you don't have to do anything. If you were directly referring to a shared config,
update your `use` statements and `struct` names.

_Before:_
```rust
use aws_types::config::Config;

fn main() {
let config = Config::builder()
// config builder methods...
.build()
.await;
}
```

_After:_
```rust
use aws_types::SdkConfig;

fn main() {
let config = SdkConfig::builder()
// config builder methods...
.build()
.await;
}
```
"""
references = ["aws-sdk-rust#406"]
meta = { "breaking" = true, "tada" = false, "bug" = false }
author = "Velfi"

[[aws-sdk-rust]]
message = "Enable presigning for S3 operations UploadPart and DeleteObject"
references = ["aws-sdk-rust#475", "aws-sdk-rust#473"]
Expand Down
29 changes: 14 additions & 15 deletions aws/rust-runtime/aws-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//! [`from_env`]/[`ConfigLoader`] or ad-hoc individual credential and region providers.
//!
//! [`ConfigLoader`](ConfigLoader) can combine different configuration sources into an AWS shared-config:
//! [`Config`](aws_types::config::Config). [`Config`](aws_types::config::Config) can be used configure
//! [`SdkConfig`](aws_types::SdkConfig). [`SdkConfig`](aws_types::SdkConfig) can be used configure
//! an AWS service client.
//!
//! # Examples
Expand All @@ -20,7 +20,7 @@
//! # mod aws_sdk_dynamodb {
//! # pub struct Client;
//! # impl Client {
//! # pub fn new(config: &aws_types::config::Config) -> Self { Client }
//! # pub fn new(config: &aws_types::SdkConfig) -> Self { Client }
//! # }
//! # }
//! # async fn docs() {
Expand All @@ -34,7 +34,7 @@
//! # mod aws_sdk_dynamodb {
//! # pub struct Client;
//! # impl Client {
//! # pub fn new(config: &aws_types::config::Config) -> Self { Client }
//! # pub fn new(config: &aws_types::SdkConfig) -> Self { Client }
//! # }
//! # }
//! # async fn docs() {
Expand Down Expand Up @@ -90,7 +90,6 @@ pub use aws_smithy_types::timeout::TimeoutConfig;

// Re-export types from aws-types
pub use aws_types::app_name::{AppName, InvalidAppName};
pub use aws_types::config::Config;

/// Create an environment loader for AWS Configuration
///
Expand All @@ -108,7 +107,7 @@ pub fn from_env() -> ConfigLoader {
/// Load a default configuration from the environment
///
/// Convenience wrapper equivalent to `aws_config::from_env().load().await`
pub async fn load_from_env() -> aws_types::config::Config {
pub async fn load_from_env() -> aws_types::SdkConfig {
from_env().load().await
}

Expand All @@ -124,14 +123,14 @@ mod loader {
use aws_smithy_types::retry::RetryConfig;
use aws_smithy_types::timeout::TimeoutConfig;
use aws_types::app_name::AppName;
use aws_types::config::Config;
use aws_types::credentials::{ProvideCredentials, SharedCredentialsProvider};
use aws_types::SdkConfig;

use crate::default_provider::{app_name, credentials, region, retry_config, timeout_config};
use crate::meta::region::ProvideRegion;
use crate::provider_config::ProviderConfig;

/// Load a cross-service [`Config`](aws_types::config::Config) from the environment
/// Load a cross-service [`SdkConfig`](aws_types::SdkConfig) from the environment
///
/// This builder supports overriding individual components of the generated config. Overriding a component
/// will skip the standard resolution chain from **for that component**. For example,
Expand All @@ -150,7 +149,7 @@ mod loader {
}

impl ConfigLoader {
/// Override the region used to build [`Config`](aws_types::config::Config).
/// Override the region used to build [`SdkConfig`](aws_types::SdkConfig).
///
/// # Examples
/// ```no_run
Expand All @@ -166,7 +165,7 @@ mod loader {
self
}

/// Override the retry_config used to build [`Config`](aws_types::config::Config).
/// Override the retry_config used to build [`SdkConfig`](aws_types::SdkConfig).
///
/// # Examples
/// ```no_run
Expand All @@ -182,7 +181,7 @@ mod loader {
self
}

/// Override the timeout config used to build [`Config`](aws_types::config::Config).
/// Override the timeout config used to build [`SdkConfig`](aws_types::SdkConfig).
/// **Note: This only sets timeouts for calls to AWS services.** Timeouts for the credentials
/// provider chain are configured separately.
///
Expand Down Expand Up @@ -211,13 +210,13 @@ mod loader {
self
}

/// Override the [`HttpConnector`] used to build [`Config`](aws_types::config::Config).
/// Override the [`HttpConnector`] used to build [`SdkConfig`](aws_types::SdkConfig).
pub fn http_connector(mut self, http_connector: HttpConnector) -> Self {
self.http_connector = Some(http_connector);
self
}

/// Override the credentials provider used to build [`Config`](aws_types::config::Config).
/// Override the credentials provider used to build [`SdkConfig`](aws_types::SdkConfig).
///
/// # Examples
///
Expand Down Expand Up @@ -273,8 +272,8 @@ mod loader {
///
/// NOTE: When an override is provided, the default implementation is **not** used as a fallback.
/// This means that if you provide a region provider that does not return a region, no region will
/// be set in the resulting [`Config`](aws_types::config::Config)
pub async fn load(self) -> aws_types::config::Config {
/// be set in the resulting [`SdkConfig`](aws_types::SdkConfig)
pub async fn load(self) -> SdkConfig {
let conf = self.provider_config.unwrap_or_default();
let region = if let Some(provider) = self.region {
provider.region().await
Expand Down Expand Up @@ -344,7 +343,7 @@ mod loader {
SharedCredentialsProvider::new(builder.build().await)
};

let mut builder = Config::builder()
let mut builder = SdkConfig::builder()
.region(region)
.retry_config(retry_config)
.timeout_config(timeout_config)
Expand Down
Loading