Client Test

Client Test

rev. b089fac03cba5061dd86d9628e74511b55f01c68

Files changed:

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/simple_scalar_properties.rs

@@ -229,229 +474,484 @@
  249    249   
    use ::aws_smithy_protocol_test::FloatEquals;
  250    250   
  251    251   
    /// Serializes simple scalar properties
  252    252   
    /// Test ID: RpcV2CborSimpleScalarProperties
  253    253   
    #[::tokio::test]
  254    254   
    #[::tracing_test::traced_test]
  255    255   
    async fn rpc_v2_cbor_simple_scalar_properties_request() {
  256    256   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  257    257   
        let config_builder = crate::config::Config::builder()
  258    258   
            .with_test_defaults()
  259         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         259  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         260  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         261  +
            .allow_no_auth()
  260    262   
            .endpoint_url("https://example.com");
  261    263   
  262    264   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  263    265   
        let result = client
  264    266   
            .simple_scalar_properties()
  265    267   
            .set_byte_value(::std::option::Option::Some(5))
  266    268   
            .set_double_value(::std::option::Option::Some(1.889_f64))
  267    269   
            .set_false_boolean_value(::std::option::Option::Some(false))
  268    270   
            .set_float_value(::std::option::Option::Some(7.625_f32))
  269    271   
            .set_integer_value(::std::option::Option::Some(256))
  270    272   
            .set_long_value(::std::option::Option::Some(9873))
  271    273   
            .set_short_value(::std::option::Option::Some(9898))
  272    274   
            .set_string_value(::std::option::Option::Some("simple".to_owned()))
  273    275   
            .set_true_boolean_value(::std::option::Option::Some(true))
  274    276   
            .set_blob_value(::std::option::Option::Some(::aws_smithy_types::Blob::new("foo")))
  275    277   
            .send()
  276    278   
            .await;
  277    279   
        let _ = dbg!(result);
  278    280   
        let http_request = request_receiver.expect_request();
  279    281   
        let expected_headers = [
  280    282   
            ("Accept", "application/cbor"),
  281    283   
            ("Content-Type", "application/cbor"),
  282    284   
            ("smithy-protocol", "rpc-v2-cbor"),
  283    285   
        ];
  284    286   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  285    287   
        let required_headers = &["Content-Length"];
  286    288   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  287    289   
        let body = http_request.body().bytes().expect("body should be strict");
  288    290   
        ::aws_smithy_protocol_test::assert_ok(
  289    291   
        ::aws_smithy_protocol_test::validate_body(body, "v2lieXRlVmFsdWUFa2RvdWJsZVZhbHVl+z/+OVgQYk3TcWZhbHNlQm9vbGVhblZhbHVl9GpmbG9hdFZhbHVl+kD0AABsaW50ZWdlclZhbHVlGQEAaWxvbmdWYWx1ZRkmkWpzaG9ydFZhbHVlGSaqa3N0cmluZ1ZhbHVlZnNpbXBsZXB0cnVlQm9vbGVhblZhbHVl9WlibG9iVmFsdWVDZm9v/w==", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
  290    292   
        );
  291    293   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  292    294   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  293    295   
        ::pretty_assertions::assert_eq!(
  294    296   
            uri.path(),
  295    297   
            "/service/RpcV2Protocol/operation/SimpleScalarProperties",
  296    298   
            "path was incorrect"
  297    299   
        );
  298    300   
    }
  299    301   
  300    302   
    /// RpcV2 Cbor should not serialize null structure values
  301    303   
    /// Test ID: RpcV2CborClientDoesntSerializeNullStructureValues
  302    304   
    #[::tokio::test]
  303    305   
    #[::tracing_test::traced_test]
  304    306   
    async fn rpc_v2_cbor_client_doesnt_serialize_null_structure_values_request() {
  305    307   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  306    308   
        let config_builder = crate::config::Config::builder()
  307    309   
            .with_test_defaults()
  308         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         310  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         311  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         312  +
            .allow_no_auth()
  309    313   
            .endpoint_url("https://example.com");
  310    314   
  311    315   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  312    316   
        let result = client
  313    317   
            .simple_scalar_properties()
  314    318   
            .set_string_value(::std::option::Option::None)
  315    319   
            .send()
  316    320   
            .await;
  317    321   
        let _ = dbg!(result);
  318    322   
        let http_request = request_receiver.expect_request();
  319    323   
        let expected_headers = [
  320    324   
            ("Accept", "application/cbor"),
  321    325   
            ("Content-Type", "application/cbor"),
  322    326   
            ("smithy-protocol", "rpc-v2-cbor"),
  323    327   
        ];
  324    328   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  325    329   
        let required_headers = &["Content-Length"];
  326    330   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  327    331   
        let body = http_request.body().bytes().expect("body should be strict");
  328    332   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  329    333   
            body,
  330    334   
            "v/8=",
  331    335   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  332    336   
        ));
  333    337   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  334    338   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  335    339   
        ::pretty_assertions::assert_eq!(
  336    340   
            uri.path(),
  337    341   
            "/service/RpcV2Protocol/operation/SimpleScalarProperties",
  338    342   
            "path was incorrect"
  339    343   
        );
  340    344   
    }
  341    345   
  342    346   
    /// Supports handling NaN float values.
  343    347   
    /// Test ID: RpcV2CborSupportsNaNFloatInputs
  344    348   
    #[::tokio::test]
  345    349   
    #[::tracing_test::traced_test]
  346    350   
    async fn rpc_v2_cbor_supports_na_n_float_inputs_request() {
  347    351   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  348    352   
        let config_builder = crate::config::Config::builder()
  349    353   
            .with_test_defaults()
  350         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         354  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         355  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         356  +
            .allow_no_auth()
  351    357   
            .endpoint_url("https://example.com");
  352    358   
  353    359   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  354    360   
        let result = client
  355    361   
            .simple_scalar_properties()
  356    362   
            .set_double_value(::std::option::Option::Some(
  357    363   
                <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number"),
  358    364   
            ))
  359    365   
            .set_float_value(::std::option::Option::Some(
  360    366   
                <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number"),
  361    367   
            ))
  362    368   
            .send()
  363    369   
            .await;
  364    370   
        let _ = dbg!(result);
  365    371   
        let http_request = request_receiver.expect_request();
  366    372   
        let expected_headers = [
  367    373   
            ("Accept", "application/cbor"),
  368    374   
            ("Content-Type", "application/cbor"),
  369    375   
            ("smithy-protocol", "rpc-v2-cbor"),
  370    376   
        ];
  371    377   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  372    378   
        let required_headers = &["Content-Length"];
  373    379   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  374    380   
        let body = http_request.body().bytes().expect("body should be strict");
  375    381   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  376    382   
            body,
  377    383   
            "v2tkb3VibGVWYWx1Zft/+AAAAAAAAGpmbG9hdFZhbHVl+n/AAAD/",
  378    384   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  379    385   
        ));
  380    386   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  381    387   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  382    388   
        ::pretty_assertions::assert_eq!(
  383    389   
            uri.path(),
  384    390   
            "/service/RpcV2Protocol/operation/SimpleScalarProperties",
  385    391   
            "path was incorrect"
  386    392   
        );
  387    393   
    }
  388    394   
  389    395   
    /// Supports handling Infinity float values.
  390    396   
    /// Test ID: RpcV2CborSupportsInfinityFloatInputs
  391    397   
    #[::tokio::test]
  392    398   
    #[::tracing_test::traced_test]
  393    399   
    async fn rpc_v2_cbor_supports_infinity_float_inputs_request() {
  394    400   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  395    401   
        let config_builder = crate::config::Config::builder()
  396    402   
            .with_test_defaults()
  397         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         403  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         404  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         405  +
            .allow_no_auth()
  398    406   
            .endpoint_url("https://example.com");
  399    407   
  400    408   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  401    409   
        let result = client
  402    410   
            .simple_scalar_properties()
  403    411   
            .set_double_value(::std::option::Option::Some(
  404    412   
                <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number"),
  405    413   
            ))
  406    414   
            .set_float_value(::std::option::Option::Some(
  407    415   
                <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number"),
  408    416   
            ))
  409    417   
            .send()
  410    418   
            .await;
  411    419   
        let _ = dbg!(result);
  412    420   
        let http_request = request_receiver.expect_request();
  413    421   
        let expected_headers = [
  414    422   
            ("Accept", "application/cbor"),
  415    423   
            ("Content-Type", "application/cbor"),
  416    424   
            ("smithy-protocol", "rpc-v2-cbor"),
  417    425   
        ];
  418    426   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  419    427   
        let required_headers = &["Content-Length"];
  420    428   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  421    429   
        let body = http_request.body().bytes().expect("body should be strict");
  422    430   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  423    431   
            body,
  424    432   
            "v2tkb3VibGVWYWx1Zft/8AAAAAAAAGpmbG9hdFZhbHVl+n+AAAD/",
  425    433   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  426    434   
        ));
  427    435   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  428    436   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  429    437   
        ::pretty_assertions::assert_eq!(
  430    438   
            uri.path(),
  431    439   
            "/service/RpcV2Protocol/operation/SimpleScalarProperties",
  432    440   
            "path was incorrect"
  433    441   
        );
  434    442   
    }
  435    443   
  436    444   
    /// Supports handling Infinity float values.
  437    445   
    /// Test ID: RpcV2CborSupportsNegativeInfinityFloatInputs
  438    446   
    #[::tokio::test]
  439    447   
    #[::tracing_test::traced_test]
  440    448   
    async fn rpc_v2_cbor_supports_negative_infinity_float_inputs_request() {
  441    449   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  442    450   
        let config_builder = crate::config::Config::builder()
  443    451   
            .with_test_defaults()
  444         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         452  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         453  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         454  +
            .allow_no_auth()
  445    455   
            .endpoint_url("https://example.com");
  446    456   
  447    457   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  448    458   
        let result = client
  449    459   
            .simple_scalar_properties()
  450    460   
            .set_double_value(::std::option::Option::Some(
  451    461   
                <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number"),
  452    462   
            ))
  453    463   
            .set_float_value(::std::option::Option::Some(
  454    464   
                <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number"),

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/sparse_nulls_operation.rs

@@ -228,228 +330,334 @@
  248    248   
mod sparse_nulls_operation_test {
  249    249   
  250    250   
    /// Serializes null values in maps
  251    251   
    /// Test ID: RpcV2CborSparseMapsSerializeNullValues
  252    252   
    #[::tokio::test]
  253    253   
    #[::tracing_test::traced_test]
  254    254   
    async fn rpc_v2_cbor_sparse_maps_serialize_null_values_request() {
  255    255   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  256    256   
        let config_builder = crate::config::Config::builder()
  257    257   
            .with_test_defaults()
  258         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         258  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         259  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         260  +
            .allow_no_auth()
  259    261   
            .endpoint_url("https://example.com");
  260    262   
  261    263   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  262    264   
        let result = client
  263    265   
            .sparse_nulls_operation()
  264    266   
            .set_sparse_string_map(::std::option::Option::Some({
  265    267   
                let mut ret = ::std::collections::HashMap::new();
  266    268   
                ret.insert("foo".to_owned(), ::std::option::Option::None);
  267    269   
                ret
  268    270   
            }))
  269    271   
            .send()
  270    272   
            .await;
  271    273   
        let _ = dbg!(result);
  272    274   
        let http_request = request_receiver.expect_request();
  273    275   
        let expected_headers = [
  274    276   
            ("Accept", "application/cbor"),
  275    277   
            ("Content-Type", "application/cbor"),
  276    278   
            ("smithy-protocol", "rpc-v2-cbor"),
  277    279   
        ];
  278    280   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  279    281   
        let required_headers = &["Content-Length"];
  280    282   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  281    283   
        let body = http_request.body().bytes().expect("body should be strict");
  282    284   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  283    285   
            body,
  284    286   
            "v29zcGFyc2VTdHJpbmdNYXC/Y2Zvb/b//w==",
  285    287   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  286    288   
        ));
  287    289   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  288    290   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  289    291   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/SparseNullsOperation", "path was incorrect");
  290    292   
    }
  291    293   
  292    294   
    /// Serializes null values in lists
  293    295   
    /// Test ID: RpcV2CborSparseListsSerializeNull
  294    296   
    #[::tokio::test]
  295    297   
    #[::tracing_test::traced_test]
  296    298   
    async fn rpc_v2_cbor_sparse_lists_serialize_null_request() {
  297    299   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  298    300   
        let config_builder = crate::config::Config::builder()
  299    301   
            .with_test_defaults()
  300         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         302  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         303  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         304  +
            .allow_no_auth()
  301    305   
            .endpoint_url("https://example.com");
  302    306   
  303    307   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  304    308   
        let result = client
  305    309   
            .sparse_nulls_operation()
  306    310   
            .set_sparse_string_list(::std::option::Option::Some(vec![::std::option::Option::None]))
  307    311   
            .send()
  308    312   
            .await;
  309    313   
        let _ = dbg!(result);
  310    314   
        let http_request = request_receiver.expect_request();

tmp-codegen-diff/codegen-client-test/rpcv2Cbor_extras/rust-client-codegen/src/config.rs

@@ -350,350 +409,427 @@
  370    370   
  371    371   
    /// Set the auth scheme resolver for the builder
  372    372   
    ///
  373    373   
    /// # Examples
  374    374   
    /// See an example for [`Self::auth_scheme_resolver`].
  375    375   
    pub fn set_auth_scheme_resolver(&mut self, auth_scheme_resolver: impl crate::config::auth::ResolveAuthScheme + 'static) -> &mut Self {
  376    376   
        self.runtime_components
  377    377   
            .set_auth_scheme_option_resolver(::std::option::Option::Some(auth_scheme_resolver.into_shared_resolver()));
  378    378   
        self
  379    379   
    }
         380  +
         381  +
    /// Enable no authentication regardless of what authentication mechanisms operations support
         382  +
    ///
         383  +
    /// This adds [NoAuthScheme](aws_smithy_runtime::client::auth::no_auth::NoAuthScheme) as a fallback
         384  +
    /// and the auth scheme resolver will use it when no other auth schemes are applicable.
         385  +
    pub fn allow_no_auth(mut self) -> Self {
         386  +
        self.set_allow_no_auth();
         387  +
        self
         388  +
    }
         389  +
         390  +
    /// Enable no authentication regardless of what authentication mechanisms operations support
         391  +
    ///
         392  +
    /// This adds [NoAuthScheme](aws_smithy_runtime::client::auth::no_auth::NoAuthScheme) as a fallback
         393  +
    /// and the auth scheme resolver will use it when no other auth schemes are applicable.
         394  +
    pub fn set_allow_no_auth(&mut self) -> &mut Self {
         395  +
        self.push_runtime_plugin(::aws_smithy_runtime::client::auth::no_auth::NoAuthRuntimePluginV2::new().into_shared());
         396  +
        self
         397  +
    }
  380    398   
    /// Set the auth scheme preference for an auth scheme resolver
  381    399   
    /// (typically the default auth scheme resolver).
  382    400   
    ///
  383    401   
    /// Each operation has a predefined order of auth schemes, as determined by the service,
  384    402   
    /// for auth scheme resolution. By using the auth scheme preference, customers
  385    403   
    /// can reorder the schemes resolved by the auth scheme resolver.
  386    404   
    ///
  387    405   
    /// The preference list is intended as a hint rather than a strict override.
  388    406   
    /// Any schemes not present in the originally resolved auth schemes will be ignored.
  389    407   
    ///
@@ -1199,1217 +1259,1278 @@
 1219   1237   
    {
 1220   1238   
        if config.behavior_version.is_none() {
 1221   1239   
            config.behavior_version = Some(::aws_smithy_runtime_api::client::behavior_version::BehaviorVersion::latest());
 1222   1240   
        }
 1223   1241   
    }
 1224   1242   
 1225   1243   
    let default_retry_partition = "rpcv2cborservice";
 1226   1244   
 1227   1245   
    let scope = "rpcv2cbor_extras";
 1228   1246   
 1229         -
    let mut plugins = ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins::new()
        1247  +
    #[allow(deprecated)]
        1248  +
                    let mut plugins = ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins::new()
 1230   1249   
                        // defaults
 1231   1250   
                        .with_client_plugins(::aws_smithy_runtime::client::defaults::default_plugins(
 1232   1251   
                            ::aws_smithy_runtime::client::defaults::DefaultPluginParams::new()
 1233   1252   
                                .with_retry_partition_name(default_retry_partition)
 1234   1253   
                                .with_behavior_version(config.behavior_version.expect("Invalid client configuration: A behavior major version must be set when sending a request or constructing a client. You must set it during client construction or by enabling the `behavior-version-latest` cargo feature."))
 1235   1254   
                        ))
 1236   1255   
                        // user config
 1237   1256   
                        .with_client_plugin(
 1238   1257   
                            ::aws_smithy_runtime_api::client::runtime_plugin::StaticRuntimePlugin::new()
 1239   1258   
                                .with_config(config.config.clone())

tmp-codegen-diff/codegen-client-test/rpcv2cbor_non_query_compatible/rust-client-codegen/src/config.rs

@@ -350,350 +409,427 @@
  370    370   
  371    371   
    /// Set the auth scheme resolver for the builder
  372    372   
    ///
  373    373   
    /// # Examples
  374    374   
    /// See an example for [`Self::auth_scheme_resolver`].
  375    375   
    pub fn set_auth_scheme_resolver(&mut self, auth_scheme_resolver: impl crate::config::auth::ResolveAuthScheme + 'static) -> &mut Self {
  376    376   
        self.runtime_components
  377    377   
            .set_auth_scheme_option_resolver(::std::option::Option::Some(auth_scheme_resolver.into_shared_resolver()));
  378    378   
        self
  379    379   
    }
         380  +
         381  +
    /// Enable no authentication regardless of what authentication mechanisms operations support
         382  +
    ///
         383  +
    /// This adds [NoAuthScheme](aws_smithy_runtime::client::auth::no_auth::NoAuthScheme) as a fallback
         384  +
    /// and the auth scheme resolver will use it when no other auth schemes are applicable.
         385  +
    pub fn allow_no_auth(mut self) -> Self {
         386  +
        self.set_allow_no_auth();
         387  +
        self
         388  +
    }
         389  +
         390  +
    /// Enable no authentication regardless of what authentication mechanisms operations support
         391  +
    ///
         392  +
    /// This adds [NoAuthScheme](aws_smithy_runtime::client::auth::no_auth::NoAuthScheme) as a fallback
         393  +
    /// and the auth scheme resolver will use it when no other auth schemes are applicable.
         394  +
    pub fn set_allow_no_auth(&mut self) -> &mut Self {
         395  +
        self.push_runtime_plugin(::aws_smithy_runtime::client::auth::no_auth::NoAuthRuntimePluginV2::new().into_shared());
         396  +
        self
         397  +
    }
  380    398   
    /// Set the auth scheme preference for an auth scheme resolver
  381    399   
    /// (typically the default auth scheme resolver).
  382    400   
    ///
  383    401   
    /// Each operation has a predefined order of auth schemes, as determined by the service,
  384    402   
    /// for auth scheme resolution. By using the auth scheme preference, customers
  385    403   
    /// can reorder the schemes resolved by the auth scheme resolver.
  386    404   
    ///
  387    405   
    /// The preference list is intended as a hint rather than a strict override.
  388    406   
    /// Any schemes not present in the originally resolved auth schemes will be ignored.
  389    407   
    ///
@@ -1199,1217 +1259,1278 @@
 1219   1237   
    {
 1220   1238   
        if config.behavior_version.is_none() {
 1221   1239   
            config.behavior_version = Some(::aws_smithy_runtime_api::client::behavior_version::BehaviorVersion::latest());
 1222   1240   
        }
 1223   1241   
    }
 1224   1242   
 1225   1243   
    let default_retry_partition = "nonquerycompatiblerpcv2protocol";
 1226   1244   
 1227   1245   
    let scope = "rpcv2cbor_non_query_compatible";
 1228   1246   
 1229         -
    let mut plugins = ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins::new()
        1247  +
    #[allow(deprecated)]
        1248  +
                    let mut plugins = ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins::new()
 1230   1249   
                        // defaults
 1231   1250   
                        .with_client_plugins(::aws_smithy_runtime::client::defaults::default_plugins(
 1232   1251   
                            ::aws_smithy_runtime::client::defaults::DefaultPluginParams::new()
 1233   1252   
                                .with_retry_partition_name(default_retry_partition)
 1234   1253   
                                .with_behavior_version(config.behavior_version.expect("Invalid client configuration: A behavior major version must be set when sending a request or constructing a client. You must set it during client construction or by enabling the `behavior-version-latest` cargo feature."))
 1235   1254   
                        ))
 1236   1255   
                        // user config
 1237   1256   
                        .with_client_plugin(
 1238   1257   
                            ::aws_smithy_runtime_api::client::runtime_plugin::StaticRuntimePlugin::new()
 1239   1258   
                                .with_config(config.config.clone())

tmp-codegen-diff/codegen-client-test/rpcv2cbor_non_query_compatible/rust-client-codegen/src/config/auth.rs

@@ -71,71 +148,130 @@
   91     91   
    pub fn builder() -> crate::config::auth::ParamsBuilder {
   92     92   
        crate::config::auth::ParamsBuilder::default()
   93     93   
    }
   94     94   
   95     95   
    /// Return the operation name for [`Params`]
   96     96   
    pub fn operation_name(&self) -> &str {
   97     97   
        self.operation_name.as_ref()
   98     98   
    }
   99     99   
}
  100    100   
  101         -
#[cfg(test)]
  102         -
#[derive(Debug)]
  103         -
pub(crate) struct NoAuthSchemeResolver;
  104         -
  105         -
#[cfg(test)]
  106         -
impl ResolveAuthScheme for NoAuthSchemeResolver {
  107         -
    fn resolve_auth_scheme<'a>(
  108         -
        &'a self,
  109         -
        _params: &'a crate::config::auth::Params,
  110         -
        _cfg: &'a ::aws_smithy_types::config_bag::ConfigBag,
  111         -
        _runtime_components: &'a ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponents,
  112         -
    ) -> ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture<'a> {
  113         -
        ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture::ready(::std::result::Result::Ok(vec![
  114         -
            ::aws_smithy_runtime_api::client::auth::AuthSchemeOption::from(::aws_smithy_runtime::client::auth::no_auth::NO_AUTH_SCHEME_ID),
  115         -
        ]))
  116         -
    }
  117         -
}
  118         -
  119    101   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  120    102   
/// Builder for [`Params`]
  121    103   
pub struct ParamsBuilder {
  122    104   
    operation_name: ::std::option::Option<::std::borrow::Cow<'static, str>>,
  123    105   
}
  124    106   
impl ParamsBuilder {
  125    107   
    /// Set the operation name for the builder
  126    108   
    pub fn operation_name(self, operation_name: impl Into<::std::borrow::Cow<'static, str>>) -> Self {
  127    109   
        self.set_operation_name(::std::option::Option::Some(operation_name.into()))
  128    110   
    }

tmp-codegen-diff/codegen-client-test/rpcv2cbor_non_query_compatible/rust-client-codegen/src/operation/non_query_compatible_operation.rs

@@ -226,226 +286,288 @@
  246    246   
mod non_query_compatible_operation_test {
  247    247   
  248    248   
    /// The query mode header MUST NOT be set on non-query-compatible services.
  249    249   
    /// Test ID: NonQueryCompatibleRpcV2CborForbidsQueryModeHeader
  250    250   
    #[::tokio::test]
  251    251   
    #[::tracing_test::traced_test]
  252    252   
    async fn non_query_compatible_rpc_v2_cbor_forbids_query_mode_header_request() {
  253    253   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  254    254   
        let config_builder = crate::config::Config::builder()
  255    255   
            .with_test_defaults()
  256         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         256  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         257  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         258  +
            .allow_no_auth()
  257    259   
            .endpoint_url("https://example.com");
  258    260   
  259    261   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  260    262   
        let result = client.non_query_compatible_operation().send().await;
  261    263   
        let _ = dbg!(result);
  262    264   
        let http_request = request_receiver.expect_request();
  263    265   
        let expected_headers = [("Accept", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  264    266   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  265    267   
        let forbidden_headers = &["x-amzn-query-mode"];
  266    268   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::forbid_headers(http_request.headers(), forbidden_headers));

tmp-codegen-diff/codegen-client-test/rpcv2cbor_query_compatible/rust-client-codegen/src/config.rs

@@ -350,350 +409,427 @@
  370    370   
  371    371   
    /// Set the auth scheme resolver for the builder
  372    372   
    ///
  373    373   
    /// # Examples
  374    374   
    /// See an example for [`Self::auth_scheme_resolver`].
  375    375   
    pub fn set_auth_scheme_resolver(&mut self, auth_scheme_resolver: impl crate::config::auth::ResolveAuthScheme + 'static) -> &mut Self {
  376    376   
        self.runtime_components
  377    377   
            .set_auth_scheme_option_resolver(::std::option::Option::Some(auth_scheme_resolver.into_shared_resolver()));
  378    378   
        self
  379    379   
    }
         380  +
         381  +
    /// Enable no authentication regardless of what authentication mechanisms operations support
         382  +
    ///
         383  +
    /// This adds [NoAuthScheme](aws_smithy_runtime::client::auth::no_auth::NoAuthScheme) as a fallback
         384  +
    /// and the auth scheme resolver will use it when no other auth schemes are applicable.
         385  +
    pub fn allow_no_auth(mut self) -> Self {
         386  +
        self.set_allow_no_auth();
         387  +
        self
         388  +
    }
         389  +
         390  +
    /// Enable no authentication regardless of what authentication mechanisms operations support
         391  +
    ///
         392  +
    /// This adds [NoAuthScheme](aws_smithy_runtime::client::auth::no_auth::NoAuthScheme) as a fallback
         393  +
    /// and the auth scheme resolver will use it when no other auth schemes are applicable.
         394  +
    pub fn set_allow_no_auth(&mut self) -> &mut Self {
         395  +
        self.push_runtime_plugin(::aws_smithy_runtime::client::auth::no_auth::NoAuthRuntimePluginV2::new().into_shared());
         396  +
        self
         397  +
    }
  380    398   
    /// Set the auth scheme preference for an auth scheme resolver
  381    399   
    /// (typically the default auth scheme resolver).
  382    400   
    ///
  383    401   
    /// Each operation has a predefined order of auth schemes, as determined by the service,
  384    402   
    /// for auth scheme resolution. By using the auth scheme preference, customers
  385    403   
    /// can reorder the schemes resolved by the auth scheme resolver.
  386    404   
    ///
  387    405   
    /// The preference list is intended as a hint rather than a strict override.
  388    406   
    /// Any schemes not present in the originally resolved auth schemes will be ignored.
  389    407   
    ///
@@ -1199,1217 +1259,1278 @@
 1219   1237   
    {
 1220   1238   
        if config.behavior_version.is_none() {
 1221   1239   
            config.behavior_version = Some(::aws_smithy_runtime_api::client::behavior_version::BehaviorVersion::latest());
 1222   1240   
        }
 1223   1241   
    }
 1224   1242   
 1225   1243   
    let default_retry_partition = "querycompatiblerpcv2protocol";
 1226   1244   
 1227   1245   
    let scope = "rpcv2cbor_query_compatible";
 1228   1246   
 1229         -
    let mut plugins = ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins::new()
        1247  +
    #[allow(deprecated)]
        1248  +
                    let mut plugins = ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins::new()
 1230   1249   
                        // defaults
 1231   1250   
                        .with_client_plugins(::aws_smithy_runtime::client::defaults::default_plugins(
 1232   1251   
                            ::aws_smithy_runtime::client::defaults::DefaultPluginParams::new()
 1233   1252   
                                .with_retry_partition_name(default_retry_partition)
 1234   1253   
                                .with_behavior_version(config.behavior_version.expect("Invalid client configuration: A behavior major version must be set when sending a request or constructing a client. You must set it during client construction or by enabling the `behavior-version-latest` cargo feature."))
 1235   1254   
                        ))
 1236   1255   
                        // user config
 1237   1256   
                        .with_client_plugin(
 1238   1257   
                            ::aws_smithy_runtime_api::client::runtime_plugin::StaticRuntimePlugin::new()
 1239   1258   
                                .with_config(config.config.clone())

tmp-codegen-diff/codegen-client-test/rpcv2cbor_query_compatible/rust-client-codegen/src/config/auth.rs

@@ -71,71 +148,130 @@
   91     91   
    pub fn builder() -> crate::config::auth::ParamsBuilder {
   92     92   
        crate::config::auth::ParamsBuilder::default()
   93     93   
    }
   94     94   
   95     95   
    /// Return the operation name for [`Params`]
   96     96   
    pub fn operation_name(&self) -> &str {
   97     97   
        self.operation_name.as_ref()
   98     98   
    }
   99     99   
}
  100    100   
  101         -
#[cfg(test)]
  102         -
#[derive(Debug)]
  103         -
pub(crate) struct NoAuthSchemeResolver;
  104         -
  105         -
#[cfg(test)]
  106         -
impl ResolveAuthScheme for NoAuthSchemeResolver {
  107         -
    fn resolve_auth_scheme<'a>(
  108         -
        &'a self,
  109         -
        _params: &'a crate::config::auth::Params,
  110         -
        _cfg: &'a ::aws_smithy_types::config_bag::ConfigBag,
  111         -
        _runtime_components: &'a ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponents,
  112         -
    ) -> ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture<'a> {
  113         -
        ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture::ready(::std::result::Result::Ok(vec![
  114         -
            ::aws_smithy_runtime_api::client::auth::AuthSchemeOption::from(::aws_smithy_runtime::client::auth::no_auth::NO_AUTH_SCHEME_ID),
  115         -
        ]))
  116         -
    }
  117         -
}
  118         -
  119    101   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  120    102   
/// Builder for [`Params`]
  121    103   
pub struct ParamsBuilder {
  122    104   
    operation_name: ::std::option::Option<::std::borrow::Cow<'static, str>>,
  123    105   
}
  124    106   
impl ParamsBuilder {
  125    107   
    /// Set the operation name for the builder
  126    108   
    pub fn operation_name(self, operation_name: impl Into<::std::borrow::Cow<'static, str>>) -> Self {
  127    109   
        self.set_operation_name(::std::option::Option::Some(operation_name.into()))
  128    110   
    }

tmp-codegen-diff/codegen-client-test/rpcv2cbor_query_compatible/rust-client-codegen/src/operation/query_compatible_operation.rs

@@ -224,224 +284,286 @@
  244    244   
mod query_compatible_operation_test {
  245    245   
  246    246   
    /// Clients for query-compatible services MUST send the x-amzn-query-mode header.
  247    247   
    /// Test ID: QueryCompatibleRpcV2CborSendsQueryModeHeader
  248    248   
    #[::tokio::test]
  249    249   
    #[::tracing_test::traced_test]
  250    250   
    async fn query_compatible_rpc_v2_cbor_sends_query_mode_header_request() {
  251    251   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  252    252   
        let config_builder = crate::config::Config::builder()
  253    253   
            .with_test_defaults()
  254         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         254  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         255  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         256  +
            .allow_no_auth()
  255    257   
            .endpoint_url("https://example.com");
  256    258   
  257    259   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  258    260   
        let result = client.query_compatible_operation().send().await;
  259    261   
        let _ = dbg!(result);
  260    262   
        let http_request = request_receiver.expect_request();
  261    263   
        let expected_headers = [
  262    264   
            ("Accept", "application/cbor"),
  263    265   
            ("smithy-protocol", "rpc-v2-cbor"),
  264    266   
            ("x-amzn-query-mode", "true"),

tmp-codegen-diff/codegen-client-test/simple/rust-client-codegen/src/config.rs

@@ -350,350 +409,427 @@
  370    370   
  371    371   
    /// Set the auth scheme resolver for the builder
  372    372   
    ///
  373    373   
    /// # Examples
  374    374   
    /// See an example for [`Self::auth_scheme_resolver`].
  375    375   
    pub fn set_auth_scheme_resolver(&mut self, auth_scheme_resolver: impl crate::config::auth::ResolveAuthScheme + 'static) -> &mut Self {
  376    376   
        self.runtime_components
  377    377   
            .set_auth_scheme_option_resolver(::std::option::Option::Some(auth_scheme_resolver.into_shared_resolver()));
  378    378   
        self
  379    379   
    }
         380  +
         381  +
    /// Enable no authentication regardless of what authentication mechanisms operations support
         382  +
    ///
         383  +
    /// This adds [NoAuthScheme](aws_smithy_runtime::client::auth::no_auth::NoAuthScheme) as a fallback
         384  +
    /// and the auth scheme resolver will use it when no other auth schemes are applicable.
         385  +
    pub fn allow_no_auth(mut self) -> Self {
         386  +
        self.set_allow_no_auth();
         387  +
        self
         388  +
    }
         389  +
         390  +
    /// Enable no authentication regardless of what authentication mechanisms operations support
         391  +
    ///
         392  +
    /// This adds [NoAuthScheme](aws_smithy_runtime::client::auth::no_auth::NoAuthScheme) as a fallback
         393  +
    /// and the auth scheme resolver will use it when no other auth schemes are applicable.
         394  +
    pub fn set_allow_no_auth(&mut self) -> &mut Self {
         395  +
        self.push_runtime_plugin(::aws_smithy_runtime::client::auth::no_auth::NoAuthRuntimePluginV2::new().into_shared());
         396  +
        self
         397  +
    }
  380    398   
    /// Set the auth scheme preference for an auth scheme resolver
  381    399   
    /// (typically the default auth scheme resolver).
  382    400   
    ///
  383    401   
    /// Each operation has a predefined order of auth schemes, as determined by the service,
  384    402   
    /// for auth scheme resolution. By using the auth scheme preference, customers
  385    403   
    /// can reorder the schemes resolved by the auth scheme resolver.
  386    404   
    ///
  387    405   
    /// The preference list is intended as a hint rather than a strict override.
  388    406   
    /// Any schemes not present in the originally resolved auth schemes will be ignored.
  389    407   
    ///
@@ -1196,1214 +1256,1275 @@
 1216   1234   
    {
 1217   1235   
        if config.behavior_version.is_none() {
 1218   1236   
            config.behavior_version = Some(::aws_smithy_runtime_api::client::behavior_version::BehaviorVersion::latest());
 1219   1237   
        }
 1220   1238   
    }
 1221   1239   
 1222   1240   
    let default_retry_partition = "simpleservice";
 1223   1241   
 1224   1242   
    let scope = "simple";
 1225   1243   
 1226         -
    let mut plugins = ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins::new()
        1244  +
    #[allow(deprecated)]
        1245  +
                    let mut plugins = ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins::new()
 1227   1246   
                        // defaults
 1228   1247   
                        .with_client_plugins(::aws_smithy_runtime::client::defaults::default_plugins(
 1229   1248   
                            ::aws_smithy_runtime::client::defaults::DefaultPluginParams::new()
 1230   1249   
                                .with_retry_partition_name(default_retry_partition)
 1231   1250   
                                .with_behavior_version(config.behavior_version.expect("Invalid client configuration: A behavior major version must be set when sending a request or constructing a client. You must set it during client construction or by enabling the `behavior-version-latest` cargo feature."))
 1232   1251   
                        ))
 1233   1252   
                        // user config
 1234   1253   
                        .with_client_plugin(
 1235   1254   
                            ::aws_smithy_runtime_api::client::runtime_plugin::StaticRuntimePlugin::new()
 1236   1255   
                                .with_config(config.config.clone())