AWS SDK

AWS SDK

rev. d29c343cc7d4479a9e4fad7ae67899c7e23bd1f1 (ignoring whitespace)

Files changed:

tmp-codegen-diff/aws-sdk/sdk/s3/src/operation/upload_part_copy/builders.rs

@@ -143,143 +203,204 @@
  163    163   
    pub fn as_input(&self) -> &crate::operation::upload_part_copy::builders::UploadPartCopyInputBuilder {
  164    164   
        &self.inner
  165    165   
    }
  166    166   
    /// Sends the request and returns the response.
  167    167   
    ///
  168    168   
    /// If an error occurs, an `SdkError` will be returned with additional details that
  169    169   
    /// can be matched against.
  170    170   
    ///
  171    171   
    /// By default, any retryable failures will be retried twice. Retry behavior
  172    172   
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
  173         -
    /// set when configuring the client.
         173  +
    /// set when configuring the client. Note: retries are enabled by default when using
         174  +
    /// `aws_config::load_from_env()` or when using `BehaviorVersion::v2025_01_17()` or later.
  174    175   
    pub async fn send(
  175    176   
        self,
  176    177   
    ) -> ::std::result::Result<
  177    178   
        crate::operation::upload_part_copy::UploadPartCopyOutput,
  178    179   
        ::aws_smithy_runtime_api::client::result::SdkError<
  179    180   
            crate::operation::upload_part_copy::UploadPartCopyError,
  180    181   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
  181    182   
        >,
  182    183   
    > {
  183    184   
        let input = self

tmp-codegen-diff/aws-sdk/sdk/s3/src/operation/write_get_object_response/builders.rs

@@ -50,50 +110,111 @@
   70     70   
    pub fn as_input(&self) -> &crate::operation::write_get_object_response::builders::WriteGetObjectResponseInputBuilder {
   71     71   
        &self.inner
   72     72   
    }
   73     73   
    /// Sends the request and returns the response.
   74     74   
    ///
   75     75   
    /// If an error occurs, an `SdkError` will be returned with additional details that
   76     76   
    /// can be matched against.
   77     77   
    ///
   78     78   
    /// By default, any retryable failures will be retried twice. Retry behavior
   79     79   
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
   80         -
    /// set when configuring the client.
          80  +
    /// set when configuring the client. Note: retries are enabled by default when using
          81  +
    /// `aws_config::load_from_env()` or when using `BehaviorVersion::v2025_01_17()` or later.
   81     82   
    pub async fn send(
   82     83   
        self,
   83     84   
    ) -> ::std::result::Result<
   84     85   
        crate::operation::write_get_object_response::WriteGetObjectResponseOutput,
   85     86   
        ::aws_smithy_runtime_api::client::result::SdkError<
   86     87   
            crate::operation::write_get_object_response::WriteGetObjectResponseError,
   87     88   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   88     89   
        >,
   89     90   
    > {
   90     91   
        let input = self

tmp-codegen-diff/aws-sdk/sdk/s3/tests/checksums.rs

@@ -72,72 +131,132 @@
   92     92   
    let http_client = new_checksum_validated_response_test_connection(
   93     93   
        checksum_header_name,
   94     94   
        checksum_header_value,
   95     95   
    );
   96     96   
    let config = Config::builder()
   97     97   
        .credentials_provider(SharedCredentialsProvider::new(Credentials::for_tests()))
   98     98   
        .time_source(UNIX_EPOCH + Duration::from_secs(1624036048))
   99     99   
        .region(Region::new("us-east-1"))
  100    100   
        .http_client(http_client.clone())
  101    101   
        .with_test_defaults()
         102  +
        .retry_config(RetryConfig::disabled())
  102    103   
        .build();
  103    104   
    let client = Client::from_conf(config);
  104    105   
  105    106   
    let res = client
  106    107   
        .get_object()
  107    108   
        .bucket("some-test-bucket")
  108    109   
        .key("test.txt")
  109    110   
        .checksum_mode(aws_sdk_s3::types::ChecksumMode::Enabled)
  110    111   
        .send()
  111    112   
        .await
@@ -161,162 +220,222 @@
  181    182   
    expected_decoded_content_length: &'a str,
  182    183   
    expected_encoded_content_length: &'a str,
  183    184   
    expected_aws_chunked_encoded_body: &'a str,
  184    185   
) {
  185    186   
    let (http_client, rcvr) = capture_request(None);
  186    187   
    let config = Config::builder()
  187    188   
        .credentials_provider(SharedCredentialsProvider::new(Credentials::for_tests()))
  188    189   
        .region(Region::new("us-east-1"))
  189    190   
        .http_client(http_client.clone())
  190    191   
        .with_test_defaults()
         192  +
        .retry_config(RetryConfig::disabled())
  191    193   
        .build();
  192    194   
    let client = Client::from_conf(config);
  193    195   
  194    196   
    // ByteStreams created from a file are streaming and have a known size
  195    197   
    let mut file = tempfile::NamedTempFile::new().unwrap();
  196    198   
    use std::io::Write;
  197    199   
    file.write_all(body).unwrap();
  198    200   
  199    201   
    let body = aws_sdk_s3::primitives::ByteStream::read_from()
  200    202   
        .path(file.path())

tmp-codegen-diff/aws-sdk/sdk/s3/tests/client_construction.rs

@@ -13,13 +50,55 @@
   33     33   
    #[test]
   34     34   
    fn bytestream_from_path_exists() {
   35     35   
        let _ = aws_sdk_s3::primitives::ByteStream::from_path("a/b.txt");
   36     36   
    }
   37     37   
}
   38     38   
   39     39   
mod with_service_config {
   40     40   
    use aws_sdk_s3 as s3;
   41     41   
   42     42   
    #[test]
          43  +
    #[allow(deprecated)]
   43     44   
    fn manual_config_construction_all_defaults() {
   44         -
        // When manually constructing `Config` with everything unset,
   45         -
        // it should work since there will be no timeouts or retries enabled,
          45  +
        // When manually constructing `Config` with everything unset and using an older
          46  +
        // behavior version, it should work since there will be no timeouts or retries enabled,
   46     47   
        // and thus, no sleep impl is required.
   47         -
        let config = s3::Config::builder().build();
          48  +
        let config = s3::Config::builder()
          49  +
            .behavior_version(
          50  +
                aws_smithy_runtime_api::client::behavior_version::BehaviorVersion::v2024_03_28(),
          51  +
            )
          52  +
            .build();
   48     53   
        let _s3 = s3::Client::from_conf(config);
   49     54   
    }
   50     55   
}

tmp-codegen-diff/aws-sdk/sdk/s3/tests/content-length-enforcement.rs

@@ -1,1 +106,109 @@
    1      1   
/*
    2      2   
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
    3      3   
 * SPDX-License-Identifier: Apache-2.0
    4      4   
 */
    5      5   
    6         -
use aws_sdk_s3::{config::Region, error::DisplayErrorContext, Client, Config};
           6  +
use aws_sdk_s3::{config::{retry::RetryConfig, Region}, error::DisplayErrorContext, Client, Config};
    7      7   
use aws_smithy_http_client::test_util::dvr::ReplayingClient;
    8      8   
    9      9   
#[tokio::test]
   10     10   
async fn test_content_length_enforcement_is_not_applied_to_head_request() {
   11     11   
    let http_client =
   12     12   
        ReplayingClient::from_file("tests/data/content-length-enforcement/head-object.json")
   13     13   
            .expect("recorded HTTP communication exists");
   14     14   
    let config = Config::builder()
   15     15   
        .with_test_defaults()
   16     16   
        .http_client(http_client.clone())
   17     17   
        .region(Region::new("us-east-1"))
          18  +
        .retry_config(RetryConfig::disabled())
   18     19   
        .build();
   19     20   
    let client = Client::from_conf(config);
   20     21   
    let _resp = client
   21     22   
        .head_object()
   22     23   
        .key("dontcare.json")
   23     24   
        .bucket("dontcare")
   24     25   
        .send()
   25     26   
        .await
   26     27   
        .expect("content length enforcement must not apply to HEAD requests");
   27     28   
   28     29   
    // The body returned will be empty, so we pass an empty string for `media_type` to
   29     30   
    // `validate_body_and_headers_except`. That way, it'll do a string equality check on the empty
   30     31   
    // strings.
   31     32   
    http_client.relaxed_validate("").await.unwrap();
   32     33   
}
   33     34   
   34     35   
#[tokio::test]
   35     36   
async fn test_content_length_enforcement_get_request_short() {
   36     37   
    let http_client =
   37     38   
        ReplayingClient::from_file("tests/data/content-length-enforcement/get-object-short.json")
   38     39   
            .expect("recorded HTTP communication exists");
   39     40   
    let config = Config::builder()
   40     41   
        .with_test_defaults()
   41     42   
        .http_client(http_client.clone())
   42     43   
        .region(Region::new("us-east-1"))
          44  +
        .retry_config(RetryConfig::disabled())
   43     45   
        .build();
   44     46   
    let client = Client::from_conf(config);
   45     47   
    // The file we're fetching is exactly 10,000 bytes long, but we've set the
   46     48   
    // response's content-length to 9,999 bytes. This should trigger the
   47     49   
    // content-length enforcement.
   48     50   
   49     51   
    // This will succeed.
   50     52   
    let output = client
   51     53   
        .get_object()
   52     54   
        .key("1000-lines.txt")
   53     55   
        .bucket("dontcare")
   54     56   
        .send()
   55     57   
        .await
   56     58   
        .unwrap();
   57     59   
   58     60   
    // This will fail with a content-length mismatch error.
   59     61   
    let content_length_err = output.body.collect().await.unwrap_err();
   60     62   
   61     63   
    http_client
   62     64   
        .relaxed_validate("application/text")
   63     65   
        .await
   64     66   
        .unwrap();
   65     67   
    assert_eq!(
   66     68   
        DisplayErrorContext(content_length_err).to_string(),
   67     69   
        "streaming error: Invalid Content-Length: Expected 9999 bytes but 10000 bytes were received (Error { kind: StreamingError(ContentLengthError { expected: 9999, received: 10000 }) })"
   68     70   
    );
   69     71   
}
   70     72   
   71     73   
#[tokio::test]
   72     74   
async fn test_content_length_enforcement_get_request_long() {
   73     75   
    let http_client =
   74     76   
        ReplayingClient::from_file("tests/data/content-length-enforcement/get-object-long.json")
   75     77   
            .expect("recorded HTTP communication exists");
   76     78   
    let config = Config::builder()
   77     79   
        .with_test_defaults()
   78     80   
        .http_client(http_client.clone())
   79     81   
        .region(Region::new("us-east-1"))
          82  +
        .retry_config(RetryConfig::disabled())
   80     83   
        .build();
   81     84   
    let client = Client::from_conf(config);
   82     85   
    // The file we're fetching is exactly 10,000 bytes long, but we've set the
   83     86   
    // response's content-length to 9,999 bytes. This should trigger the
   84     87   
    // content-length enforcement.
   85     88   
   86     89   
    // This will succeed.
   87     90   
    let output = client
   88     91   
        .get_object()
   89     92   
        .key("1000-lines.txt")

tmp-codegen-diff/aws-sdk/sdk/s3/tests/default_retries.rs

@@ -0,1 +0,121 @@
           1  +
/*
           2  +
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
           3  +
 * SPDX-License-Identifier: Apache-2.0
           4  +
 */
           5  +
           6  +
//! Integration tests proving that retries are enabled by default with BehaviorVersion::v2025_01_17
           7  +
//! and disabled by default with older behavior versions.
           8  +
           9  +
use aws_sdk_s3::config::{Credentials, Region, SharedAsyncSleep};
          10  +
use aws_sdk_s3::Config;
          11  +
use aws_smithy_async::rt::sleep::TokioSleep;
          12  +
use aws_smithy_http_client::test_util::infallible_client_fn;
          13  +
use aws_smithy_runtime_api::client::behavior_version::BehaviorVersion;
          14  +
use aws_smithy_types::body::SdkBody;
          15  +
use std::sync::atomic::{AtomicU32, Ordering};
          16  +
use std::sync::Arc;
          17  +
          18  +
/// Test that retries are enabled by default with BehaviorVersion::v2025_01_17.
          19  +
#[tokio::test]
          20  +
#[allow(deprecated)]
          21  +
async fn retries_enabled_by_default_with_v2025_01_17() {
          22  +
    let call_count = Arc::new(AtomicU32::new(0));
          23  +
    let call_count_clone = call_count.clone();
          24  +
          25  +
    let http_client = infallible_client_fn(move |_req| {
          26  +
        let count = call_count_clone.fetch_add(1, Ordering::SeqCst);
          27  +
        if count < 2 {
          28  +
            // Return 500 for first 2 attempts
          29  +
            http_1x::Response::builder()
          30  +
                .status(500)
          31  +
                .body(SdkBody::from("Internal Server Error"))
          32  +
                .unwrap()
          33  +
        } else {
          34  +
            // Return success on 3rd attempt
          35  +
            http_1x::Response::builder()
          36  +
                .status(200)
          37  +
                .body(SdkBody::from(
          38  +
                    r#"<?xml version="1.0" encoding="UTF-8"?>
          39  +
<ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
          40  +
    <Buckets></Buckets>
          41  +
    <Owner>
          42  +
        <ID>test-owner</ID>
          43  +
        <DisplayName>test</DisplayName>
          44  +
    </Owner>
          45  +
</ListAllMyBucketsResult>"#,
          46  +
                ))
          47  +
                .unwrap()
          48  +
        }
          49  +
    });
          50  +
          51  +
    let config = Config::builder()
          52  +
        .behavior_version(BehaviorVersion::v2025_01_17())
          53  +
        .region(Region::new("us-east-1"))
          54  +
        .credentials_provider(Credentials::for_tests())
          55  +
        .sleep_impl(SharedAsyncSleep::new(TokioSleep::new()))
          56  +
        .http_client(http_client)
          57  +
        .build();
          58  +
          59  +
    let client = aws_sdk_s3::Client::from_conf(config);
          60  +
          61  +
    // This should succeed after 2 retries
          62  +
    let result = client.list_buckets().send().await;
          63  +
          64  +
    if let Err(e) = &result {
          65  +
        eprintln!("Error: {:?}", e);
          66  +
    }
          67  +
          68  +
    assert!(
          69  +
        result.is_ok(),
          70  +
        "Request should succeed after retries with BehaviorVersion::v2025_01_17"
          71  +
    );
          72  +
          73  +
    // Verify 3 requests were made (1 initial + 2 retries)
          74  +
    assert_eq!(
          75  +
        call_count.load(Ordering::SeqCst),
          76  +
        3,
          77  +
        "Should have made 3 requests (1 initial + 2 retries)"
          78  +
    );
          79  +
}
          80  +
          81  +
/// Test that retries are disabled by default with older behavior versions.
          82  +
#[tokio::test]
          83  +
#[allow(deprecated)]
          84  +
async fn retries_disabled_by_default_with_v2024_03_28() {
          85  +
    let call_count = Arc::new(AtomicU32::new(0));
          86  +
    let call_count_clone = call_count.clone();
          87  +
          88  +
    let http_client = infallible_client_fn(move |_req| {
          89  +
        call_count_clone.fetch_add(1, Ordering::SeqCst);
          90  +
        // Always return 500
          91  +
        http_1x::Response::builder()
          92  +
            .status(500)
          93  +
            .body(SdkBody::from("Internal Server Error"))
          94  +
            .unwrap()
          95  +
    });
          96  +
          97  +
    let config = Config::builder()
          98  +
        .behavior_version(BehaviorVersion::v2024_03_28())
          99  +
        .region(Region::new("us-east-1"))
         100  +
        .credentials_provider(Credentials::for_tests())
         101  +
        .sleep_impl(SharedAsyncSleep::new(TokioSleep::new()))
         102  +
        .http_client(http_client)
         103  +
        .build();
         104  +
         105  +
    let client = aws_sdk_s3::Client::from_conf(config);
         106  +
         107  +
    // This should fail immediately without retries
         108  +
    let result = client.list_buckets().send().await;
         109  +
         110  +
    assert!(
         111  +
        result.is_err(),
         112  +
        "Request should fail immediately without retries with BehaviorVersion::v2024_03_28"
         113  +
    );
         114  +
         115  +
    // Verify only 1 request was made (no retries)
         116  +
    assert_eq!(
         117  +
        call_count.load(Ordering::SeqCst),
         118  +
        1,
         119  +
        "Should have made only 1 request (no retries)"
         120  +
    );
         121  +
}

tmp-codegen-diff/aws-sdk/sdk/s3/tests/expires_interceptor.rs

@@ -1,1 +60,61 @@
   21     21   
            .header("Expires", expires_val)
   22     22   
            .status(200)
   23     23   
            .body(SdkBody::empty())
   24     24   
            .unwrap(),
   25     25   
    )]);
   26     26   
   27     27   
    let config = Config::builder()
   28     28   
        .region(Region::new("us-east-1"))
   29     29   
        .http_client(http_client)
   30     30   
        .with_test_defaults()
          31  +
        .retry_config(RetryConfig::disabled())
   31     32   
        .build();
   32     33   
   33     34   
    Client::from_conf(config)
   34     35   
}
   35     36   
   36     37   
#[allow(deprecated)]
   37     38   
#[tokio::test]
   38     39   
async fn expires_customization_works_with_non_date_value() {
   39     40   
    let client = make_client("foo");
   40     41   

tmp-codegen-diff/aws-sdk/sdk/s3/tests/express.rs

@@ -1,1 +43,43 @@
    3      3   
 * SPDX-License-Identifier: Apache-2.0
    4      4   
 */
    5      5   
    6      6   
use std::time::{Duration, SystemTime};
    7      7   
    8      8   
use aws_config::timeout::TimeoutConfig;
    9      9   
use aws_config::Region;
   10     10   
use aws_runtime::user_agent::test_util::{
   11     11   
    assert_ua_contains_metric_values, assert_ua_does_not_contain_metric_values,
   12     12   
};
   13         -
use aws_sdk_s3::config::endpoint::{EndpointFuture, Params, ResolveEndpoint};
          13  +
use aws_sdk_s3::config::{retry::RetryConfig, endpoint::{EndpointFuture, Params, ResolveEndpoint};
   14     14   
use aws_sdk_s3::config::{Builder, Credentials};
   15     15   
use aws_sdk_s3::presigning::PresigningConfig;
   16     16   
use aws_sdk_s3::primitives::SdkBody;
   17     17   
use aws_sdk_s3::types::ChecksumAlgorithm;
   18     18   
use aws_sdk_s3::{Client, Config};
   19     19   
use aws_smithy_http_client::test_util::dvr::ReplayingClient;
   20     20   
use aws_smithy_http_client::test_util::{capture_request, ReplayEvent, StaticReplayClient};
   21     21   
use aws_smithy_runtime::test_util::capture_test_logs::capture_test_logs;
   22     22   
use aws_smithy_types::endpoint::Endpoint;
   23     23   
use http_1x::Uri;
@@ -297,297 +384,386 @@
  317    317   
        .any(|req| req.headers().iter().any(|(key, _)| key == checksum))));
  318    318   
}
  319    319   
  320    320   
#[tokio::test]
  321    321   
async fn disable_s3_express_session_auth_at_service_client_level() {
  322    322   
    let (http_client, request) = capture_request(None);
  323    323   
    let conf = Config::builder()
  324    324   
        .http_client(http_client)
  325    325   
        .region(Region::new("us-west-2"))
  326    326   
        .with_test_defaults()
         327  +
        .retry_config(RetryConfig::disabled())
  327    328   
        .disable_s3_express_session_auth(true)
  328    329   
        .build();
  329    330   
    let client = Client::from_conf(conf);
  330    331   
  331    332   
    let _ = client
  332    333   
        .list_objects_v2()
  333    334   
        .bucket("s3express-test-bucket--usw2-az1--x-s3")
  334    335   
        .send()
  335    336   
        .await;
  336    337   
  337    338   
    let req = request.expect_request();
  338    339   
    assert!(
  339    340   
        req.headers().get("x-amz-create-session-mode").is_none(),
  340    341   
        "x-amz-create-session-mode should not appear in headers when S3 Express session auth is disabled"
  341    342   
    );
  342    343   
  343    344   
    // Verify that the User-Agent does NOT contain the S3ExpressBucket metric "J" when session auth is disabled
  344    345   
    let user_agent = req.headers().get("x-amz-user-agent").unwrap();
  345    346   
    assert_ua_does_not_contain_metric_values(user_agent, &["J"]);
  346    347   
}
  347    348   
  348    349   
#[tokio::test]
  349    350   
async fn disable_s3_express_session_auth_at_operation_level() {
  350    351   
    let (http_client, request) = capture_request(None);
  351    352   
    let conf = Config::builder()
  352    353   
        .http_client(http_client)
  353    354   
        .region(Region::new("us-west-2"))
  354    355   
        .with_test_defaults()
         356  +
        .retry_config(RetryConfig::disabled())
  355    357   
        .build();
  356    358   
    let client = Client::from_conf(conf);
  357    359   
  358    360   
    let _ = client
  359    361   
        .list_objects_v2()
  360    362   
        .bucket("s3express-test-bucket--usw2-az1--x-s3")
  361    363   
        .customize()
  362    364   
        .config_override(Config::builder().disable_s3_express_session_auth(true))
  363    365   
        .send()
  364    366   
        .await;
@@ -428,430 +487,490 @@
  448    450   
    }
  449    451   
  450    452   
    let (http_client, request) = capture_request(None);
  451    453   
    let conf = Config::builder()
  452    454   
        .http_client(http_client)
  453    455   
        .region(Region::new("us-west-2"))
  454    456   
        .endpoint_resolver(TestResolver {
  455    457   
            url: "http://127.0.0.1".to_owned(),
  456    458   
        })
  457    459   
        .with_test_defaults()
         460  +
        .retry_config(RetryConfig::disabled())
  458    461   
        .timeout_config(
  459    462   
            TimeoutConfig::builder()
  460    463   
                .operation_attempt_timeout(Duration::from_secs(1))
  461    464   
                .build(),
  462    465   
        )
  463    466   
        .build();
  464    467   
    let client = Client::from_conf(conf);
  465    468   
  466    469   
    // Note that we pass a regular bucket; when the bug was present, it still went through s3 Express auth flow.
  467    470   
    let _ = client.list_objects_v2().bucket("test-bucket").send().await;

tmp-codegen-diff/aws-sdk/sdk/s3/tests/ignore-invalid-xml-body-root.rs

@@ -20,20 +63,64 @@
   40     40   
             .unwrap())
   41     41   
    ]);
   42     42   
   43     43   
    let config = Config::builder()
   44     44   
        .credentials_provider(SharedCredentialsProvider::new(
   45     45   
            Credentials::for_tests_with_session_token(),
   46     46   
        ))
   47     47   
        .region(Region::new("us-east-1"))
   48     48   
        .http_client(http_client.clone())
   49     49   
        .with_test_defaults()
          50  +
        .retry_config(RetryConfig::disabled())
   50     51   
        .build();
   51     52   
    let client = Client::from_conf(config);
   52     53   
   53     54   
    let _ = client
   54     55   
        .get_object_attributes()
   55     56   
        .bucket("some-test-bucket")
   56     57   
        .key("test.txt")
   57     58   
        .object_attributes(ObjectAttributes::Checksum)
   58     59   
        .send()
   59     60   
        .await

tmp-codegen-diff/aws-sdk/sdk/s3/tests/no_auth.rs

@@ -1,1 +190,195 @@
    1      1   
/*
    2      2   
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
    3      3   
 * SPDX-License-Identifier: Apache-2.0
    4      4   
 */
    5      5   
    6         -
use aws_sdk_s3::config::Region;
           6  +
use aws_sdk_s3::config::{retry::RetryConfig, Region;
    7      7   
use aws_sdk_s3::{Client, Config};
    8      8   
use aws_smithy_http_client::test_util::capture_request;
    9      9   
use aws_smithy_http_client::test_util::dvr::ReplayingClient;
   10     10   
use aws_smithy_runtime::client::auth::no_auth::NO_AUTH_SCHEME_ID;
   11     11   
use aws_smithy_runtime::test_util::capture_test_logs::capture_test_logs;
   12     12   
use aws_smithy_runtime_api::client::auth::AuthSchemeId;
   13     13   
   14     14   
#[tokio::test]
   15     15   
async fn list_objects() {
   16     16   
    let _logs = capture_test_logs();
   17     17   
   18     18   
    let http_client = ReplayingClient::from_file("tests/data/no_auth/list-objects.json").unwrap();
   19     19   
    let config = aws_config::from_env()
   20     20   
        .http_client(http_client.clone())
   21     21   
        .no_credentials()
   22     22   
        .region("us-east-1")
   23     23   
        .load()
   24     24   
        .await;
   25     25   
    let config = Config::from(&config)
   26     26   
        .to_builder()
   27     27   
        .with_test_defaults()
          28  +
        .retry_config(RetryConfig::disabled())
   28     29   
        .build();
   29     30   
    let client = aws_sdk_s3::Client::from_conf(config);
   30     31   
   31     32   
    let result = client
   32     33   
        .list_objects()
   33     34   
        .bucket("gdc-organoid-pancreatic-phs001611-2-open")
   34     35   
        .max_keys(3)
   35     36   
        .send()
   36     37   
        .await;
   37     38   
    dbg!(result).expect("success");
   38     39   
   39     40   
    http_client
   40     41   
        .relaxed_validate("application/xml")
   41     42   
        .await
   42     43   
        .unwrap();
   43     44   
}
   44     45   
   45     46   
#[tokio::test]
   46     47   
async fn list_objects_v2() {
   47     48   
    let _logs = capture_test_logs();
   48     49   
   49     50   
    let http_client =
   50     51   
        ReplayingClient::from_file("tests/data/no_auth/list-objects-v2.json").unwrap();
   51     52   
    let config = aws_config::from_env()
   52     53   
        .http_client(http_client.clone())
   53     54   
        .no_credentials()
   54     55   
        .region("us-east-1")
   55     56   
        .load()
   56     57   
        .await;
   57     58   
    let config = Config::from(&config)
   58     59   
        .to_builder()
   59     60   
        .with_test_defaults()
          61  +
        .retry_config(RetryConfig::disabled())
   60     62   
        .build();
   61     63   
    let client = Client::from_conf(config);
   62     64   
   63     65   
    let result = client
   64     66   
        .list_objects_v2()
   65     67   
        .bucket("gdc-organoid-pancreatic-phs001611-2-open")
   66     68   
        .max_keys(3)
   67     69   
        .send()
   68     70   
        .await;
   69     71   
    dbg!(result).expect("success");
   70     72   
   71     73   
    http_client
   72     74   
        .relaxed_validate("application/xml")
   73     75   
        .await
   74     76   
        .unwrap();
   75     77   
}
   76     78   
   77     79   
#[tokio::test]
   78     80   
async fn head_object() {
   79     81   
    let _logs = capture_test_logs();
   80     82   
   81     83   
    let http_client = ReplayingClient::from_file("tests/data/no_auth/head-object.json").unwrap();
   82     84   
    let config = aws_config::from_env()
   83     85   
        .http_client(http_client.clone())
   84     86   
        .no_credentials()
   85     87   
        .region("us-east-1")
   86     88   
        .load()
   87     89   
        .await;
   88     90   
    let config = Config::from(&config)
   89     91   
        .to_builder()
   90     92   
        .with_test_defaults()
          93  +
        .retry_config(RetryConfig::disabled())
   91     94   
        .build();
   92     95   
    let client = Client::from_conf(config);
   93     96   
   94     97   
    let result = client
   95     98   
        .head_object()
   96     99   
        .bucket("gdc-organoid-pancreatic-phs001611-2-open")
   97    100   
        .key("0431cddc-a418-4a79-a34d-6c041394e8e4/a6ddcc84-8e4d-4c68-885c-2d51168eec97.FPKM-UQ.txt.gz")
   98    101   
        .send()
   99    102   
        .await;
  100    103   
    dbg!(result).expect("success");
  101    104   
  102    105   
    http_client
  103    106   
        .relaxed_validate("application/xml")
  104    107   
        .await
  105    108   
        .unwrap();
  106    109   
}
  107    110   
  108    111   
#[tokio::test]
  109    112   
async fn get_object() {
  110    113   
    let _logs = capture_test_logs();
  111    114   
  112    115   
    let http_client = ReplayingClient::from_file("tests/data/no_auth/get-object.json").unwrap();
  113    116   
    let config = aws_config::from_env()
  114    117   
        .http_client(http_client.clone())
  115    118   
        .no_credentials()
  116    119   
        .region("us-east-1")
  117    120   
        .load()
  118    121   
        .await;
  119    122   
    let config = Config::from(&config)
  120    123   
        .to_builder()
  121    124   
        .with_test_defaults()
         125  +
        .retry_config(RetryConfig::disabled())
  122    126   
        .build();
  123    127   
    let client = Client::from_conf(config);
  124    128   
  125    129   
    let result = client
  126    130   
        .get_object()
  127    131   
        .bucket("gdc-organoid-pancreatic-phs001611-2-open")
  128    132   
        .key("0431cddc-a418-4a79-a34d-6c041394e8e4/a6ddcc84-8e4d-4c68-885c-2d51168eec97.FPKM-UQ.txt.gz")
  129    133   
        .send()
  130    134   
        .await;
  131    135   
    dbg!(result).expect("success");
  132    136   
  133    137   
    http_client
  134    138   
        .relaxed_validate("application/xml")
  135    139   
        .await
  136    140   
        .unwrap();
  137    141   
}
  138    142   
  139    143   
#[tracing_test::traced_test]
  140    144   
#[tokio::test]
  141    145   
async fn no_auth_should_be_selected_when_no_credentials_is_configured() {
  142    146   
    let (http_client, _) = capture_request(None);
  143    147   
    let config = aws_config::from_env()
  144    148   
        .http_client(http_client)
  145    149   
        .region(Region::new("us-east-2"))
  146    150   
        .no_credentials()
  147    151   
        .load()
  148    152   
        .await;
  149    153   
  150    154   
    let client = Client::new(&config);
  151    155   
    let _ = dbg!(
  152    156   
        client
  153    157   
            .list_objects_v2()
  154    158   
            .bucket("doesnotmatter")
  155    159   
            .send()
  156    160   
            .await
  157    161   
    );
  158    162   
  159    163   
    assert!(logs_contain(&format!(
  160    164   
        "resolving identity scheme_id=AuthSchemeId {{ scheme_id: \"{auth_scheme_id_str}\" }}",
  161    165   
        auth_scheme_id_str = NO_AUTH_SCHEME_ID.inner(),
  162    166   
    )));
  163    167   
}
  164    168   
  165    169   
#[tracing_test::traced_test]
  166    170   
#[tokio::test]
  167    171   
async fn auth_scheme_preference_specifying_legacy_no_auth_scheme_id_should_be_supported() {
  168    172   
    let (http_client, _) = capture_request(None);
  169    173   
    let conf = Config::builder()
  170    174   
        .http_client(http_client)
  171    175   
        .region(Region::new("us-east-2"))
  172    176   
        .with_test_defaults()
         177  +
        .retry_config(RetryConfig::disabled())
  173    178   
        .auth_scheme_preference([AuthSchemeId::from("no_auth")])
  174    179   
        .build();
  175    180   
    let client = Client::from_conf(conf);
  176    181   
    let _ = client
  177    182   
        .get_object()
  178    183   
        .bucket("arn:aws:s3::123456789012:accesspoint/mfzwi23gnjvgw.mrap")
  179    184   
        .key("doesnotmatter")
  180    185   
        .send()
  181    186   
        .await;
  182    187   

tmp-codegen-diff/aws-sdk/sdk/s3/tests/signing-it.rs

@@ -1,1 +112,115 @@
    1      1   
/*
    2      2   
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
    3      3   
 * SPDX-License-Identifier: Apache-2.0
    4      4   
 */
    5      5   
    6      6   
#![cfg(feature = "test-util")]
    7      7   
    8      8   
use aws_credential_types::provider::SharedCredentialsProvider;
    9         -
use aws_sdk_s3::config::{Credentials, Region};
           9  +
use aws_sdk_s3::config::{retry::RetryConfig, {Credentials, Region};
   10     10   
use aws_sdk_s3::primitives::ByteStream;
   11     11   
use aws_sdk_s3::{Client, Config};
   12     12   
use aws_smithy_http_client::test_util::{capture_request, ReplayEvent, StaticReplayClient};
   13     13   
use aws_smithy_types::body::SdkBody;
   14     14   
use http_1x::header::AUTHORIZATION;
   15     15   
   16     16   
#[tokio::test]
   17     17   
async fn test_signer() {
   18     18   
    let http_client = StaticReplayClient::new(vec![ReplayEvent::new(
   19     19   
        http_1x::Request::builder()
   20     20   
            .header("authorization", "AWS4-HMAC-SHA256 Credential=ANOTREAL/20090213/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-user-agent, Signature=27e3f59ec3cffaa10e4f1c92112e8fb62d468a04cd32be39e68215f830404dbb")
   21     21   
            .uri("https://test-bucket.s3.us-east-1.amazonaws.com/?list-type=2&prefix=prefix~")
   22     22   
            .body(SdkBody::empty())
   23     23   
            .unwrap(),
   24     24   
        http_1x::Response::builder().status(200).body(SdkBody::empty()).unwrap(),
   25     25   
    )]);
   26     26   
    let config = Config::builder()
   27     27   
        .credentials_provider(SharedCredentialsProvider::new(
   28     28   
            Credentials::for_tests_with_session_token(),
   29     29   
        ))
   30     30   
        .region(Region::new("us-east-1"))
   31     31   
        .http_client(http_client.clone())
   32     32   
        .with_test_defaults()
          33  +
        .retry_config(RetryConfig::disabled())
   33     34   
        .build();
   34     35   
    let client = Client::from_conf(config);
   35     36   
    let _ = client
   36     37   
        .list_objects_v2()
   37     38   
        .bucket("test-bucket")
   38     39   
        .prefix("prefix~")
   39     40   
        .send()
   40     41   
        .await;
   41     42   
   42     43   
    http_client.assert_requests_match(&[AUTHORIZATION.as_str()]);
   43     44   
}
   44     45   
   45     46   
#[tokio::test]
   46     47   
async fn disable_payload_signing_works() {
   47     48   
    let (http_client, request) = capture_request(None);
   48     49   
    let conf = aws_sdk_s3::Config::builder()
   49     50   
        .with_test_defaults()
          51  +
        .retry_config(RetryConfig::disabled())
   50     52   
        .behavior_version_latest()
   51     53   
        .region(Region::new("us-east-1"))
   52     54   
        .http_client(http_client)
   53     55   
        .build();
   54     56   
    let client = aws_sdk_s3::Client::from_conf(conf);
   55     57   
    let _ = client
   56     58   
        .put_object()
   57     59   
        .bucket("XXXXXXXXXXX")
   58     60   
        .key("test-key")
   59     61   
        .body(ByteStream::from_static(b"Hello, world!"))
   60     62   
        .customize()
   61     63   
        .disable_payload_signing()
   62     64   
        .send()
   63     65   
        .await;
   64     66   
   65     67   
    let request = request.expect_request();
   66     68   
    let x_amz_content_sha256 = request
   67     69   
        .headers()
   68     70   
        .get("x-amz-content-sha256")
   69     71   
        .expect("x-amz-content-sha256 is set")
   70     72   
        .to_owned();
   71     73   
    assert_eq!("UNSIGNED-PAYLOAD", x_amz_content_sha256);
   72     74   
}
   73     75   
   74     76   
// This test ensures that the request checksum interceptor payload signing
   75     77   
// override takes priority over the runtime plugin's override. If it didn't,
   76     78   
// then disabling payload signing would cause requests to incorrectly omit
   77     79   
// trailers.
   78     80   
#[tokio::test]
   79     81   
async fn disable_payload_signing_works_with_checksums() {
   80     82   
    let (http_client, request) = capture_request(None);
   81     83   
    let conf = aws_sdk_s3::Config::builder()
   82     84   
        .with_test_defaults()
          85  +
        .retry_config(RetryConfig::disabled())
   83     86   
        .behavior_version_latest()
   84     87   
        .region(Region::new("us-east-1"))
   85     88   
        .http_client(http_client)
   86     89   
        .build();
   87     90   
    let client = aws_sdk_s3::Client::from_conf(conf);
   88     91   
   89     92   
    // ByteStreams created from a file are streaming and have a known size
   90     93   
    let mut file = tempfile::NamedTempFile::new().unwrap();
   91     94   
    use std::io::Write;
   92     95   
    file.write_all(b"Hello, world!").unwrap();

tmp-codegen-diff/aws-sdk/sdk/s3control/src/operation/associate_access_grants_identity_center/builders.rs

@@ -56,56 +116,117 @@
   76     76   
    pub fn as_input(&self) -> &crate::operation::associate_access_grants_identity_center::builders::AssociateAccessGrantsIdentityCenterInputBuilder {
   77     77   
        &self.inner
   78     78   
    }
   79     79   
    /// Sends the request and returns the response.
   80     80   
    ///
   81     81   
    /// If an error occurs, an `SdkError` will be returned with additional details that
   82     82   
    /// can be matched against.
   83     83   
    ///
   84     84   
    /// By default, any retryable failures will be retried twice. Retry behavior
   85     85   
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
   86         -
    /// set when configuring the client.
          86  +
    /// set when configuring the client. Note: retries are enabled by default when using
          87  +
    /// `aws_config::load_from_env()` or when using `BehaviorVersion::v2025_01_17()` or later.
   87     88   
    pub async fn send(
   88     89   
        self,
   89     90   
    ) -> ::std::result::Result<
   90     91   
        crate::operation::associate_access_grants_identity_center::AssociateAccessGrantsIdentityCenterOutput,
   91     92   
        ::aws_smithy_runtime_api::client::result::SdkError<
   92     93   
            crate::operation::associate_access_grants_identity_center::AssociateAccessGrantsIdentityCenterError,
   93     94   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   94     95   
        >,
   95     96   
    > {
   96     97   
        let input = self

tmp-codegen-diff/aws-sdk/sdk/s3control/src/operation/create_access_grant/builders.rs

@@ -58,58 +118,119 @@
   78     78   
    pub fn as_input(&self) -> &crate::operation::create_access_grant::builders::CreateAccessGrantInputBuilder {
   79     79   
        &self.inner
   80     80   
    }
   81     81   
    /// Sends the request and returns the response.
   82     82   
    ///
   83     83   
    /// If an error occurs, an `SdkError` will be returned with additional details that
   84     84   
    /// can be matched against.
   85     85   
    ///
   86     86   
    /// By default, any retryable failures will be retried twice. Retry behavior
   87     87   
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
   88         -
    /// set when configuring the client.
          88  +
    /// set when configuring the client. Note: retries are enabled by default when using
          89  +
    /// `aws_config::load_from_env()` or when using `BehaviorVersion::v2025_01_17()` or later.
   89     90   
    pub async fn send(
   90     91   
        self,
   91     92   
    ) -> ::std::result::Result<
   92     93   
        crate::operation::create_access_grant::CreateAccessGrantOutput,
   93     94   
        ::aws_smithy_runtime_api::client::result::SdkError<
   94     95   
            crate::operation::create_access_grant::CreateAccessGrantError,
   95     96   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   96     97   
        >,
   97     98   
    > {
   98     99   
        let input = self

tmp-codegen-diff/aws-sdk/sdk/s3control/src/operation/create_access_grants_instance/builders.rs

@@ -56,56 +116,117 @@
   76     76   
    pub fn as_input(&self) -> &crate::operation::create_access_grants_instance::builders::CreateAccessGrantsInstanceInputBuilder {
   77     77   
        &self.inner
   78     78   
    }
   79     79   
    /// Sends the request and returns the response.
   80     80   
    ///
   81     81   
    /// If an error occurs, an `SdkError` will be returned with additional details that
   82     82   
    /// can be matched against.
   83     83   
    ///
   84     84   
    /// By default, any retryable failures will be retried twice. Retry behavior
   85     85   
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
   86         -
    /// set when configuring the client.
          86  +
    /// set when configuring the client. Note: retries are enabled by default when using
          87  +
    /// `aws_config::load_from_env()` or when using `BehaviorVersion::v2025_01_17()` or later.
   87     88   
    pub async fn send(
   88     89   
        self,
   89     90   
    ) -> ::std::result::Result<
   90     91   
        crate::operation::create_access_grants_instance::CreateAccessGrantsInstanceOutput,
   91     92   
        ::aws_smithy_runtime_api::client::result::SdkError<
   92     93   
            crate::operation::create_access_grants_instance::CreateAccessGrantsInstanceError,
   93     94   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   94     95   
        >,
   95     96   
    > {
   96     97   
        let input = self

tmp-codegen-diff/aws-sdk/sdk/s3control/src/operation/create_access_grants_location/builders.rs

@@ -68,68 +128,129 @@
   88     88   
    pub fn as_input(&self) -> &crate::operation::create_access_grants_location::builders::CreateAccessGrantsLocationInputBuilder {
   89     89   
        &self.inner
   90     90   
    }
   91     91   
    /// Sends the request and returns the response.
   92     92   
    ///
   93     93   
    /// If an error occurs, an `SdkError` will be returned with additional details that
   94     94   
    /// can be matched against.
   95     95   
    ///
   96     96   
    /// By default, any retryable failures will be retried twice. Retry behavior
   97     97   
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
   98         -
    /// set when configuring the client.
          98  +
    /// set when configuring the client. Note: retries are enabled by default when using
          99  +
    /// `aws_config::load_from_env()` or when using `BehaviorVersion::v2025_01_17()` or later.
   99    100   
    pub async fn send(
  100    101   
        self,
  101    102   
    ) -> ::std::result::Result<
  102    103   
        crate::operation::create_access_grants_location::CreateAccessGrantsLocationOutput,
  103    104   
        ::aws_smithy_runtime_api::client::result::SdkError<
  104    105   
            crate::operation::create_access_grants_location::CreateAccessGrantsLocationError,
  105    106   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
  106    107   
        >,
  107    108   
    > {
  108    109   
        let input = self

tmp-codegen-diff/aws-sdk/sdk/s3control/src/operation/create_access_point/builders.rs

@@ -60,60 +120,121 @@
   80     80   
    pub fn as_input(&self) -> &crate::operation::create_access_point::builders::CreateAccessPointInputBuilder {
   81     81   
        &self.inner
   82     82   
    }
   83     83   
    /// Sends the request and returns the response.
   84     84   
    ///
   85     85   
    /// If an error occurs, an `SdkError` will be returned with additional details that
   86     86   
    /// can be matched against.
   87     87   
    ///
   88     88   
    /// By default, any retryable failures will be retried twice. Retry behavior
   89     89   
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
   90         -
    /// set when configuring the client.
          90  +
    /// set when configuring the client. Note: retries are enabled by default when using
          91  +
    /// `aws_config::load_from_env()` or when using `BehaviorVersion::v2025_01_17()` or later.
   91     92   
    pub async fn send(
   92     93   
        self,
   93     94   
    ) -> ::std::result::Result<
   94     95   
        crate::operation::create_access_point::CreateAccessPointOutput,
   95     96   
        ::aws_smithy_runtime_api::client::result::SdkError<
   96     97   
            crate::operation::create_access_point::CreateAccessPointError,
   97     98   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   98     99   
        >,
   99    100   
    > {
  100    101   
        let input = self