Skip to content

Commit 86a6647

Browse files
david-perezaws-sdk-rust-ci
authored andcommitted
[smithy-rs] Undeprecate {content_type,accept}_header_classifier from aws-smithy-http-server (#2604)
These functions were mistakenly deprecated when deprecating the old service builder API in #1886. However, they're fine, and they're internally used by the generated server SDKs. The module they reside in is `#[doc(hidden)]`. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
1 parent 033e5c6 commit 86a6647

File tree

91 files changed

+3809
-5302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+3809
-5302
lines changed

sdk/pricing/src/client.rs

Lines changed: 117 additions & 151 deletions
Large diffs are not rendered by default.

sdk/pricing/src/client/customize.rs

Lines changed: 71 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,82 @@
11
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2-
use crate::client::Handle;
32
pub use aws_smithy_http::operation::Operation;
4-
pub use aws_smithy_http::operation::Request;
5-
pub use aws_smithy_http::operation::Response;
6-
pub use aws_smithy_http::retry::ClassifyRetry;
7-
pub use aws_smithy_types::retry::RetryKind;
3+
pub use aws_smithy_http::operation::Request;
4+
pub use aws_smithy_http::operation::Response;
5+
pub use aws_smithy_http::retry::ClassifyRetry;
6+
pub use aws_smithy_types::retry::RetryKind;
7+
use crate::client::Handle;
8+
9+
use aws_smithy_http::body::SdkBody;
10+
use aws_smithy_http::result::SdkError;
811

9-
use aws_smithy_http::body::SdkBody;
10-
use aws_smithy_http::result::SdkError;
12+
use std::convert::Infallible;
13+
use std::sync::Arc;
1114

12-
use std::convert::Infallible;
13-
use std::sync::Arc;
15+
/// A wrapper type for [`Operation`](aws_smithy_http::operation::Operation)s that allows for
16+
/// customization of the operation before it is sent. A `CustomizableOperation` may be sent
17+
/// by calling its [`.send()`][crate::client::customize::CustomizableOperation::send] method.
18+
#[derive(Debug)]
19+
pub struct CustomizableOperation<O, Retry> {
20+
pub(crate) handle: Arc<Handle>,
21+
pub(crate) operation: Operation<O, Retry>,
22+
}
1423

15-
/// A wrapper type for [`Operation`](aws_smithy_http::operation::Operation)s that allows for
16-
/// customization of the operation before it is sent. A `CustomizableOperation` may be sent
17-
/// by calling its [`.send()`][crate::client::customize::CustomizableOperation::send] method.
18-
#[derive(Debug)]
19-
pub struct CustomizableOperation<O, Retry> {
20-
pub(crate) handle: Arc<Handle>,
21-
pub(crate) operation: Operation<O, Retry>,
22-
}
24+
impl<O, Retry> CustomizableOperation<O, Retry>
25+
where
26+
27+
{
28+
/// Allows for customizing the operation's request
29+
pub fn map_request<E>(
30+
mut self,
31+
f: impl FnOnce(http::Request<SdkBody>) -> Result<http::Request<SdkBody>, E>,
32+
) -> Result<Self, E> {
33+
let (request, response) = self.operation.into_request_response();
34+
let request = request.augment(|req, _props| f(req))?;
35+
self.operation = Operation::from_parts(request, response);
36+
Ok(self)
37+
}
2338

24-
impl<O, Retry> CustomizableOperation<O, Retry> {
25-
/// Allows for customizing the operation's request
26-
pub fn map_request<E>(
27-
mut self,
28-
f: impl FnOnce(http::Request<SdkBody>) -> Result<http::Request<SdkBody>, E>,
29-
) -> Result<Self, E> {
30-
let (request, response) = self.operation.into_request_response();
31-
let request = request.augment(|req, _props| f(req))?;
32-
self.operation = Operation::from_parts(request, response);
33-
Ok(self)
34-
}
39+
/// Convenience for `map_request` where infallible direct mutation of request is acceptable
40+
pub fn mutate_request(self, f: impl FnOnce(&mut http::Request<SdkBody>)) -> Self {
41+
self.map_request(|mut req| {
42+
f(&mut req);
43+
Result::<_, Infallible>::Ok(req)
44+
})
45+
.expect("infallible")
46+
}
3547

36-
/// Convenience for `map_request` where infallible direct mutation of request is acceptable
37-
pub fn mutate_request(self, f: impl FnOnce(&mut http::Request<SdkBody>)) -> Self {
38-
self.map_request(|mut req| {
39-
f(&mut req);
40-
Result::<_, Infallible>::Ok(req)
41-
})
42-
.expect("infallible")
43-
}
48+
/// Allows for customizing the entire operation
49+
pub fn map_operation<E>(
50+
mut self,
51+
f: impl FnOnce(Operation<O, Retry>) -> Result<Operation<O, Retry>, E>,
52+
) -> Result<Self, E> {
53+
self.operation = f(self.operation)?;
54+
Ok(self)
55+
}
4456

45-
/// Allows for customizing the entire operation
46-
pub fn map_operation<E>(
47-
mut self,
48-
f: impl FnOnce(Operation<O, Retry>) -> Result<Operation<O, Retry>, E>,
49-
) -> Result<Self, E> {
50-
self.operation = f(self.operation)?;
51-
Ok(self)
52-
}
57+
/// Direct access to read the HTTP request
58+
pub fn request(&self) -> &http::Request<SdkBody> {
59+
self.operation.request()
60+
}
5361

54-
/// Direct access to read the HTTP request
55-
pub fn request(&self) -> &http::Request<SdkBody> {
56-
self.operation.request()
57-
}
62+
/// Direct access to mutate the HTTP request
63+
pub fn request_mut(&mut self) -> &mut http::Request<SdkBody> {
64+
self.operation.request_mut()
65+
}
66+
}
5867

59-
/// Direct access to mutate the HTTP request
60-
pub fn request_mut(&mut self) -> &mut http::Request<SdkBody> {
61-
self.operation.request_mut()
62-
}
63-
}
68+
impl<O, Retry> CustomizableOperation<O, Retry>
69+
where
70+
71+
{
72+
/// Sends this operation's request
73+
pub async fn send<T, E>(self) -> Result<T, SdkError<E>>
74+
where
75+
E: std::error::Error + Send + Sync + 'static,
76+
O: aws_smithy_http::response::ParseHttpResponse<Output = Result<T, E>> + Send + Sync + Clone + 'static,
77+
Retry: aws_smithy_http::retry::ClassifyRetry<aws_smithy_http::result::SdkSuccess<T>, aws_smithy_http::result::SdkError<E>> + Send + Sync + Clone,
78+
{
79+
self.handle.client.call(self.operation).await
80+
}
81+
}
6482

65-
impl<O, Retry> CustomizableOperation<O, Retry> {
66-
/// Sends this operation's request
67-
pub async fn send<T, E>(self) -> Result<T, SdkError<E>>
68-
where
69-
E: std::error::Error + Send + Sync + 'static,
70-
O: aws_smithy_http::response::ParseHttpResponse<Output = Result<T, E>>
71-
+ Send
72-
+ Sync
73-
+ Clone
74-
+ 'static,
75-
Retry: aws_smithy_http::retry::ClassifyRetry<
76-
aws_smithy_http::result::SdkSuccess<T>,
77-
aws_smithy_http::result::SdkError<E>,
78-
> + Send
79-
+ Sync
80-
+ Clone,
81-
{
82-
self.handle.client.call(self.operation).await
83-
}
84-
}
Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2-
impl super::Client {
2+
impl super::Client {
33
/// Constructs a fluent builder for the [`DescribeServices`](crate::operation::describe_services::builders::DescribeServicesFluentBuilder) operation.
44
/// This operation supports pagination; See [`into_paginator()`](crate::operation::describe_services::builders::DescribeServicesFluentBuilder::into_paginator).
5-
///
6-
/// - The fluent builder is configurable:
5+
///
6+
/// - The fluent builder is configurable:
77
/// - [`service_code(impl Into<String>)`](crate::operation::describe_services::builders::DescribeServicesFluentBuilder::service_code) / [`set_service_code(Option<String>)`](crate::operation::describe_services::builders::DescribeServicesFluentBuilder::set_service_code): <p>The code for the service whose information you want to retrieve, such as <code>AmazonEC2</code>. You can use the <code>ServiceCode</code> to filter the results in a <code>GetProducts</code> call. To retrieve a list of all services, leave this blank.</p>
88
/// - [`format_version(impl Into<String>)`](crate::operation::describe_services::builders::DescribeServicesFluentBuilder::format_version) / [`set_format_version(Option<String>)`](crate::operation::describe_services::builders::DescribeServicesFluentBuilder::set_format_version): <p>The format version that you want the response to be in.</p> <p>Valid values are: <code>aws_v1</code> </p>
99
/// - [`next_token(impl Into<String>)`](crate::operation::describe_services::builders::DescribeServicesFluentBuilder::next_token) / [`set_next_token(Option<String>)`](crate::operation::describe_services::builders::DescribeServicesFluentBuilder::set_next_token): <p>The pagination token that indicates the next set of results that you want to retrieve.</p>
1010
/// - [`max_results(i32)`](crate::operation::describe_services::builders::DescribeServicesFluentBuilder::max_results) / [`set_max_results(Option<i32>)`](crate::operation::describe_services::builders::DescribeServicesFluentBuilder::set_max_results): <p>The maximum number of results that you want returned in the response.</p>
11-
/// - On success, responds with [`DescribeServicesOutput`](crate::operation::describe_services::DescribeServicesOutput) with field(s):
11+
/// - On success, responds with [`DescribeServicesOutput`](crate::operation::describe_services::DescribeServicesOutput) with field(s):
1212
/// - [`services(Option<Vec<Service>>)`](crate::operation::describe_services::DescribeServicesOutput::services): <p>The service metadata for the service or services in the response.</p>
1313
/// - [`format_version(Option<String>)`](crate::operation::describe_services::DescribeServicesOutput::format_version): <p>The format version of the response. For example, <code>aws_v1</code>.</p>
1414
/// - [`next_token(Option<String>)`](crate::operation::describe_services::DescribeServicesOutput::next_token): <p>The pagination token for the next set of retrievable results.</p>
15-
/// - On failure, responds with [`SdkError<DescribeServicesError>`](crate::operation::describe_services::DescribeServicesError)
16-
pub fn describe_services(
17-
&self,
18-
) -> crate::operation::describe_services::builders::DescribeServicesFluentBuilder {
19-
crate::operation::describe_services::builders::DescribeServicesFluentBuilder::new(
20-
self.handle.clone(),
21-
)
22-
}
15+
/// - On failure, responds with [`SdkError<DescribeServicesError>`](crate::operation::describe_services::DescribeServicesError)
16+
pub fn describe_services(&self) -> crate::operation::describe_services::builders::DescribeServicesFluentBuilder {
17+
crate::operation::describe_services::builders::DescribeServicesFluentBuilder::new(self.handle.clone())
18+
}
2319
}
20+
Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2-
impl super::Client {
2+
impl super::Client {
33
/// Constructs a fluent builder for the [`GetAttributeValues`](crate::operation::get_attribute_values::builders::GetAttributeValuesFluentBuilder) operation.
44
/// This operation supports pagination; See [`into_paginator()`](crate::operation::get_attribute_values::builders::GetAttributeValuesFluentBuilder::into_paginator).
5-
///
6-
/// - The fluent builder is configurable:
5+
///
6+
/// - The fluent builder is configurable:
77
/// - [`service_code(impl Into<String>)`](crate::operation::get_attribute_values::builders::GetAttributeValuesFluentBuilder::service_code) / [`set_service_code(Option<String>)`](crate::operation::get_attribute_values::builders::GetAttributeValuesFluentBuilder::set_service_code): <p>The service code for the service whose attributes you want to retrieve. For example, if you want the retrieve an EC2 attribute, use <code>AmazonEC2</code>.</p>
88
/// - [`attribute_name(impl Into<String>)`](crate::operation::get_attribute_values::builders::GetAttributeValuesFluentBuilder::attribute_name) / [`set_attribute_name(Option<String>)`](crate::operation::get_attribute_values::builders::GetAttributeValuesFluentBuilder::set_attribute_name): <p>The name of the attribute that you want to retrieve the values for, such as <code>volumeType</code>.</p>
99
/// - [`next_token(impl Into<String>)`](crate::operation::get_attribute_values::builders::GetAttributeValuesFluentBuilder::next_token) / [`set_next_token(Option<String>)`](crate::operation::get_attribute_values::builders::GetAttributeValuesFluentBuilder::set_next_token): <p>The pagination token that indicates the next set of results that you want to retrieve.</p>
1010
/// - [`max_results(i32)`](crate::operation::get_attribute_values::builders::GetAttributeValuesFluentBuilder::max_results) / [`set_max_results(Option<i32>)`](crate::operation::get_attribute_values::builders::GetAttributeValuesFluentBuilder::set_max_results): <p>The maximum number of results to return in response.</p>
11-
/// - On success, responds with [`GetAttributeValuesOutput`](crate::operation::get_attribute_values::GetAttributeValuesOutput) with field(s):
11+
/// - On success, responds with [`GetAttributeValuesOutput`](crate::operation::get_attribute_values::GetAttributeValuesOutput) with field(s):
1212
/// - [`attribute_values(Option<Vec<AttributeValue>>)`](crate::operation::get_attribute_values::GetAttributeValuesOutput::attribute_values): <p>The list of values for an attribute. For example, <code>Throughput Optimized HDD</code> and <code>Provisioned IOPS</code> are two available values for the <code>AmazonEC2</code> <code>volumeType</code>.</p>
1313
/// - [`next_token(Option<String>)`](crate::operation::get_attribute_values::GetAttributeValuesOutput::next_token): <p>The pagination token that indicates the next set of results to retrieve.</p>
14-
/// - On failure, responds with [`SdkError<GetAttributeValuesError>`](crate::operation::get_attribute_values::GetAttributeValuesError)
15-
pub fn get_attribute_values(
16-
&self,
17-
) -> crate::operation::get_attribute_values::builders::GetAttributeValuesFluentBuilder {
18-
crate::operation::get_attribute_values::builders::GetAttributeValuesFluentBuilder::new(
19-
self.handle.clone(),
20-
)
21-
}
14+
/// - On failure, responds with [`SdkError<GetAttributeValuesError>`](crate::operation::get_attribute_values::GetAttributeValuesError)
15+
pub fn get_attribute_values(&self) -> crate::operation::get_attribute_values::builders::GetAttributeValuesFluentBuilder {
16+
crate::operation::get_attribute_values::builders::GetAttributeValuesFluentBuilder::new(self.handle.clone())
17+
}
2218
}
19+
Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2-
impl super::Client {
2+
impl super::Client {
33
/// Constructs a fluent builder for the [`GetPriceListFileUrl`](crate::operation::get_price_list_file_url::builders::GetPriceListFileUrlFluentBuilder) operation.
4-
///
5-
/// - The fluent builder is configurable:
4+
///
5+
/// - The fluent builder is configurable:
66
/// - [`price_list_arn(impl Into<String>)`](crate::operation::get_price_list_file_url::builders::GetPriceListFileUrlFluentBuilder::price_list_arn) / [`set_price_list_arn(Option<String>)`](crate::operation::get_price_list_file_url::builders::GetPriceListFileUrlFluentBuilder::set_price_list_arn): <p>The unique identifier that maps to where your Price List files are located. <code>PriceListArn</code> can be obtained from the <a href="https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_pricing_ListPriceLists.html"> <code>ListPriceLists</code> </a> response. </p>
77
/// - [`file_format(impl Into<String>)`](crate::operation::get_price_list_file_url::builders::GetPriceListFileUrlFluentBuilder::file_format) / [`set_file_format(Option<String>)`](crate::operation::get_price_list_file_url::builders::GetPriceListFileUrlFluentBuilder::set_file_format): <p>The format that you want to retrieve your Price List files in. The <code>FileFormat</code> can be obtained from the <a href="https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_pricing_ListPriceLists.html"> <code>ListPriceLists</code> </a> response. </p>
8-
/// - On success, responds with [`GetPriceListFileUrlOutput`](crate::operation::get_price_list_file_url::GetPriceListFileUrlOutput) with field(s):
8+
/// - On success, responds with [`GetPriceListFileUrlOutput`](crate::operation::get_price_list_file_url::GetPriceListFileUrlOutput) with field(s):
99
/// - [`url(Option<String>)`](crate::operation::get_price_list_file_url::GetPriceListFileUrlOutput::url): <p>The URL to download your Price List file from. </p>
10-
/// - On failure, responds with [`SdkError<GetPriceListFileUrlError>`](crate::operation::get_price_list_file_url::GetPriceListFileUrlError)
11-
pub fn get_price_list_file_url(
12-
&self,
13-
) -> crate::operation::get_price_list_file_url::builders::GetPriceListFileUrlFluentBuilder {
14-
crate::operation::get_price_list_file_url::builders::GetPriceListFileUrlFluentBuilder::new(
15-
self.handle.clone(),
16-
)
17-
}
10+
/// - On failure, responds with [`SdkError<GetPriceListFileUrlError>`](crate::operation::get_price_list_file_url::GetPriceListFileUrlError)
11+
pub fn get_price_list_file_url(&self) -> crate::operation::get_price_list_file_url::builders::GetPriceListFileUrlFluentBuilder {
12+
crate::operation::get_price_list_file_url::builders::GetPriceListFileUrlFluentBuilder::new(self.handle.clone())
13+
}
1814
}
15+

0 commit comments

Comments
 (0)