Skip to content

Commit de97b3d

Browse files
authored
Remove deprecated ResolveAwsEndpoint and related interfaces. (#2464)
* Remove deprecated ResolveAwsEndpoint and related interfaces. * update changelog with pointer * Rename AwsEndpointDecorator to have a more appropriate name * Allow endpoint resolver to be omitted
1 parent 05f920f commit de97b3d

File tree

11 files changed

+53
-520
lines changed

11 files changed

+53
-520
lines changed

CHANGELOG.next.toml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ references = ["smithy-rs#2448"]
288288
meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "client" }
289289
author = "jdisanti"
290290

291-
292291
[[smithy-rs]]
293292
message = "Fix bug in timestamp format resolution. Prior to this fix, the timestamp format may have been incorrect if set on the target instead of on the member."
294293
references = ["smithy-rs#2226"]
@@ -339,8 +338,6 @@ references = ["smithy-rs#2467"]
339338
meta = { "breaking" = true, "tada" = true, "bug" = false, "target" = "all" }
340339
author = "Velfi"
341340

342-
###############
343-
344341
[[aws-sdk-rust]]
345342
message = """Default connector provided by `aws-config` now respects `ConnectorSettings`.
346343
@@ -353,6 +350,14 @@ references = ["smithy-rs#2471", "smithy-rs#2333", "smithy-rs#2151"]
353350
meta = { "breaking" = false, "tada" = false, "bug" = true }
354351
author = "rcoh"
355352

353+
[[aws-sdk-rust]] # remove interfaces
354+
message = """Remove deprecated `ResolveAwsEndpoint` interfaces.
355+
[For details see the longform changelog entry](https://github.com/awslabs/aws-sdk-rust/discussions/755).
356+
"""
357+
author = "rcoh"
358+
references = ["smithy-rs#2390", "smithy-rs#1784"]
359+
meta = { "breaking" = true, "tada" = false, "bug" = false }
360+
356361
[[smithy-rs]] # tokio-upgrade
357362
message = "Increase Tokio version to 1.23.1 for all crates. This is to address [RUSTSEC-2023-0001](https://rustsec.org/advisories/RUSTSEC-2023-0001)"
358363
references = ["smithy-rs#2474"]

aws/rust-runtime/aws-config/src/lib.rs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ mod loader {
159159
use aws_smithy_types::timeout::TimeoutConfig;
160160
use aws_types::app_name::AppName;
161161
use aws_types::docs_for;
162-
use aws_types::endpoint::ResolveAwsEndpoint;
163162
use aws_types::SdkConfig;
164163

165164
use crate::connector::default_connector;
@@ -181,7 +180,6 @@ mod loader {
181180
app_name: Option<AppName>,
182181
credentials_cache: Option<CredentialsCache>,
183182
credentials_provider: Option<SharedCredentialsProvider>,
184-
endpoint_resolver: Option<Arc<dyn ResolveAwsEndpoint>>,
185183
endpoint_url: Option<String>,
186184
region: Option<Box<dyn ProvideRegion>>,
187185
retry_config: Option<RetryConfig>,
@@ -345,36 +343,6 @@ mod loader {
345343
self
346344
}
347345

348-
/// Override the endpoint resolver used for **all** AWS Services
349-
///
350-
/// This method is deprecated. Use [`Self::endpoint_url`] instead.
351-
///
352-
/// This method will override the endpoint resolver used for **all** AWS services. This mainly
353-
/// exists to set a static endpoint for tools like `LocalStack`. For live traffic, AWS services
354-
/// require the service-specific endpoint resolver they load by default.
355-
///
356-
/// # Examples
357-
///
358-
/// Use a static endpoint for all services
359-
/// ```no_run
360-
/// # async fn create_config() -> Result<(), aws_smithy_http::endpoint::error::InvalidEndpointError> {
361-
/// use aws_config::endpoint::Endpoint;
362-
///
363-
/// let sdk_config = aws_config::from_env()
364-
/// .endpoint_resolver(Endpoint::immutable("http://localhost:1234")?)
365-
/// .load()
366-
/// .await;
367-
/// # Ok(())
368-
/// # }
369-
#[deprecated(note = "use `.endpoint_url(...)` instead")]
370-
pub fn endpoint_resolver(
371-
mut self,
372-
endpoint_resolver: impl ResolveAwsEndpoint + 'static,
373-
) -> Self {
374-
self.endpoint_resolver = Some(Arc::new(endpoint_resolver));
375-
self
376-
}
377-
378346
/// Provides the ability to programmatically override the profile files that get loaded by the SDK.
379347
///
380348
/// The [`Default`] for `ProfileFiles` includes the default SDK config and credential files located in
@@ -600,8 +568,6 @@ mod loader {
600568
SharedCredentialsProvider::new(builder.build().await)
601569
};
602570

603-
let endpoint_resolver = self.endpoint_resolver;
604-
605571
let mut builder = SdkConfig::builder()
606572
.region(region)
607573
.retry_config(retry_config)
@@ -610,7 +576,6 @@ mod loader {
610576
.credentials_provider(credentials_provider)
611577
.http_connector(http_connector);
612578

613-
builder.set_endpoint_resolver(endpoint_resolver);
614579
builder.set_app_name(app_name);
615580
builder.set_sleep_impl(sleep_impl);
616581
builder.set_endpoint_url(self.endpoint_url);

aws/rust-runtime/aws-endpoint/src/lib.rs

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -5,84 +5,17 @@
55

66
#![allow(clippy::derive_partial_eq_without_eq)]
77

8-
use std::collections::HashMap;
98
use std::error::Error;
109
use std::fmt;
11-
use std::sync::Arc;
1210

13-
use aws_smithy_http::endpoint::error::ResolveEndpointError;
14-
use aws_smithy_http::endpoint::ResolveEndpoint;
1511
use aws_smithy_http::middleware::MapRequest;
1612
use aws_smithy_http::operation::Request;
1713
use aws_smithy_types::endpoint::Endpoint as SmithyEndpoint;
1814
use aws_smithy_types::Document;
1915

20-
pub use aws_types::endpoint::{AwsEndpoint, BoxError, CredentialScope, ResolveAwsEndpoint};
2116
use aws_types::region::{Region, SigningRegion};
2217
use aws_types::SigningService;
2318

24-
#[doc(hidden)]
25-
pub struct Params {
26-
region: Option<Region>,
27-
}
28-
29-
impl Params {
30-
pub fn new(region: Option<Region>) -> Self {
31-
Self { region }
32-
}
33-
}
34-
35-
#[doc(hidden)]
36-
pub struct EndpointShim(Arc<dyn ResolveAwsEndpoint>);
37-
impl EndpointShim {
38-
pub fn from_resolver(resolver: impl ResolveAwsEndpoint + 'static) -> Self {
39-
Self(Arc::new(resolver))
40-
}
41-
42-
pub fn from_arc(arc: Arc<dyn ResolveAwsEndpoint>) -> Self {
43-
Self(arc)
44-
}
45-
}
46-
47-
impl<T> ResolveEndpoint<T> for EndpointShim
48-
where
49-
T: Clone + Into<Params>,
50-
{
51-
fn resolve_endpoint(&self, params: &T) -> Result<SmithyEndpoint, ResolveEndpointError> {
52-
let params: Params = params.clone().into();
53-
let aws_endpoint = self
54-
.0
55-
.resolve_endpoint(
56-
params
57-
.region
58-
.as_ref()
59-
.ok_or_else(|| ResolveEndpointError::message("no region in params"))?,
60-
)
61-
.map_err(|err| {
62-
ResolveEndpointError::message("failure resolving endpoint").with_source(Some(err))
63-
})?;
64-
let uri = aws_endpoint.endpoint().uri();
65-
let mut auth_scheme =
66-
HashMap::from([("name".to_string(), Document::String("sigv4".into()))]);
67-
if let Some(region) = aws_endpoint.credential_scope().region() {
68-
auth_scheme.insert(
69-
"signingRegion".to_string(),
70-
region.as_ref().to_string().into(),
71-
);
72-
}
73-
if let Some(service) = aws_endpoint.credential_scope().service() {
74-
auth_scheme.insert(
75-
"signingName".to_string(),
76-
service.as_ref().to_string().into(),
77-
);
78-
}
79-
Ok(SmithyEndpoint::builder()
80-
.url(uri.to_string())
81-
.property("authSchemes", vec![Document::Object(auth_scheme)])
82-
.build())
83-
}
84-
}
85-
8619
/// Middleware Stage to add authentication information from a Smithy endpoint into the property bag
8720
///
8821
/// AwsAuthStage implements [`MapRequest`](MapRequest). It will:
@@ -95,7 +28,7 @@ pub struct AwsAuthStage;
9528
#[derive(Debug)]
9629
enum AwsAuthStageErrorKind {
9730
NoEndpointResolver,
98-
EndpointResolutionError(BoxError),
31+
EndpointResolutionError(Box<dyn Error + Send + Sync>),
9932
}
10033

10134
#[derive(Debug)]

aws/rust-runtime/aws-types/src/endpoint.rs

Lines changed: 0 additions & 192 deletions
This file was deleted.

aws/rust-runtime/aws-types/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616

1717
pub mod app_name;
1818
pub mod build_metadata;
19-
#[deprecated(since = "0.9.0", note = "renamed to sdk_config")]
20-
pub mod config;
21-
pub mod endpoint;
2219
#[doc(hidden)]
2320
pub mod os_shim_internal;
2421
pub mod region;

0 commit comments

Comments
 (0)