Unverified Commit 31625f5b authored by Russell Cohen's avatar Russell Cohen Committed by GitHub
Browse files

Assorted cleanups of stable runtime crates (#3205)

## Motivation and Context
Stable crates MUST only expose other stable crates.

## Description
 This:
- fixes the remaining issues
- adds a lint tool to be sure we don't expose unstable crates by
accident in the future

## Testing
CI run

## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
parent bab31ab3
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -10,3 +10,21 @@
# references = ["smithy-rs#920"]
# meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client | server | all"}
# author = "rcoh"

[[smithy-rs]]
message = "SignableRequest::apply_to_request in aws_sigv4 has been renamed `apply_to_request_http0x`"
references = ["smithy-rs#3205"]
meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "client" }
author = "rcoh"

[[aws-sdk-rust]]
message = "imds::client::Builder::endpoint has been updated to accept a string instead of a URI. The method now returns a result instead."
references = ["smithy-rs#3205"]
meta = { "breaking" = true, "tada" = false, "bug" = false }
author = "rcoh"

[[aws-sdk-rust]]
message = "The `AssumeRoleBuilder::policy_arns` now accepts strings instead of an STS specific type"
references = ["smithy-rs#3205"]
meta = { "breaking" = true, "tada" = false, "bug" = false }
author = "rcoh"
+1 −11
Original line number Diff line number Diff line
@@ -7,13 +7,11 @@ allowed_external_types = [
   "aws_credential_types::provider::ProvideCredentials",
   "aws_credential_types::provider::Result",
   "aws_credential_types::provider::SharedCredentialsProvider",
   "aws_sdk_sts::types::_policy_descriptor_type::PolicyDescriptorType",
   "aws_smithy_async::rt::sleep::AsyncSleep",
   "aws_smithy_async::rt::sleep::SharedAsyncSleep",
   "aws_smithy_async::time::SharedTimeSource",
   "aws_smithy_async::time::TimeSource",
   "aws_smithy_http::endpoint",
   "aws_smithy_http::endpoint::error::InvalidEndpointError",
   "aws_smithy_runtime_api::box_error::BoxError",
   "aws_smithy_runtime::client::identity::cache::IdentityCache",
   "aws_smithy_runtime::client::identity::cache::lazy::LazyCacheBuilder",
   "aws_smithy_runtime_api::client::dns::ResolveDns",
@@ -33,12 +31,4 @@ allowed_external_types = [
   "aws_smithy_types::timeout::TimeoutConfig",
   "aws_smithy_types::timeout::TimeoutConfigBuilder",
   "aws_types::*",
   "http::response::Response",
   "http::uri::Uri",
   "tower_service::Service",

   # TODO(https://github.com/smithy-lang/smithy-rs/issues/1193): Decide if the following should be exposed
   "hyper::client::connect::Connection",
   "tokio::io::async_read::AsyncRead",
   "tokio::io::async_write::AsyncWrite",
]
+11 −7
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ use aws_http::user_agent::{ApiMetadata, AwsUserAgent};
use aws_runtime::user_agent::UserAgentInterceptor;
use aws_smithy_runtime::client::orchestrator::operation::Operation;
use aws_smithy_runtime::client::retries::strategy::StandardRetryStrategy;
use aws_smithy_runtime_api::box_error::BoxError;
use aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams;
use aws_smithy_runtime_api::client::endpoint::{
    EndpointFuture, EndpointResolverParams, ResolveEndpoint,
@@ -87,10 +88,9 @@ fn user_agent() -> AwsUserAgent {
/// 1. Explicit configuration of `Endpoint` via the [builder](Builder):
/// ```no_run
/// use aws_config::imds::client::Client;
/// use http::Uri;
/// # async fn docs() {
/// let client = Client::builder()
///   .endpoint(Uri::from_static("http://customidms:456/"))
///   .endpoint("http://customidms:456/").expect("valid URI")
///   .build();
/// # }
/// ```
@@ -358,9 +358,10 @@ impl Builder {
    /// By default, the client will resolve an endpoint from the environment, AWS config, and endpoint mode.
    ///
    /// See [`Client`] for more information.
    pub fn endpoint(mut self, endpoint: impl Into<Uri>) -> Self {
        self.endpoint = Some(EndpointSource::Explicit(endpoint.into()));
        self
    pub fn endpoint(mut self, endpoint: impl AsRef<str>) -> Result<Self, BoxError> {
        let uri: Uri = endpoint.as_ref().parse()?;
        self.endpoint = Some(EndpointSource::Explicit(uri));
        Ok(self)
    }

    /// Override the endpoint mode for [`Client`]
@@ -992,7 +993,8 @@ pub(crate) mod test {

        let client = Client::builder()
            // 240.* can never be resolved
            .endpoint(Uri::from_static("http://240.0.0.0"))
            .endpoint("http://240.0.0.0")
            .expect("valid uri")
            .build();
        let now = SystemTime::now();
        let resp = client
@@ -1057,7 +1059,9 @@ pub(crate) mod test {
            .with_http_client(http_client);
        let mut imds_client = Client::builder().configure(&provider_config);
        if let Some(endpoint_override) = test_case.endpoint_override {
            imds_client = imds_client.endpoint(endpoint_override.parse::<Uri>().unwrap());
            imds_client = imds_client
                .endpoint(endpoint_override)
                .expect("invalid URI");
        }

        if let Some(mode_override) = test_case.mode_override {
+0 −9
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@

//! Error types for [`ImdsClient`](crate::imds::client::Client)

use aws_smithy_http::endpoint::error::InvalidEndpointError;
use aws_smithy_runtime_api::client::orchestrator::HttpResponse;
use aws_smithy_runtime_api::client::result::SdkError;
use std::error::Error;
@@ -224,14 +223,6 @@ impl Error for BuildError {
    }
}

impl From<InvalidEndpointError> for BuildError {
    fn from(err: InvalidEndpointError) -> Self {
        Self {
            kind: BuildErrorKind::InvalidEndpointUri(err.into()),
        }
    }
}

#[derive(Debug)]
pub(super) enum TokenErrorKind {
    /// The token was invalid
+6 −3
Original line number Diff line number Diff line
@@ -421,7 +421,8 @@ mod test {
    async fn read_timeout_during_credentials_refresh_should_yield_last_retrieved_credentials() {
        let client = crate::imds::Client::builder()
            // 240.* can never be resolved
            .endpoint(http::Uri::from_static("http://240.0.0.0"))
            .endpoint("http://240.0.0.0")
            .unwrap()
            .build();
        let expected = aws_credential_types::Credentials::for_tests();
        let provider = ImdsCredentialsProvider::builder()
@@ -439,7 +440,8 @@ mod test {
    ) {
        let client = crate::imds::Client::builder()
            // 240.* can never be resolved
            .endpoint(http::Uri::from_static("http://240.0.0.0"))
            .endpoint("http://240.0.0.0")
            .unwrap()
            .build();
        let provider = ImdsCredentialsProvider::builder()
            .imds_client(client)
@@ -458,7 +460,8 @@ mod test {
        use aws_smithy_async::rt::sleep::AsyncSleep;
        let client = crate::imds::Client::builder()
            // 240.* can never be resolved
            .endpoint(http::Uri::from_static("http://240.0.0.0"))
            .endpoint("http://240.0.0.0")
            .unwrap()
            .build();
        let expected = aws_credential_types::Credentials::for_tests();
        let provider = ImdsCredentialsProvider::builder()
Loading