Skip to content

Commit

Permalink
Merge branch 'main' into jdisanti-unhandled-error-newtype
Browse files Browse the repository at this point in the history
  • Loading branch information
jdisanti authored Nov 4, 2022
2 parents bd16b5d + 9a6de1f commit cd90022
Show file tree
Hide file tree
Showing 9 changed files with 840 additions and 4 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.next.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,16 @@ message = "Fix cargo audit issue on criterion."
references = ["smithy-rs#1923"]
meta = { "breaking" = false, "tada" = false, "bug" = false }
author = "ysaito1001"

[[aws-sdk-rust]]
message = "Ability to add an inline policy or a list of policy ARNs to the `AssumeRoleProvider` builder."
references = ["aws-sdk-rust#641", "smithy-rs#1892"]
meta = { "breaking" = false, "tada" = true, "bug" = false }
author = "albe-rosado"

[[aws-sdk-rust]]
message = "Removed re-export of `aws_smithy_client::retry::Config` from the `middleware` module."
references = ["smithy-rs#1935"]
meta = { "breaking" = true, "tada" = false, "bug" = false }
author = "jdisanti"

1 change: 1 addition & 0 deletions aws/rust-runtime/aws-config/external-types.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# require manual version bumping every time an automated version bump
# to the exposed SDK crates happens.
allowed_external_types = [
"aws_sdk_sts::model::PolicyDescriptorType",
"aws_smithy_async::rt::sleep::AsyncSleep",
"aws_smithy_client::bounds::SmithyConnector",
"aws_smithy_client::erase::DynConnector",
Expand Down
27 changes: 27 additions & 0 deletions aws/rust-runtime/aws-config/src/sts/assume_role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use aws_sdk_sts::error::AssumeRoleErrorKind;
use aws_sdk_sts::middleware::DefaultMiddleware;
use aws_sdk_sts::model::PolicyDescriptorType;
use aws_sdk_sts::operation::AssumeRole;
use aws_smithy_client::erase::DynConnector;
use aws_smithy_http::result::SdkError;
Expand Down Expand Up @@ -76,6 +77,8 @@ pub struct AssumeRoleProviderBuilder {
region: Option<Region>,
conf: Option<ProviderConfig>,
session_length: Option<Duration>,
policy: Option<String>,
policy_arns: Option<Vec<PolicyDescriptorType>>,
}

impl AssumeRoleProviderBuilder {
Expand All @@ -94,6 +97,8 @@ impl AssumeRoleProviderBuilder {
session_length: None,
region: None,
conf: None,
policy: None,
policy_arns: None,
}
}

Expand All @@ -118,6 +123,26 @@ impl AssumeRoleProviderBuilder {
self
}

/// Set an IAM policy in JSON format that you want to use as an inline session policy.
///
/// This parameter is optional
/// For more information, see
/// [policy](aws_sdk_sts::input::assume_role_input::Builder::policy_arns)
pub fn policy(mut self, policy: impl Into<String>) -> Self {
self.policy = Some(policy.into());
self
}

/// Set the Amazon Resource Names (ARNs) of the IAM managed policies that you want to use as managed session policies.
///
/// This parameter is optional.
/// For more information, see
/// [policy_arns](aws_sdk_sts::input::assume_role_input::Builder::policy_arns)
pub fn policy_arns(mut self, policy_arns: Vec<PolicyDescriptorType>) -> Self {
self.policy_arns = Some(policy_arns);
self
}

/// Set the expiration time of the role session.
///
/// When unset, this value defaults to 1 hour.
Expand Down Expand Up @@ -188,6 +213,8 @@ impl AssumeRoleProviderBuilder {
.set_role_arn(Some(self.role_arn))
.set_external_id(self.external_id)
.set_role_session_name(Some(session_name))
.set_policy(self.policy)
.set_policy_arns(self.policy_arns)
.set_duration_seconds(self.session_length.map(|dur| dur.as_secs() as i32))
.build()
.expect("operation is valid");
Expand Down
2 changes: 0 additions & 2 deletions aws/rust-runtime/aws-inlineable/src/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

//! Base Middleware Stack

pub use aws_smithy_client::retry::Config as RetryConfig;

use aws_endpoint::AwsEndpointStage;
use aws_http::auth::CredentialsStage;
use aws_http::recursion_detection::RecursionDetectionStage;
Expand Down
1 change: 1 addition & 0 deletions design/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
- [RFC-0020: Service Builder Improvements](./rfcs/rfc0020_service_builder.md)
- [RFC-0021: Dependency Versions](./rfcs/rfc0021_dependency_versions.md)
- [RFC-0022: Error Context and Compatibility](./rfcs/rfc0022_error_context_and_compatibility.md)
- [RFC-0023: Evolving the new service builder API](./rfcs/rfc0023_refine_builder.md)

- [Contributing](./contributing/overview.md)
- [Writing and debugging a low-level feature that relies on HTTP](./contributing/writing_and_debugging_a_low-level_feature_that_relies_on_HTTP.md)
1 change: 1 addition & 0 deletions design/src/rfcs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@
- [RFC-0020: Service Builder Improvements](./rfc0020_service_builder.md)
- [RFC-0021: Dependency Versions](./rfc0021_dependency_versions.md)
- [RFC-0022: Error Context and Compatibility](./rfc0022_error_context_and_compatibility.md)
- [RFC-0023: Evolving the new service builder API](./rfc0023_refine_builder.md)
Loading

0 comments on commit cd90022

Please sign in to comment.