Skip to content

Commit

Permalink
[smithy-rs] Port customizable operation to orchestrator (#2706)
Browse files Browse the repository at this point in the history
## Motivation and Context
Port [Customizable
Operation](smithy-lang/smithy-rs#1647) to
orchestrator

## Description
This PR implements `CustomizableOperation` in the orchestrator. Just
like the counterpart in the middleware, it is created when the
`customize` method (in the orchestrator mode) on a fluent builder is
called. The `customize` method in the orchestrator could technically be
made a synchronous method because there is no need to create an
operation, which requires `async`, therefore making the `customize`
method in the middleware `async`. However, during the transition from
the middleware to the orchestrator, the integration tests
([example](https://github.com/awslabs/smithy-rs/blob/31c152d9af53afb9a5e6edf9df3def57931b9c1e/aws/sdk/integration-tests/s3/tests/signing-it.rs#L36))
need to be able to run in both modes. For this reason, the `customize`
method in the orchestrator is temporarily marked as `async`.

Regarding methods defined on the new `CustomizableOperation`, they
include `mutate_request` and `map_request` from the counterpart in the
middleware. However, it did not port `map_operation` because there is no
operation to map on. Most use cases for `map_operation` is put things in
a property bag. The new `CustomizableOperation` provides an
`interceptor` method to accomplish the same, i.e putting things in a
config bag.

Finally, for integration tests to run in both modes, the code gen emits
the implementation of the `customize` method differently depending on
the active Smithy runtime mode, similar to what the implementation of
`send` method does.

## Testing
Added one `sra-test` for mutating a request.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._

---------

Co-authored-by: Yuki Saito <awsaito@amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
  • Loading branch information
3 people authored and aws-sdk-rust-ci committed May 24, 2023
1 parent d345f24 commit 9cb1526
Show file tree
Hide file tree
Showing 13,379 changed files with 237,158 additions and 40,471 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
22 changes: 19 additions & 3 deletions sdk/accessanalyzer/src/operation/apply_archive_rule/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ impl ApplyArchiveRuleFluentBuilder {
inner: ::std::default::Default::default(),
}
}
/// Consume this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
// This function will go away in the near future. Do not rely on it.
#[doc(hidden)]
pub async fn customize_middleware(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
Expand Down Expand Up @@ -83,6 +83,22 @@ impl ApplyArchiveRuleFluentBuilder {
> {
self.send_middleware().await
}

/// Consumes this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
crate::operation::apply_archive_rule::ApplyArchiveRule,
::aws_http::retry::AwsResponseRetryClassifier,
>,
::aws_smithy_http::result::SdkError<
crate::operation::apply_archive_rule::ApplyArchiveRuleError,
>,
> {
self.customize_middleware().await
}
/// <p>The Amazon resource name (ARN) of the analyzer.</p>
pub fn analyzer_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.analyzer_arn(input.into());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ impl CancelPolicyGenerationFluentBuilder {
inner: ::std::default::Default::default(),
}
}
/// Consume this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
// This function will go away in the near future. Do not rely on it.
#[doc(hidden)]
pub async fn customize_middleware(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
Expand Down Expand Up @@ -83,6 +83,22 @@ impl CancelPolicyGenerationFluentBuilder {
> {
self.send_middleware().await
}

/// Consumes this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
crate::operation::cancel_policy_generation::CancelPolicyGeneration,
::aws_http::retry::AwsResponseRetryClassifier,
>,
::aws_smithy_http::result::SdkError<
crate::operation::cancel_policy_generation::CancelPolicyGenerationError,
>,
> {
self.customize_middleware().await
}
/// <p>The <code>JobId</code> that is returned by the <code>StartPolicyGeneration</code> operation. The <code>JobId</code> can be used with <code>GetGeneratedPolicy</code> to retrieve the generated policies or used with <code>CancelPolicyGeneration</code> to cancel the policy generation request.</p>
pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.job_id(input.into());
Expand Down
22 changes: 19 additions & 3 deletions sdk/accessanalyzer/src/operation/create_access_preview/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ impl CreateAccessPreviewFluentBuilder {
inner: ::std::default::Default::default(),
}
}
/// Consume this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
// This function will go away in the near future. Do not rely on it.
#[doc(hidden)]
pub async fn customize_middleware(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
Expand Down Expand Up @@ -83,6 +83,22 @@ impl CreateAccessPreviewFluentBuilder {
> {
self.send_middleware().await
}

/// Consumes this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
crate::operation::create_access_preview::CreateAccessPreview,
::aws_http::retry::AwsResponseRetryClassifier,
>,
::aws_smithy_http::result::SdkError<
crate::operation::create_access_preview::CreateAccessPreviewError,
>,
> {
self.customize_middleware().await
}
/// <p>The <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-getting-started.html#permission-resources">ARN of the account analyzer</a> used to generate the access preview. You can only create an access preview for analyzers with an <code>Account</code> type and <code>Active</code> status.</p>
pub fn analyzer_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.analyzer_arn(input.into());
Expand Down
20 changes: 17 additions & 3 deletions sdk/accessanalyzer/src/operation/create_analyzer/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ impl CreateAnalyzerFluentBuilder {
inner: ::std::default::Default::default(),
}
}
/// Consume this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
// This function will go away in the near future. Do not rely on it.
#[doc(hidden)]
pub async fn customize_middleware(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
Expand Down Expand Up @@ -77,6 +77,20 @@ impl CreateAnalyzerFluentBuilder {
> {
self.send_middleware().await
}

/// Consumes this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
crate::operation::create_analyzer::CreateAnalyzer,
::aws_http::retry::AwsResponseRetryClassifier,
>,
::aws_smithy_http::result::SdkError<crate::operation::create_analyzer::CreateAnalyzerError>,
> {
self.customize_middleware().await
}
/// <p>The name of the analyzer to create.</p>
pub fn analyzer_name(
mut self,
Expand Down
22 changes: 19 additions & 3 deletions sdk/accessanalyzer/src/operation/create_archive_rule/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ impl CreateArchiveRuleFluentBuilder {
inner: ::std::default::Default::default(),
}
}
/// Consume this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
// This function will go away in the near future. Do not rely on it.
#[doc(hidden)]
pub async fn customize_middleware(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
Expand Down Expand Up @@ -84,6 +84,22 @@ impl CreateArchiveRuleFluentBuilder {
> {
self.send_middleware().await
}

/// Consumes this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
crate::operation::create_archive_rule::CreateArchiveRule,
::aws_http::retry::AwsResponseRetryClassifier,
>,
::aws_smithy_http::result::SdkError<
crate::operation::create_archive_rule::CreateArchiveRuleError,
>,
> {
self.customize_middleware().await
}
/// <p>The name of the created analyzer.</p>
pub fn analyzer_name(
mut self,
Expand Down
20 changes: 17 additions & 3 deletions sdk/accessanalyzer/src/operation/delete_analyzer/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ impl DeleteAnalyzerFluentBuilder {
inner: ::std::default::Default::default(),
}
}
/// Consume this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
// This function will go away in the near future. Do not rely on it.
#[doc(hidden)]
pub async fn customize_middleware(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
Expand Down Expand Up @@ -77,6 +77,20 @@ impl DeleteAnalyzerFluentBuilder {
> {
self.send_middleware().await
}

/// Consumes this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
crate::operation::delete_analyzer::DeleteAnalyzer,
::aws_http::retry::AwsResponseRetryClassifier,
>,
::aws_smithy_http::result::SdkError<crate::operation::delete_analyzer::DeleteAnalyzerError>,
> {
self.customize_middleware().await
}
/// <p>The name of the analyzer to delete.</p>
pub fn analyzer_name(
mut self,
Expand Down
22 changes: 19 additions & 3 deletions sdk/accessanalyzer/src/operation/delete_archive_rule/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ impl DeleteArchiveRuleFluentBuilder {
inner: ::std::default::Default::default(),
}
}
/// Consume this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
// This function will go away in the near future. Do not rely on it.
#[doc(hidden)]
pub async fn customize_middleware(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
Expand Down Expand Up @@ -83,6 +83,22 @@ impl DeleteArchiveRuleFluentBuilder {
> {
self.send_middleware().await
}

/// Consumes this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
crate::operation::delete_archive_rule::DeleteArchiveRule,
::aws_http::retry::AwsResponseRetryClassifier,
>,
::aws_smithy_http::result::SdkError<
crate::operation::delete_archive_rule::DeleteArchiveRuleError,
>,
> {
self.customize_middleware().await
}
/// <p>The name of the analyzer that associated with the archive rule to delete.</p>
pub fn analyzer_name(
mut self,
Expand Down
22 changes: 19 additions & 3 deletions sdk/accessanalyzer/src/operation/get_access_preview/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ impl GetAccessPreviewFluentBuilder {
inner: ::std::default::Default::default(),
}
}
/// Consume this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
// This function will go away in the near future. Do not rely on it.
#[doc(hidden)]
pub async fn customize_middleware(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
Expand Down Expand Up @@ -83,6 +83,22 @@ impl GetAccessPreviewFluentBuilder {
> {
self.send_middleware().await
}

/// Consumes this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
crate::operation::get_access_preview::GetAccessPreview,
::aws_http::retry::AwsResponseRetryClassifier,
>,
::aws_smithy_http::result::SdkError<
crate::operation::get_access_preview::GetAccessPreviewError,
>,
> {
self.customize_middleware().await
}
/// <p>The unique ID for the access preview.</p>
pub fn access_preview_id(
mut self,
Expand Down
22 changes: 19 additions & 3 deletions sdk/accessanalyzer/src/operation/get_analyzed_resource/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ impl GetAnalyzedResourceFluentBuilder {
inner: ::std::default::Default::default(),
}
}
/// Consume this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
// This function will go away in the near future. Do not rely on it.
#[doc(hidden)]
pub async fn customize_middleware(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
Expand Down Expand Up @@ -83,6 +83,22 @@ impl GetAnalyzedResourceFluentBuilder {
> {
self.send_middleware().await
}

/// Consumes this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
crate::operation::get_analyzed_resource::GetAnalyzedResource,
::aws_http::retry::AwsResponseRetryClassifier,
>,
::aws_smithy_http::result::SdkError<
crate::operation::get_analyzed_resource::GetAnalyzedResourceError,
>,
> {
self.customize_middleware().await
}
/// <p>The <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-getting-started.html#permission-resources">ARN of the analyzer</a> to retrieve information from.</p>
pub fn analyzer_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.analyzer_arn(input.into());
Expand Down
20 changes: 17 additions & 3 deletions sdk/accessanalyzer/src/operation/get_analyzer/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ impl GetAnalyzerFluentBuilder {
inner: ::std::default::Default::default(),
}
}
/// Consume this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
// This function will go away in the near future. Do not rely on it.
#[doc(hidden)]
pub async fn customize_middleware(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
Expand Down Expand Up @@ -77,6 +77,20 @@ impl GetAnalyzerFluentBuilder {
> {
self.send_middleware().await
}

/// Consumes this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
crate::operation::get_analyzer::GetAnalyzer,
::aws_http::retry::AwsResponseRetryClassifier,
>,
::aws_smithy_http::result::SdkError<crate::operation::get_analyzer::GetAnalyzerError>,
> {
self.customize_middleware().await
}
/// <p>The name of the analyzer retrieved.</p>
pub fn analyzer_name(
mut self,
Expand Down
22 changes: 19 additions & 3 deletions sdk/accessanalyzer/src/operation/get_archive_rule/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ impl GetArchiveRuleFluentBuilder {
inner: ::std::default::Default::default(),
}
}
/// Consume this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
// This function will go away in the near future. Do not rely on it.
#[doc(hidden)]
pub async fn customize_middleware(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
Expand Down Expand Up @@ -84,6 +84,22 @@ impl GetArchiveRuleFluentBuilder {
> {
self.send_middleware().await
}

/// Consumes this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
crate::operation::get_archive_rule::GetArchiveRule,
::aws_http::retry::AwsResponseRetryClassifier,
>,
::aws_smithy_http::result::SdkError<
crate::operation::get_archive_rule::GetArchiveRuleError,
>,
> {
self.customize_middleware().await
}
/// <p>The name of the analyzer to retrieve rules from.</p>
pub fn analyzer_name(
mut self,
Expand Down
Loading

0 comments on commit 9cb1526

Please sign in to comment.