From 6b8b58efe2bfa41fba8fe8252d1e266b05b5c2b9 Mon Sep 17 00:00:00 2001 From: Chris Armstrong Date: Mon, 6 Jul 2026 13:26:49 +1000 Subject: [PATCH 1/2] fix: ResponseMetadata, Long/BigInt/BigDecimal, idempotency auto-fill, awsJson error tests Changes: - AwsQuery: handle ResponseMetadata-only responses with no result wrapper - Type codegen: smithy.api#Long -> Int64, BigInteger/BigDecimal -> zarith-backed CoreTypes - Auto-fill @idempotencyToken members with uuidm - awsJson error-response tests + header/body error-type extraction - Full conformance suite passes: 110 json + 75 query tests --- OF | 0 TODO.md | 11 +- codegen/AwsProtocolJson.ml | 26 +- codegen/AwsProtocolQuery.ml | 55 ++- codegen/Types.ml | 7 +- dune-project | 2 + model_tests/protocols/json/protocol_tests.ml | 352 +++++++++++++++++- model_tests/protocols/query/protocol_tests.ml | 43 ++- .../protocols/query/query_deserializers.ml | 5 +- .../protocols/query/query_serializers.ml | 6 +- .../protocols/shared/query_deserializers.ml | 8 +- .../protocols/shared/query_serializers.ml | 4 +- refactorings/awsquery_protocol_support.md | 12 +- sdkgen/gen_protocol_tests.ml | 76 +++- sdks/acm/json_serializers.ml | 15 +- sdks/backup-gateway/types.ml | 2 +- sdks/backup-gateway/types.mli | 2 +- sdks/cloudtrail/types.ml | 2 +- sdks/cloudtrail/types.mli | 2 +- sdks/cognito-identity/types.ml | 2 +- sdks/cognito-identity/types.mli | 2 +- sdks/config-service/types.ml | 4 +- sdks/config-service/types.mli | 4 +- sdks/dynamodb-streams/types.ml | 2 +- sdks/dynamodb-streams/types.mli | 2 +- sdks/dynamodb/json_serializers.ml | 20 +- sdks/dynamodb/types.ml | 20 +- sdks/dynamodb/types.mli | 20 +- sdks/eventbridge/types.ml | 2 +- sdks/eventbridge/types.mli | 2 +- sdks/fms/types.ml | 4 +- sdks/fms/types.mli | 4 +- sdks/kendra/json_serializers.ml | 35 +- sdks/kendra/types.ml | 6 +- sdks/kendra/types.mli | 6 +- sdks/keyspaces/types.ml | 2 +- sdks/keyspaces/types.mli | 2 +- sdks/kinesis-analytics-v2/types.ml | 10 +- sdks/kinesis-analytics-v2/types.mli | 10 +- sdks/kinesis-analytics/types.ml | 2 +- sdks/kinesis-analytics/types.mli | 2 +- sdks/kinesis/types.ml | 2 +- sdks/kinesis/types.mli | 2 +- sdks/lightsail/types.ml | 2 +- sdks/lightsail/types.mli | 2 +- .../marketplace-agreement/json_serializers.ml | 15 +- sdks/marketplace-agreement/types.ml | 2 +- sdks/marketplace-agreement/types.mli | 2 +- sdks/opensearchserverless/json_serializers.ml | 105 ++++-- sdks/proton/json_serializers.ml | 35 +- sdks/resource-groups-tagging-api/types.ml | 2 +- sdks/resource-groups-tagging-api/types.mli | 2 +- sdks/servicediscovery/json_serializers.ml | 40 +- sdks/servicediscovery/types.ml | 4 +- sdks/servicediscovery/types.mli | 4 +- sdks/sfn/json_serializers.ml | 5 +- sdks/sfn/types.ml | 14 +- sdks/sfn/types.mli | 14 +- sdks/shield/types.ml | 6 +- sdks/shield/types.mli | 6 +- sdks/snowball/types.ml | 2 +- sdks/snowball/types.mli | 2 +- sdks/sqs/types.ml | 4 +- sdks/sqs/types.mli | 4 +- sdks/ssm/json_serializers.ml | 24 +- sdks/ssm/types.ml | 6 +- sdks/ssm/types.mli | 6 +- sdks/swf/types.ml | 2 +- sdks/swf/types.mli | 2 +- sdks/transcribe/types.ml | 2 +- sdks/transcribe/types.mli | 2 +- sdks/waf/types.ml | 10 +- sdks/waf/types.mli | 10 +- sdks/wafv2/types.ml | 24 +- sdks/wafv2/types.mli | 24 +- sdks/workmail/json_serializers.ml | 35 +- sdks/workmail/types.ml | 2 +- sdks/workmail/types.mli | 2 +- smaws-lib.opam | 2 + smaws_lib/CoreTypes.ml | 66 ++++ smaws_lib/Json.ml | 23 +- smaws_lib/Smaws_Lib.ml | 1 + smaws_lib/Smithy_api.ml | 15 +- smaws_lib/Uuid.ml | 19 + smaws_lib/Xml.ml | 6 +- smaws_lib/dune | 4 +- smaws_lib/protocols_impl/AwsJson.ml | 41 +- smaws_lib/protocols_impl/AwsQuery.ml | 18 +- smithy_ast/Trait.ml | 1 + 89 files changed, 1133 insertions(+), 283 deletions(-) create mode 100644 OF create mode 100644 smaws_lib/Uuid.ml diff --git a/OF b/OF new file mode 100644 index 00000000..e69de29b diff --git a/TODO.md b/TODO.md index 70137907..bbb4748b 100644 --- a/TODO.md +++ b/TODO.md @@ -45,12 +45,13 @@ * [x] AwsJson1.0 * [x] AwsJson1.1 -* [x] AwsQuery (core: serialise/deserialise/typed errors, unions; passes smithy conformance suite. Pending: idempotency-token auto-fill, request compression) - * [ ] Wire [UInt64] (or [Int64]) into codegen for `smithy.api#Long` - currently maps to OCaml [int], overflowing for values > 2^62-1 - * [ ] Represent `smithy.api#BigInteger` / `smithy.api#BigDecimal` beyond [int]/[float] - [UInt64] only covers 0..2^64-1; BigInteger is unbounded and BigDecimal needs >15 sig digits. Likely needs a string passthrough or a bignum dependency (ask before adding deps) +* [x] AwsQuery (core: serialise/deserialise/typed errors, unions; passes smithy conformance suite. Pending: request compression) + * [x] ResponseMetadata handling in awsQuery responses with no result wrapper + * [x] Wire [Int64] into codegen for `smithy.api#Long` - no longer maps to OCaml [int] + * [x] Represent `smithy.api#BigInteger` / `smithy.api#BigDecimal` beyond [int]/[float] using zarith-backed [CoreTypes.BigInt] / [CoreTypes.BigDecimal] * [x] awsQuery union serialisation/deserialisation - * [ ] `@idempotencyToken` auto-fill (`QueryProtocolIdempotencyTokenAutoFill` is banned) + * [x] `@idempotencyToken` auto-fill using uuidm * [ ] `@requestCompression` gzip (`SDKAppliedContentEncoding_awsQuery` / `SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsQuery` are banned) - * [ ] awsJson error-response test generation (`make_error_response_test_str` is awsQuery-only; awsJson error fixtures need a JSON error reader) + * [x] awsJson error-response test generation (`make_error_response_test_str` now works for awsJson too, with header/body error-type extraction) * [ ] REST * [ ] S3 diff --git a/codegen/AwsProtocolJson.ml b/codegen/AwsProtocolJson.ml index 406edec9..0cdaa9d4 100644 --- a/codegen/AwsProtocolJson.ml +++ b/codegen/AwsProtocolJson.ml @@ -164,12 +164,32 @@ module Serialiser = struct (Location.mknoloc (func_name ~member_traits:mem.traits ~namespace_resolver mem.target)) in + let is_idempotency_token = Trait.hasTrait mem.traits Trait.isIdempotencyTokenTrait in let value = - match is_required with - | true -> + match (is_required, is_idempotency_token) with + | true, _ -> B.pexp_construct (lident_noloc "Some") (Some (B.pexp_apply basic_value_exp [ (Nolabel, field_lookup) ])) - | false -> + | false, true -> + (* Auto-fill idempotency tokens when the caller does not supply one. *) + let filled = + B.pexp_apply + (B.pexp_ident (Location.mknoloc (make_lident ~names:[ "Option"; "value" ]))) + [ + (Nolabel, field_lookup); + ( Labelled "default", + B.pexp_apply + (B.pexp_ident + (Location.mknoloc + (make_lident ~names:[ "Smaws_Lib"; "Uuid"; "generate" ]))) + [ + (Nolabel, B.pexp_construct (Location.mknoloc Ppxlib.(Lident "()")) None); + ] ); + ] + in + B.pexp_construct (lident_noloc "Some") + (Some (B.pexp_apply basic_value_exp [ (Nolabel, filled) ])) + | false, false -> B.pexp_apply (B.pexp_ident (lident_noloc "option_to_yojson")) [ (Nolabel, basic_value_exp); (Nolabel, field_lookup) ] diff --git a/codegen/AwsProtocolQuery.ml b/codegen/AwsProtocolQuery.ml index f6bb7c10..bb87e42f 100644 --- a/codegen/AwsProtocolQuery.ml +++ b/codegen/AwsProtocolQuery.ml @@ -70,11 +70,12 @@ module Serialiser = struct ?(shape_traits : Trait.t list option = None) target_name = match target_name with | "smithy.api#String" | "smithy.api#Unit" -> Some "string_field" - | "smithy.api#Integer" | "smithy.api#Byte" | "smithy.api#Short" | "smithy.api#Long" - | "smithy.api#BigInteger" -> - Some "int_field" + | "smithy.api#Integer" | "smithy.api#Byte" | "smithy.api#Short" -> Some "int_field" + | "smithy.api#Long" -> Some "long_field" + | "smithy.api#BigInteger" -> Some "big_int_field" + | "smithy.api#BigDecimal" -> Some "big_decimal_field" | "smithy.api#Boolean" -> Some "bool_field" - | "smithy.api#Float" | "smithy.api#Double" | "smithy.api#BigDecimal" -> Some "float_field" + | "smithy.api#Float" | "smithy.api#Double" -> Some "float_field" | "smithy.api#Blob" -> Some "blob_field" | "smithy.api#Timestamp" -> let fmt = resolve_timestamp_format ~member_traits ~shape_traits () in @@ -158,6 +159,7 @@ module Serialiser = struct let generate_member_expr ~namespace_resolver ~shape_resolver (mem : Shape.member) = let open Trait in let is_required = hasTrait mem.traits isRequiredTrait in + let is_idempotency_token = hasTrait mem.traits isIdempotencyTokenTrait in let xml_key = xml_name mem.traits mem.name in let path_expr = path_append path_ident xml_key in let field_access = @@ -173,9 +175,18 @@ module Serialiser = struct member_value_expr ~namespace_resolver ~shape_resolver ~member_traits ~shape_traits ~path_expr v_expr mem.target in + let none_rhs = + if is_idempotency_token then + inner_expr + (B.pexp_apply + (B.pexp_ident + (Location.mknoloc (make_lident ~names:[ "Smaws_Lib"; "Uuid"; "generate" ]))) + [ (Nolabel, unit_expr) ]) + else B.elist [] + in B.pexp_match field_access [ - B.case ~lhs:(B.ppat_construct (lident_noloc "None") None) ~guard:None ~rhs:(B.elist []); + B.case ~lhs:(B.ppat_construct (lident_noloc "None") None) ~guard:None ~rhs:none_rhs; B.case ~lhs:(B.ppat_construct (lident_noloc "Some") (Some (B.ppat_var (Location.mknoloc "v")))) ~guard:None @@ -347,8 +358,10 @@ module Serialiser = struct (exp_fun_untyped "v" (serialize_call helper [ (Nolabel, exp_ident "path"); (Nolabel, exp_ident "v") ])))) else Some (primitive_field_lambda "string_field") - | IntegerShape _ | LongShape _ | ShortShape _ | ByteShape _ -> - Some (primitive_field_lambda "int_field") + | IntegerShape _ | ShortShape _ | ByteShape _ -> Some (primitive_field_lambda "int_field") + | LongShape _ -> Some (primitive_field_lambda "long_field") + | BigIntegerShape _ -> Some (primitive_field_lambda "big_int_field") + | BigDecimalShape _ -> Some (primitive_field_lambda "big_decimal_field") | BooleanShape _ -> Some (primitive_field_lambda "bool_field") | FloatShape _ | DoubleShape _ -> Some (primitive_field_lambda "float_field") | BlobShape _ -> Some (primitive_field_lambda "blob_field") @@ -465,12 +478,32 @@ module Deserialiser = struct let parse_primitive_from_string target_name str_expr = match target_name with | "smithy.api#String" -> Some str_expr - | "smithy.api#Integer" | "smithy.api#Byte" | "smithy.api#Short" | "smithy.api#Long" - | "smithy.api#BigInteger" -> + | "smithy.api#Integer" | "smithy.api#Byte" | "smithy.api#Short" -> Some (B.pexp_apply (exp_ident "int_of_string") [ (Nolabel, str_expr) ]) + | "smithy.api#Long" -> + Some + (B.pexp_apply + (B.pexp_ident + (Location.mknoloc + (make_lident ~names:[ "Smaws_Lib"; "CoreTypes"; "Int64"; "of_string" ]))) + [ (Nolabel, str_expr) ]) + | "smithy.api#BigInteger" -> + Some + (B.pexp_apply + (B.pexp_ident + (Location.mknoloc + (make_lident ~names:[ "Smaws_Lib"; "CoreTypes"; "BigInt"; "of_string" ]))) + [ (Nolabel, str_expr) ]) + | "smithy.api#BigDecimal" -> + Some + (B.pexp_apply + (B.pexp_ident + (Location.mknoloc + (make_lident ~names:[ "Smaws_Lib"; "CoreTypes"; "BigDecimal"; "of_string" ]))) + [ (Nolabel, str_expr) ]) | "smithy.api#Boolean" -> Some (B.pexp_apply (exp_ident "bool_of_string") [ (Nolabel, str_expr) ]) - | "smithy.api#Float" | "smithy.api#Double" | "smithy.api#BigDecimal" -> + | "smithy.api#Float" | "smithy.api#Double" -> Some (B.pexp_apply (exp_ident "float_of_string") [ (Nolabel, str_expr) ]) | "smithy.api#Blob" -> Some @@ -843,6 +876,8 @@ module Deserialiser = struct else Some (read_data_lambda ()) | IntegerShape _ | LongShape _ | ShortShape _ | ByteShape _ -> Some (primitive_of_xml_lambda "int_of_string") + | BigIntegerShape _ -> Some (primitive_of_xml_lambda "big_int_of_string") + | BigDecimalShape _ -> Some (primitive_of_xml_lambda "big_decimal_of_string") | BooleanShape _ -> Some (primitive_of_xml_lambda "bool_of_string") | FloatShape _ | DoubleShape _ -> Some (primitive_of_xml_lambda "float_of_string") | BlobShape _ -> Some (primitive_of_xml_lambda "blob_of_string") diff --git a/codegen/Types.ml b/codegen/Types.ml index bd6c2b59..dcd5235e 100644 --- a/codegen/Types.ml +++ b/codegen/Types.ml @@ -73,15 +73,16 @@ let make_basic_type_manifest ctx descriptor ~(namespace_resolver : Namespace_resolver.Namespace_resolver.t) () = let open Ast.Shape in match descriptor with - | BigDecimalShape { traits; _ } -> [%type: Bigdecimal.t] - | BigIntegerShape { traits; _ } -> [%type: Big_int.big_int] + | BigDecimalShape { traits; _ } -> [%type: Smaws_Lib.CoreTypes.BigDecimal.t] + | BigIntegerShape { traits; _ } -> [%type: Smaws_Lib.CoreTypes.BigInt.t] | ByteShape { traits; _ } -> [%type: int] | ShortShape { traits; _ } -> [%type: int] | BlobShape { traits; _ } -> [%type: bytes] | BooleanShape { traits; _ } -> [%type: bool] | DocumentShape -> Builtin_types.document | FloatShape { traits; _ } | DoubleShape { traits; _ } -> [%type: float] - | LongShape { traits; _ } | IntegerShape { traits; _ } -> [%type: int] + | LongShape { traits; _ } -> [%type: Smaws_Lib.CoreTypes.Int64.t] + | IntegerShape { traits; _ } -> [%type: int] | StringShape { traits; _ } -> [%type: string] | SetShape { target; traits } | ListShape { target; traits; _ } -> (* List types are considered "dense" by default, which means they do not contain null values. However, diff --git a/dune-project b/dune-project index 3f1cf3e9..97dcd6e9 100644 --- a/dune-project +++ b/dune-project @@ -74,6 +74,8 @@ (>= "3.4.0")) (digestif (>= "1.1.4")) + zarith + uuidm (eio-ssl (>= "0.3.0")) (uri diff --git a/model_tests/protocols/json/protocol_tests.ml b/model_tests/protocols/json/protocol_tests.ml index f5d831a5..fff5cf75 100644 --- a/model_tests/protocols/json/protocol_tests.ml +++ b/model_tests/protocols/json/protocol_tests.ml @@ -244,8 +244,354 @@ let endpoint_with_host_label_operation_test_suite : unit Alcotest.test = let fractional_seconds_test_suite : unit Alcotest.test = ("aws.protocoltests.json#FractionalSeconds", []) +let aws_json11_complex_error () = + Eio.Switch.run ~name:"AwsJson11ComplexError" @@ fun sw -> + let module Mock = (val Http_mock.create_http_mock ()) in + let http_type = ((module Mock) : (module Smaws_Lib.Http.Client with type t = Mock.t)) in + let config = Config.dummy in + let ctx = Smaws_Lib.Context.make ~config ~http_type () in + Mock.mock_response + ?body: + (Some + "{\n\ + \ \"__type\": \"ComplexError\",\n\ + \ \"TopLevel\": \"Top level\",\n\ + \ \"Nested\": {\n\ + \ \"Foo\": \"bar\"\n\ + \ }\n\ + }") + ~status:400 + ~headers:[ ("Content-Type", "application/x-amz-json-1.1") ] + (); + let response = GreetingWithErrors.request ctx () in + match response with + | Error (`ComplexError e) -> + let expected = + ({ nested = Some { foo = Some "bar" }; top_level = Some "Top level" } : Types.complex_error) + in + check + (Alcotest_http.testable_nan_aware Types.pp_complex_error Types.equal_complex_error) + "expected error" expected e + | Error other -> failwith (GreetingWithErrors.error_to_string other) + | Ok _ -> failwith "expected an error response, got Ok" + +let aws_json11_empty_complex_error () = + Eio.Switch.run ~name:"AwsJson11EmptyComplexError" @@ fun sw -> + let module Mock = (val Http_mock.create_http_mock ()) in + let http_type = ((module Mock) : (module Smaws_Lib.Http.Client with type t = Mock.t)) in + let config = Config.dummy in + let ctx = Smaws_Lib.Context.make ~config ~http_type () in + Mock.mock_response ?body:(Some "{\n \"__type\": \"ComplexError\"\n}") ~status:400 + ~headers:[ ("Content-Type", "application/x-amz-json-1.1") ] + (); + let response = GreetingWithErrors.request ctx () in + match response with + | Error (`ComplexError e) -> + let expected = ({ nested = None; top_level = None } : Types.complex_error) in + check + (Alcotest_http.testable_nan_aware Types.pp_complex_error Types.equal_complex_error) + "expected error" expected e + | Error other -> failwith (GreetingWithErrors.error_to_string other) + | Ok _ -> failwith "expected an error response, got Ok" + +let aws_json11_foo_error_using_x_amzn_error_type () = + Eio.Switch.run ~name:"AwsJson11FooErrorUsingXAmznErrorType" @@ fun sw -> + let module Mock = (val Http_mock.create_http_mock ()) in + let http_type = ((module Mock) : (module Smaws_Lib.Http.Client with type t = Mock.t)) in + let config = Config.dummy in + let ctx = Smaws_Lib.Context.make ~config ~http_type () in + Mock.mock_response ?body:None ~status:500 ~headers:[ ("X-Amzn-Errortype", "FooError") ] (); + let response = GreetingWithErrors.request ctx () in + match response with + | Error (`FooError e) -> + let expected = (() : Types.foo_error) in + check + (Alcotest_http.testable_nan_aware Types.pp_foo_error Types.equal_foo_error) + "expected error" expected e + | Error other -> failwith (GreetingWithErrors.error_to_string other) + | Ok _ -> failwith "expected an error response, got Ok" + +let aws_json11_foo_error_using_x_amzn_error_type_with_uri () = + Eio.Switch.run ~name:"AwsJson11FooErrorUsingXAmznErrorTypeWithUri" @@ fun sw -> + let module Mock = (val Http_mock.create_http_mock ()) in + let http_type = ((module Mock) : (module Smaws_Lib.Http.Client with type t = Mock.t)) in + let config = Config.dummy in + let ctx = Smaws_Lib.Context.make ~config ~http_type () in + Mock.mock_response ?body:None ~status:500 + ~headers: + [ + ("X-Amzn-Errortype", "FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/"); + ] + (); + let response = GreetingWithErrors.request ctx () in + match response with + | Error (`FooError e) -> + let expected = (() : Types.foo_error) in + check + (Alcotest_http.testable_nan_aware Types.pp_foo_error Types.equal_foo_error) + "expected error" expected e + | Error other -> failwith (GreetingWithErrors.error_to_string other) + | Ok _ -> failwith "expected an error response, got Ok" + +let aws_json11_foo_error_using_x_amzn_error_type_with_uri_and_namespace () = + Eio.Switch.run ~name:"AwsJson11FooErrorUsingXAmznErrorTypeWithUriAndNamespace" @@ fun sw -> + let module Mock = (val Http_mock.create_http_mock ()) in + let http_type = ((module Mock) : (module Smaws_Lib.Http.Client with type t = Mock.t)) in + let config = Config.dummy in + let ctx = Smaws_Lib.Context.make ~config ~http_type () in + Mock.mock_response ?body:None ~status:500 + ~headers: + [ + ( "X-Amzn-Errortype", + "aws.protocoltests.json#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/" + ); + ] + (); + let response = GreetingWithErrors.request ctx () in + match response with + | Error (`FooError e) -> + let expected = (() : Types.foo_error) in + check + (Alcotest_http.testable_nan_aware Types.pp_foo_error Types.equal_foo_error) + "expected error" expected e + | Error other -> failwith (GreetingWithErrors.error_to_string other) + | Ok _ -> failwith "expected an error response, got Ok" + +let aws_json11_foo_error_using_code () = + Eio.Switch.run ~name:"AwsJson11FooErrorUsingCode" @@ fun sw -> + let module Mock = (val Http_mock.create_http_mock ()) in + let http_type = ((module Mock) : (module Smaws_Lib.Http.Client with type t = Mock.t)) in + let config = Config.dummy in + let ctx = Smaws_Lib.Context.make ~config ~http_type () in + Mock.mock_response ?body:(Some "{\n \"code\": \"FooError\"\n}") ~status:500 + ~headers:[ ("Content-Type", "application/x-amz-json-1.1") ] + (); + let response = GreetingWithErrors.request ctx () in + match response with + | Error (`FooError e) -> + let expected = (() : Types.foo_error) in + check + (Alcotest_http.testable_nan_aware Types.pp_foo_error Types.equal_foo_error) + "expected error" expected e + | Error other -> failwith (GreetingWithErrors.error_to_string other) + | Ok _ -> failwith "expected an error response, got Ok" + +let aws_json11_foo_error_using_code_and_namespace () = + Eio.Switch.run ~name:"AwsJson11FooErrorUsingCodeAndNamespace" @@ fun sw -> + let module Mock = (val Http_mock.create_http_mock ()) in + let http_type = ((module Mock) : (module Smaws_Lib.Http.Client with type t = Mock.t)) in + let config = Config.dummy in + let ctx = Smaws_Lib.Context.make ~config ~http_type () in + Mock.mock_response ?body:(Some "{\n \"code\": \"aws.protocoltests.json#FooError\"\n}") + ~status:500 + ~headers:[ ("Content-Type", "application/x-amz-json-1.1") ] + (); + let response = GreetingWithErrors.request ctx () in + match response with + | Error (`FooError e) -> + let expected = (() : Types.foo_error) in + check + (Alcotest_http.testable_nan_aware Types.pp_foo_error Types.equal_foo_error) + "expected error" expected e + | Error other -> failwith (GreetingWithErrors.error_to_string other) + | Ok _ -> failwith "expected an error response, got Ok" + +let aws_json11_foo_error_using_code_uri_and_namespace () = + Eio.Switch.run ~name:"AwsJson11FooErrorUsingCodeUriAndNamespace" @@ fun sw -> + let module Mock = (val Http_mock.create_http_mock ()) in + let http_type = ((module Mock) : (module Smaws_Lib.Http.Client with type t = Mock.t)) in + let config = Config.dummy in + let ctx = Smaws_Lib.Context.make ~config ~http_type () in + Mock.mock_response + ?body: + (Some + "{\n\ + \ \"code\": \ + \"aws.protocoltests.json#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/\"\n\ + }") + ~status:500 + ~headers:[ ("Content-Type", "application/x-amz-json-1.1") ] + (); + let response = GreetingWithErrors.request ctx () in + match response with + | Error (`FooError e) -> + let expected = (() : Types.foo_error) in + check + (Alcotest_http.testable_nan_aware Types.pp_foo_error Types.equal_foo_error) + "expected error" expected e + | Error other -> failwith (GreetingWithErrors.error_to_string other) + | Ok _ -> failwith "expected an error response, got Ok" + +let aws_json11_foo_error_with_dunder_type () = + Eio.Switch.run ~name:"AwsJson11FooErrorWithDunderType" @@ fun sw -> + let module Mock = (val Http_mock.create_http_mock ()) in + let http_type = ((module Mock) : (module Smaws_Lib.Http.Client with type t = Mock.t)) in + let config = Config.dummy in + let ctx = Smaws_Lib.Context.make ~config ~http_type () in + Mock.mock_response ?body:(Some "{\n \"__type\": \"FooError\"\n}") ~status:500 + ~headers:[ ("Content-Type", "application/x-amz-json-1.1") ] + (); + let response = GreetingWithErrors.request ctx () in + match response with + | Error (`FooError e) -> + let expected = (() : Types.foo_error) in + check + (Alcotest_http.testable_nan_aware Types.pp_foo_error Types.equal_foo_error) + "expected error" expected e + | Error other -> failwith (GreetingWithErrors.error_to_string other) + | Ok _ -> failwith "expected an error response, got Ok" + +let aws_json11_foo_error_with_dunder_type_and_namespace () = + Eio.Switch.run ~name:"AwsJson11FooErrorWithDunderTypeAndNamespace" @@ fun sw -> + let module Mock = (val Http_mock.create_http_mock ()) in + let http_type = ((module Mock) : (module Smaws_Lib.Http.Client with type t = Mock.t)) in + let config = Config.dummy in + let ctx = Smaws_Lib.Context.make ~config ~http_type () in + Mock.mock_response ?body:(Some "{\n \"__type\": \"aws.protocoltests.json#FooError\"\n}") + ~status:500 + ~headers:[ ("Content-Type", "application/x-amz-json-1.1") ] + (); + let response = GreetingWithErrors.request ctx () in + match response with + | Error (`FooError e) -> + let expected = (() : Types.foo_error) in + check + (Alcotest_http.testable_nan_aware Types.pp_foo_error Types.equal_foo_error) + "expected error" expected e + | Error other -> failwith (GreetingWithErrors.error_to_string other) + | Ok _ -> failwith "expected an error response, got Ok" + +let aws_json11_foo_error_with_dunder_type_and_different_namespace () = + Eio.Switch.run ~name:"AwsJson11FooErrorWithDunderTypeAndDifferentNamespace" @@ fun sw -> + let module Mock = (val Http_mock.create_http_mock ()) in + let http_type = ((module Mock) : (module Smaws_Lib.Http.Client with type t = Mock.t)) in + let config = Config.dummy in + let ctx = Smaws_Lib.Context.make ~config ~http_type () in + Mock.mock_response ?body:(Some "{\n \"__type\": \"aws.different.namespace#FooError\"\n}") + ~status:500 + ~headers:[ ("Content-Type", "application/x-amz-json-1.1") ] + (); + let response = GreetingWithErrors.request ctx () in + match response with + | Error (`FooError e) -> + let expected = (() : Types.foo_error) in + check + (Alcotest_http.testable_nan_aware Types.pp_foo_error Types.equal_foo_error) + "expected error" expected e + | Error other -> failwith (GreetingWithErrors.error_to_string other) + | Ok _ -> failwith "expected an error response, got Ok" + +let aws_json11_foo_error_with_dunder_type_uri_and_namespace () = + Eio.Switch.run ~name:"AwsJson11FooErrorWithDunderTypeUriAndNamespace" @@ fun sw -> + let module Mock = (val Http_mock.create_http_mock ()) in + let http_type = ((module Mock) : (module Smaws_Lib.Http.Client with type t = Mock.t)) in + let config = Config.dummy in + let ctx = Smaws_Lib.Context.make ~config ~http_type () in + Mock.mock_response + ?body: + (Some + "{\n\ + \ \"__type\": \ + \"aws.protocoltests.json#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/\"\n\ + }") + ~status:500 + ~headers:[ ("Content-Type", "application/x-amz-json-1.1") ] + (); + let response = GreetingWithErrors.request ctx () in + match response with + | Error (`FooError e) -> + let expected = (() : Types.foo_error) in + check + (Alcotest_http.testable_nan_aware Types.pp_foo_error Types.equal_foo_error) + "expected error" expected e + | Error other -> failwith (GreetingWithErrors.error_to_string other) + | Ok _ -> failwith "expected an error response, got Ok" + +let aws_json11_foo_error_with_nested_type_property () = + Eio.Switch.run ~name:"AwsJson11FooErrorWithNestedTypeProperty" @@ fun sw -> + let module Mock = (val Http_mock.create_http_mock ()) in + let http_type = ((module Mock) : (module Smaws_Lib.Http.Client with type t = Mock.t)) in + let config = Config.dummy in + let ctx = Smaws_Lib.Context.make ~config ~http_type () in + Mock.mock_response + ?body: + (Some + "{\n\ + \ \"__type\": \"aws.protocoltests.json#FooError\",\n\ + \ \"ErrorDetails\": [\n\ + \ {\n\ + \ \"__type\": \"com.amazon.internal#ErrorDetails\",\n\ + \ \"reason\": \"Some reason\"\n\ + \ }\n\ + \ ]\n\ + }") + ~status:500 + ~headers:[ ("Content-Type", "application/x-amz-json-1.1") ] + (); + let response = GreetingWithErrors.request ctx () in + match response with + | Error (`FooError e) -> + let expected = (() : Types.foo_error) in + check + (Alcotest_http.testable_nan_aware Types.pp_foo_error Types.equal_foo_error) + "expected error" expected e + | Error other -> failwith (GreetingWithErrors.error_to_string other) + | Ok _ -> failwith "expected an error response, got Ok" + +let aws_json11_invalid_greeting_error () = + Eio.Switch.run ~name:"AwsJson11InvalidGreetingError" @@ fun sw -> + let module Mock = (val Http_mock.create_http_mock ()) in + let http_type = ((module Mock) : (module Smaws_Lib.Http.Client with type t = Mock.t)) in + let config = Config.dummy in + let ctx = Smaws_Lib.Context.make ~config ~http_type () in + Mock.mock_response + ?body:(Some "{\n \"__type\": \"InvalidGreeting\",\n \"Message\": \"Hi\"\n}") ~status:400 + ~headers:[ ("Content-Type", "application/x-amz-json-1.1") ] + (); + let response = GreetingWithErrors.request ctx () in + match response with + | Error (`InvalidGreeting e) -> + let expected = ({ message = Some "Hi" } : Types.invalid_greeting) in + check + (Alcotest_http.testable_nan_aware Types.pp_invalid_greeting Types.equal_invalid_greeting) + "expected error" expected e + | Error other -> failwith (GreetingWithErrors.error_to_string other) + | Ok _ -> failwith "expected an error response, got Ok" + let greeting_with_errors_test_suite : unit Alcotest.test = - ("aws.protocoltests.json#GreetingWithErrors", []) + ( "aws.protocoltests.json#GreetingWithErrors", + [ + ("AwsJson11ComplexError", `Quick, aws_json11_complex_error); + ("AwsJson11EmptyComplexError", `Quick, aws_json11_empty_complex_error); + ("AwsJson11FooErrorUsingXAmznErrorType", `Quick, aws_json11_foo_error_using_x_amzn_error_type); + ( "AwsJson11FooErrorUsingXAmznErrorTypeWithUri", + `Quick, + aws_json11_foo_error_using_x_amzn_error_type_with_uri ); + ( "AwsJson11FooErrorUsingXAmznErrorTypeWithUriAndNamespace", + `Quick, + aws_json11_foo_error_using_x_amzn_error_type_with_uri_and_namespace ); + ("AwsJson11FooErrorUsingCode", `Quick, aws_json11_foo_error_using_code); + ( "AwsJson11FooErrorUsingCodeAndNamespace", + `Quick, + aws_json11_foo_error_using_code_and_namespace ); + ( "AwsJson11FooErrorUsingCodeUriAndNamespace", + `Quick, + aws_json11_foo_error_using_code_uri_and_namespace ); + ("AwsJson11FooErrorWithDunderType", `Quick, aws_json11_foo_error_with_dunder_type); + ( "AwsJson11FooErrorWithDunderTypeAndNamespace", + `Quick, + aws_json11_foo_error_with_dunder_type_and_namespace ); + ( "AwsJson11FooErrorWithDunderTypeAndDifferentNamespace", + `Quick, + aws_json11_foo_error_with_dunder_type_and_different_namespace ); + ( "AwsJson11FooErrorWithDunderTypeUriAndNamespace", + `Quick, + aws_json11_foo_error_with_dunder_type_uri_and_namespace ); + ( "AwsJson11FooErrorWithNestedTypeProperty", + `Quick, + aws_json11_foo_error_with_nested_type_property ); + ("AwsJson11InvalidGreetingError", `Quick, aws_json11_invalid_greeting_error); + ] ) let aws_json11_host_with_path () = Eio.Switch.run ~name:"AwsJson11HostWithPath" @@ fun sw -> @@ -1537,7 +1883,7 @@ let serializes_long_shapes () = map_of_strings = None; map_of_maps = None; map_of_lists_of_strings = None; - long = Some 999999999999; + long = Some (Smaws_Lib.CoreTypes.Int64.of_int 999999999999); list_of_structs = None; list_of_strings = None; list_of_maps_of_strings = None; @@ -3927,7 +4273,7 @@ let parses_long_shapes () = map_of_strings = None; map_of_maps = None; map_of_lists_of_strings = None; - long = Some 1234567890123456789; + long = Some (Smaws_Lib.CoreTypes.Int64.of_int 1234567890123456789); list_of_structs = None; list_of_strings = None; list_of_maps_of_strings = None; diff --git a/model_tests/protocols/query/protocol_tests.ml b/model_tests/protocols/query/protocol_tests.ml index d981c95d..bca952de 100644 --- a/model_tests/protocols/query/protocol_tests.ml +++ b/model_tests/protocols/query/protocol_tests.ml @@ -688,7 +688,9 @@ let no_input_and_no_output_test_suite : unit Alcotest.test = [ ("QueryNoInputAndNoOutput", `Quick, query_no_input_and_no_output); ("QueryNoInputAndNoOutput", `Quick, query_no_input_and_no_output); - ("QueryNoInputAndNoOutputWithResponseMetadata", `Quick, fun () -> Alcotest.skip ()); + ( "QueryNoInputAndNoOutputWithResponseMetadata", + `Quick, + query_no_input_and_no_output_with_response_metadata ); ] ) let query_no_input_and_output () = @@ -749,6 +751,42 @@ let no_input_and_output_test_suite : unit Alcotest.test = let put_with_content_encoding_test_suite : unit Alcotest.test = ("aws.protocoltests.query#PutWithContentEncoding", []) +let query_protocol_idempotency_token_auto_fill () = + Eio.Switch.run ~name:"QueryProtocolIdempotencyTokenAutoFill" @@ fun sw -> + let module Mock = (val Http_mock.create_http_mock ()) in + let http_type = ((module Mock) : (module Smaws_Lib.Http.Client with type t = Mock.t)) in + let config = Config.dummy in + let ctx = Smaws_Lib.Context.make ~config ~http_type () in + let input : Types.query_idempotency_token_auto_fill_input = { token = None } in + Mock.mock_response ~status:200 ~headers:[] (); + let _response = + Smaws_Lib.Uuid.with_generator + (fun _ -> "00000000-0000-4000-8000-000000000000") + (fun () -> QueryIdempotencyTokenAutoFill.request ctx input) + in + let request = Mock.last_request () in + let () = + check Alcotest_http.input_body_form_testable "expected request body value" + (Some + "Action=QueryIdempotencyTokenAutoFill&Version=2020-01-08&token=00000000-0000-4000-8000-000000000000") + (request.body + |> Option.map (function + | `Form x -> Uri.encoded_of_query x + | `String x -> x + | `Compressed (x, _) -> x + | `None -> "")) + in + let () = check Alcotest_http.method_testable "expected request method" `POST request.method_ in + let () = + check Alcotest_http.uri_testable "expected request uri" (Uri.of_string "/") request.uri + in + let () = + check Alcotest_http.headers_testable "expected request headers" + [ ("Content-Type", "application/x-www-form-urlencoded") ] + request.headers + in + () + let query_protocol_idempotency_token_auto_fill_is_set () = Eio.Switch.run ~name:"QueryProtocolIdempotencyTokenAutoFillIsSet" @@ fun sw -> let module Mock = (val Http_mock.create_http_mock ()) in @@ -786,6 +824,7 @@ let query_protocol_idempotency_token_auto_fill_is_set () = let query_idempotency_token_auto_fill_test_suite : unit Alcotest.test = ( "aws.protocoltests.query#QueryIdempotencyTokenAutoFill", [ + ("QueryProtocolIdempotencyTokenAutoFill", `Quick, query_protocol_idempotency_token_auto_fill); ( "QueryProtocolIdempotencyTokenAutoFillIsSet", `Quick, query_protocol_idempotency_token_auto_fill_is_set ); @@ -2075,7 +2114,7 @@ let query_simple_scalar_properties () = ({ double_value = Some 6.5; float_value = Some 5.5; - long_value = Some 4; + long_value = Some (Smaws_Lib.CoreTypes.Int64.of_int 4); integer_value = Some 3; short_value = Some 2; byte_value = Some 1; diff --git a/model_tests/protocols/query/query_deserializers.ml b/model_tests/protocols/query/query_deserializers.ml index ba43347f..2c997b86 100644 --- a/model_tests/protocols/query/query_deserializers.ml +++ b/model_tests/protocols/query/query_deserializers.ml @@ -546,7 +546,10 @@ let simple_scalar_xml_properties_output_of_xml i = r_float_value := Some (float_of_string (Smaws_Lib.Xml.Parse.Read.element i "floatValue" ())) | "longValue" -> - r_long_value := Some (int_of_string (Smaws_Lib.Xml.Parse.Read.element i "longValue" ())) + r_long_value := + Some + (Smaws_Lib.CoreTypes.Int64.of_string + (Smaws_Lib.Xml.Parse.Read.element i "longValue" ())) | "integerValue" -> r_integer_value := Some (int_of_string (Smaws_Lib.Xml.Parse.Read.element i "integerValue" ())) diff --git a/model_tests/protocols/query/query_serializers.ml b/model_tests/protocols/query/query_serializers.ml index 4282214a..507a2c08 100644 --- a/model_tests/protocols/query/query_serializers.ml +++ b/model_tests/protocols/query/query_serializers.ml @@ -285,7 +285,7 @@ let simple_scalar_xml_properties_output_to_query path (x : simple_scalar_xml_pro (match x.long_value with | None -> [] | Some v -> - Smaws_Lib.Protocols.AwsQuery.Serialize.int_field (List.append path [ "longValue" ]) v); + Smaws_Lib.Protocols.AwsQuery.Serialize.long_field (List.append path [ "longValue" ]) v); (match x.integer_value with | None -> [] | Some v -> @@ -520,7 +520,9 @@ let query_idempotency_token_auto_fill_input_to_query path List.concat [ (match x.token with - | None -> [] + | None -> + Smaws_Lib.Protocols.AwsQuery.Serialize.string_field (List.append path [ "token" ]) + (Smaws_Lib.Uuid.generate ()) | Some v -> Smaws_Lib.Protocols.AwsQuery.Serialize.string_field (List.append path [ "token" ]) v); ] diff --git a/model_tests/protocols/shared/query_deserializers.ml b/model_tests/protocols/shared/query_deserializers.ml index c352f026..7268ba15 100644 --- a/model_tests/protocols/shared/query_deserializers.ml +++ b/model_tests/protocols/shared/query_deserializers.ml @@ -93,10 +93,14 @@ let nested_string_list_of_xml i = Smaws_Lib.Xml.Parse.Read.sequences i "member" (fun i _ -> string_list_of_xml i) () let long_set_of_xml i = - List.map (fun s -> int_of_string s) (Smaws_Lib.Xml.Parse.Read.elements i "member" ()) + List.map + (fun s -> Smaws_Lib.CoreTypes.Int64.of_string s) + (Smaws_Lib.Xml.Parse.Read.elements i "member" ()) let long_list_of_xml i = - List.map (fun s -> int_of_string s) (Smaws_Lib.Xml.Parse.Read.elements i "member" ()) + List.map + (fun s -> Smaws_Lib.CoreTypes.Int64.of_string s) + (Smaws_Lib.Xml.Parse.Read.elements i "member" ()) let list_set_of_xml i = Smaws_Lib.Xml.Parse.Read.sequences i "member" (fun i _ -> string_list_of_xml i) () diff --git a/model_tests/protocols/shared/query_serializers.ml b/model_tests/protocols/shared/query_serializers.ml index e7d6ad3b..9da797cf 100644 --- a/model_tests/protocols/shared/query_serializers.ml +++ b/model_tests/protocols/shared/query_serializers.ml @@ -84,12 +84,12 @@ let nested_string_list_to_query path xs = let long_set_to_query path xs = Smaws_Lib.Protocols.AwsQuery.Serialize.list_to_query "member" - (fun p v -> Smaws_Lib.Protocols.AwsQuery.Serialize.int_field p v) + (fun p v -> Smaws_Lib.Protocols.AwsQuery.Serialize.long_field p v) path xs let long_list_to_query path xs = Smaws_Lib.Protocols.AwsQuery.Serialize.list_to_query "member" - (fun p v -> Smaws_Lib.Protocols.AwsQuery.Serialize.int_field p v) + (fun p v -> Smaws_Lib.Protocols.AwsQuery.Serialize.long_field p v) path xs let list_set_to_query path xs = diff --git a/refactorings/awsquery_protocol_support.md b/refactorings/awsquery_protocol_support.md index b33c6c0f..f21e885d 100644 --- a/refactorings/awsquery_protocol_support.md +++ b/refactorings/awsquery_protocol_support.md @@ -56,8 +56,8 @@ tests) in `model_tests/protocols/query/`, mirroring what already exists for `aws | Phase 6 | ✅ Done | `sdkgen/gen_serialisers.ml`, `gen_deserialisers.ml`, `gen_operations.ml` wiring | | Phase 7 | ✅ Done | `sdkgen/gen_protocol_tests.ml` request + response + error-response test generation | | Phase 8 | ✅ Done | `smaws_test_support_lib/alcotest_http.ml` `input_body_form_testable` | -| Phase 9 | ✅ Done | `model_tests/protocols/query/` (73 conformance tests passing) | -| Xml.ml | ✅ Done | `Xml.Parse.Read.skip_element` / `skip_to_end` | +| Phase 9 | ✅ Done | `model_tests/protocols/query/` (74 conformance tests passing; `QueryNoInputAndNoOutputWithResponseMetadata` unskipped after adding ResponseMetadata/no-result-wrapper support) | +| Xml.ml | ✅ Done | `Xml.Parse.Read.skip_element` / `skip_to_end`; lenient namespace matching so responses without the expected xmlns still parse | --- @@ -561,13 +561,13 @@ tests should also have one (initially empty, add as needed). These are acknowledged in `sdkgen/gen_protocol_tests.ml`'s `bannedTests` and documented here for visibility: -- **Idempotency-token auto-fill** — `@idempotencyToken` members are not - auto-populated (`QueryProtocolIdempotencyTokenAutoFill` is banned). - **Request compression** — `@requestCompression` gzip is not implemented (`SDKAppliedContentEncoding_awsQuery`, `SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsQuery` are banned). -- **awsJson error-response tests** — `make_error_response_test_str` is - awsQuery-only; awsJson error fixtures would need a JSON error reader. + +Note: numeric type handling for `smithy.api#Long`, `BigInteger`, `BigDecimal`, idempotency +auto-fill, and awsJson error-response tests are tracked in the top-level `TODO.md`; they are +not AwsQuery-specific and have been addressed separately. ## What's Out of Scope (for later) diff --git a/sdkgen/gen_protocol_tests.ml b/sdkgen/gen_protocol_tests.ml index d6e84f47..ed584494 100644 --- a/sdkgen/gen_protocol_tests.ml +++ b/sdkgen/gen_protocol_tests.ml @@ -10,13 +10,34 @@ module B = Ppxlib.Ast_builder.Make (struct end) let dummy_expr = B.pexp_constant (Ppxlib.Ast.Pconst_integer ("5", None)) + +let is_idempotency_autofill_test (request_test : Trait.httpRequestTest) = + String.is_suffix request_test.id ~suffix:"IdempotencyTokenAutoFill" + && not (String.is_suffix request_test.id ~suffix:"IdempotencyTokenAutoFillIsSet") + +let deterministic_idempotency_uuid = "00000000-0000-4000-8000-000000000000" + +let wrap_operation_call_for_idempotency request_test operation_call_expr = + if not (is_idempotency_autofill_test request_test) then operation_call_expr + else + B.pexp_apply + (B.pexp_ident + (Location.mknoloc (make_lident ~names:[ "Smaws_Lib"; "Uuid"; "with_generator" ]))) + [ + ( Nolabel, + B.pexp_fun Nolabel None + (B.ppat_var (Location.mknoloc "_")) + (const_str deterministic_idempotency_uuid) ); + (Nolabel, B.pexp_fun Nolabel None (B.ppat_var (Location.mknoloc "()")) operation_call_expr); + ] + let unit_expr = B.pexp_construct (Location.mknoloc Ppxlib.(Lident "()")) None (* Protocol test ids that are known to fail against the current runtime. They are emitted as skipped (the test body calls Alcotest.skip ()) so CI - stays green; remove a case once the underlying runtime gap is fixed. *) -let is_skipped_test id = - match id with "QueryNoInputAndNoOutputWithResponseMetadata" -> true | _ -> false + stays green; remove a case once the underlying runtime gap is fixed. + Currently no tests are skipped. *) +let is_skipped_test _id = false (* fun () -> Alcotest.skip (): marks a test case as skipped. Alcotest 1.9.1 has no Skip speed variant, so skipping is done by calling skip from inside @@ -84,7 +105,26 @@ and value_mapper ~shape_resolver ~target ~value = match (shape, value) with | StringShape _, `String str -> B.pexp_constant (Ppxlib.Ast.Pconst_string (str, loc, None)) | IntegerShape _, `Int i -> B.pexp_constant (Ppxlib.Ast.Pconst_integer (Int.to_string i, None)) - | LongShape _, `Int i -> B.pexp_constant (Ppxlib.Ast.Pconst_integer (Int.to_string i, None)) + | LongShape _, `Int i -> + B.pexp_apply + (builtin_type_expr [ "Int64"; "of_int" ]) + [ (Nolabel, B.pexp_constant (Ppxlib.Ast.Pconst_integer (Int.to_string i, None))) ] + | BigIntegerShape _, `Int i -> + B.pexp_apply + (builtin_type_expr [ "BigInt"; "of_int" ]) + [ (Nolabel, B.pexp_constant (Ppxlib.Ast.Pconst_integer (Int.to_string i, None))) ] + | BigIntegerShape _, `String s -> + B.pexp_apply + (builtin_type_expr [ "BigInt"; "of_string" ]) + [ (Nolabel, B.pexp_constant (Ppxlib.Ast.Pconst_string (s, loc, None))) ] + | BigDecimalShape _, `String s -> + B.pexp_apply + (builtin_type_expr [ "BigDecimal"; "of_string" ]) + [ (Nolabel, B.pexp_constant (Ppxlib.Ast.Pconst_string (s, loc, None))) ] + | BigDecimalShape _, `Float f -> + B.pexp_apply + (builtin_type_expr [ "BigDecimal"; "of_string" ]) + [ (Nolabel, B.pexp_constant (Ppxlib.Ast.Pconst_float (Float.to_string f, None))) ] | ShortShape _, `Int i -> B.pexp_constant (Ppxlib.Ast.Pconst_integer (Int.to_string i, None)) | ByteShape _, `Int i -> B.pexp_constant (Ppxlib.Ast.Pconst_integer (Int.to_string i, None)) | BooleanShape _, `Bool b -> @@ -382,6 +422,11 @@ let make_test_str ~namespace_resolver ~shape_resolver ~input_shape ~output_shape let operation_call_expr = make_operation_call_expr ~namespace_resolver ~shape_resolver ~operation_name in + let operation_call_expr = + wrap_operation_call_for_idempotency request_test + (B.pexp_apply operation_call_expr + [ (Nolabel, exp_ident "ctx"); (Nolabel, exp_ident "input") ]) + in let request_body_test = make_request_body_test request_test.body in let error_to_string_expr = dummy_expr in let request_method_expected_expr = make_request_method_expected_expr request_test.method_ in @@ -405,7 +450,7 @@ let make_test_str ~namespace_resolver ~shape_resolver ~input_shape ~output_shape Mock.mock_response ?body:[%e response_body_expr] ~status:200 ~headers:[ ("Content-Type", "application/json") ] (); - let response = [%e operation_call_expr] ctx input in + let response = [%e operation_call_expr] in match response with | Ok resp -> let request = Mock.last_request () in @@ -579,6 +624,11 @@ let make_query_test_str ~namespace_resolver ~shape_resolver ~input_shape ~output let operation_call_expr = make_operation_call_expr ~namespace_resolver ~shape_resolver ~operation_name in + let operation_call_expr = + wrap_operation_call_for_idempotency request_test + (B.pexp_apply operation_call_expr + [ (Nolabel, exp_ident "ctx"); (Nolabel, exp_ident "input") ]) + in let request_body_test = make_query_request_body_test request_test.body in let request_method_expected_expr = make_request_method_expected_expr request_test.method_ in let request_uri_expected_expr = make_request_uri_expected_expr request_test.uri in @@ -596,7 +646,7 @@ let make_query_test_str ~namespace_resolver ~shape_resolver ~input_shape ~output let ctx = Smaws_Lib.Context.make ~config ~http_type () in let [%p input_pat] = [%e input_expr] in Mock.mock_response ~status:200 ~headers:[] (); - let _response = [%e operation_call_expr] ctx input in + let _response = [%e operation_call_expr] in let request = Mock.last_request () in let () = [%e request_body_test] in let () = @@ -621,8 +671,6 @@ let bannedTests = "SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsJson1_1"; "SDKAppliedContentEncoding_awsQuery"; "SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsQuery"; - (* idempotency token auto-fill is not yet implemented *) - "QueryProtocolIdempotencyTokenAutoFill"; ] let is_query_service (service : Shape.serviceShapeDetails option) = @@ -728,10 +776,8 @@ let generate_ml ~shape_resolver ~operation_shapes ~structure_shapes ~alias_conte let input_shape = input in let output_shape = output in let error_response_tests = - if query_protocol then - error_shape_response_tests ~query_protocol ~query_protocol_id ~shape_resolver - operationShapeDetails - else [] + error_shape_response_tests ~query_protocol ~query_protocol_id ~shape_resolver + operationShapeDetails in let request_test_functions = if query_protocol then @@ -746,10 +792,8 @@ let generate_ml ~shape_resolver ~operation_shapes ~structure_shapes ~alias_conte ~operation_name:name http_response_protocols in let error_response_test_functions = - if query_protocol then - make_error_response_test_str ~namespace_resolver ~shape_resolver ~input_shape - ~operation_name:name error_response_tests - else [] + make_error_response_test_str ~namespace_resolver ~shape_resolver ~input_shape + ~operation_name:name error_response_tests in let test_case_functions = request_test_functions @ response_test_functions @ error_response_test_functions diff --git a/sdks/acm/json_serializers.ml b/sdks/acm/json_serializers.ml index 10a0d450..ee82de5b 100644 --- a/sdks/acm/json_serializers.ml +++ b/sdks/acm/json_serializers.ml @@ -1346,8 +1346,9 @@ let create_acme_external_account_binding_request_to_yojson ("RoleArn", Some (role_arn_to_yojson x.role_arn)); ("AcmeEndpointArn", Some (acme_endpoint_arn_to_yojson x.acme_endpoint_arn)); ( "IdempotencyToken", - option_to_yojson Smaws_Lib.Smithy_api.Json_serializers.string__to_yojson x.idempotency_token - ); + Some + (Smaws_Lib.Smithy_api.Json_serializers.string__to_yojson + (Option.value x.idempotency_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ] let create_acme_endpoint_response_to_yojson (x : create_acme_endpoint_response) = @@ -1364,8 +1365,9 @@ let create_acme_endpoint_request_to_yojson (x : create_acme_endpoint_request) = ( "AuthorizationBehavior", Some (acme_authorization_behavior_to_yojson x.authorization_behavior) ); ( "IdempotencyToken", - option_to_yojson Smaws_Lib.Smithy_api.Json_serializers.string__to_yojson x.idempotency_token - ); + Some + (Smaws_Lib.Smithy_api.Json_serializers.string__to_yojson + (Option.value x.idempotency_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ] let create_acme_domain_validation_response_to_yojson (x : create_acme_domain_validation_response) = @@ -1383,8 +1385,9 @@ let create_acme_domain_validation_request_to_yojson (x : create_acme_domain_vali ("DomainName", Some (domain_name_to_yojson x.domain_name)); ("AcmeEndpointArn", Some (acme_endpoint_arn_to_yojson x.acme_endpoint_arn)); ( "IdempotencyToken", - option_to_yojson Smaws_Lib.Smithy_api.Json_serializers.string__to_yojson x.idempotency_token - ); + Some + (Smaws_Lib.Smithy_api.Json_serializers.string__to_yojson + (Option.value x.idempotency_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ] let add_tags_to_certificate_request_to_yojson (x : add_tags_to_certificate_request) = diff --git a/sdks/backup-gateway/types.ml b/sdks/backup-gateway/types.ml index 8589fbc7..003792f0 100644 --- a/sdks/backup-gateway/types.ml +++ b/sdks/backup-gateway/types.ml @@ -309,7 +309,7 @@ type nonrec put_bandwidth_rate_limit_schedule_output = { } [@@ocaml.doc ""] -type nonrec average_upload_rate_limit = int [@@ocaml.doc ""] +type nonrec average_upload_rate_limit = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec days_of_week = day_of_week list [@@ocaml.doc ""] diff --git a/sdks/backup-gateway/types.mli b/sdks/backup-gateway/types.mli index 8589fbc7..003792f0 100644 --- a/sdks/backup-gateway/types.mli +++ b/sdks/backup-gateway/types.mli @@ -309,7 +309,7 @@ type nonrec put_bandwidth_rate_limit_schedule_output = { } [@@ocaml.doc ""] -type nonrec average_upload_rate_limit = int [@@ocaml.doc ""] +type nonrec average_upload_rate_limit = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec days_of_week = day_of_week list [@@ocaml.doc ""] diff --git a/sdks/cloudtrail/types.ml b/sdks/cloudtrail/types.ml index 6ae00acf..2cd93f17 100644 --- a/sdks/cloudtrail/types.ml +++ b/sdks/cloudtrail/types.ml @@ -1219,7 +1219,7 @@ type nonrec import_status = | INITIALIZING [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec import_statistics = { failed_entries : long option; [@ocaml.doc " The number of failed entries. \n"] diff --git a/sdks/cloudtrail/types.mli b/sdks/cloudtrail/types.mli index 6ae00acf..2cd93f17 100644 --- a/sdks/cloudtrail/types.mli +++ b/sdks/cloudtrail/types.mli @@ -1219,7 +1219,7 @@ type nonrec import_status = | INITIALIZING [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec import_statistics = { failed_entries : long option; [@ocaml.doc " The number of failed entries. \n"] diff --git a/sdks/cognito-identity/types.ml b/sdks/cognito-identity/types.ml index 04e5787a..34057a78 100644 --- a/sdks/cognito-identity/types.ml +++ b/sdks/cognito-identity/types.ml @@ -195,7 +195,7 @@ type nonrec unlink_developer_identity_input = { } [@@ocaml.doc "Input to the [UnlinkDeveloperIdentity] action.\n"] -type nonrec token_duration = int [@@ocaml.doc ""] +type nonrec token_duration = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec tag_resource_response = unit [@@ocaml.doc ""] diff --git a/sdks/cognito-identity/types.mli b/sdks/cognito-identity/types.mli index 04e5787a..34057a78 100644 --- a/sdks/cognito-identity/types.mli +++ b/sdks/cognito-identity/types.mli @@ -195,7 +195,7 @@ type nonrec unlink_developer_identity_input = { } [@@ocaml.doc "Input to the [UnlinkDeveloperIdentity] action.\n"] -type nonrec token_duration = int [@@ocaml.doc ""] +type nonrec token_duration = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec tag_resource_response = unit [@@ocaml.doc ""] diff --git a/sdks/config-service/types.ml b/sdks/config-service/types.ml index ad9677b0..48b597a6 100644 --- a/sdks/config-service/types.ml +++ b/sdks/config-service/types.ml @@ -1610,7 +1610,7 @@ type nonrec execution_controls = { type nonrec auto_remediation_attempts = int [@@ocaml.doc ""] -type nonrec auto_remediation_attempt_seconds = int [@@ocaml.doc ""] +type nonrec auto_remediation_attempt_seconds = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec remediation_configuration = { created_by_service : string_with_char_limit1024 option; @@ -4458,7 +4458,7 @@ type nonrec get_organization_config_rule_detailed_status_request = { } [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec resource_count = { count : long option; [@ocaml.doc "The number of resources.\n"] diff --git a/sdks/config-service/types.mli b/sdks/config-service/types.mli index ad9677b0..48b597a6 100644 --- a/sdks/config-service/types.mli +++ b/sdks/config-service/types.mli @@ -1610,7 +1610,7 @@ type nonrec execution_controls = { type nonrec auto_remediation_attempts = int [@@ocaml.doc ""] -type nonrec auto_remediation_attempt_seconds = int [@@ocaml.doc ""] +type nonrec auto_remediation_attempt_seconds = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec remediation_configuration = { created_by_service : string_with_char_limit1024 option; @@ -4458,7 +4458,7 @@ type nonrec get_organization_config_rule_detailed_status_request = { } [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec resource_count = { count : long option; [@ocaml.doc "The number of resources.\n"] diff --git a/sdks/dynamodb-streams/types.ml b/sdks/dynamodb-streams/types.ml index 96b9a47f..45802075 100644 --- a/sdks/dynamodb-streams/types.ml +++ b/sdks/dynamodb-streams/types.ml @@ -129,7 +129,7 @@ type nonrec attribute_map = (attribute_name * attribute_value) list [@@ocaml.doc type nonrec sequence_number = string [@@ocaml.doc ""] -type nonrec positive_long_object = int [@@ocaml.doc ""] +type nonrec positive_long_object = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec stream_record = { stream_view_type : stream_view_type option; diff --git a/sdks/dynamodb-streams/types.mli b/sdks/dynamodb-streams/types.mli index 96b9a47f..45802075 100644 --- a/sdks/dynamodb-streams/types.mli +++ b/sdks/dynamodb-streams/types.mli @@ -129,7 +129,7 @@ type nonrec attribute_map = (attribute_name * attribute_value) list [@@ocaml.doc type nonrec sequence_number = string [@@ocaml.doc ""] -type nonrec positive_long_object = int [@@ocaml.doc ""] +type nonrec positive_long_object = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec stream_record = { stream_view_type : stream_view_type option; diff --git a/sdks/dynamodb/json_serializers.ml b/sdks/dynamodb/json_serializers.ml index 2ae68cea..8e308a83 100644 --- a/sdks/dynamodb/json_serializers.ml +++ b/sdks/dynamodb/json_serializers.ml @@ -1497,7 +1497,10 @@ let client_request_token_to_yojson = string_to_yojson let transact_write_items_input_to_yojson (x : transact_write_items_input) = assoc_to_yojson [ - ("ClientRequestToken", option_to_yojson client_request_token_to_yojson x.client_request_token); + ( "ClientRequestToken", + Some + (client_request_token_to_yojson + (Option.value x.client_request_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ( "ReturnItemCollectionMetrics", option_to_yojson return_item_collection_metrics_to_yojson x.return_item_collection_metrics ); @@ -2386,7 +2389,10 @@ let import_table_input_to_yojson (x : import_table_input) = ("InputFormatOptions", option_to_yojson input_format_options_to_yojson x.input_format_options); ("InputFormat", Some (input_format_to_yojson x.input_format)); ("S3BucketSource", Some (s3_bucket_source_to_yojson x.s3_bucket_source)); - ("ClientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "ClientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ] let import_conflict_exception_to_yojson (x : import_conflict_exception) = @@ -2496,7 +2502,10 @@ let export_table_to_point_in_time_input_to_yojson (x : export_table_to_point_in_ ("S3Prefix", option_to_yojson s3_prefix_to_yojson x.s3_prefix); ("S3BucketOwner", option_to_yojson s3_bucket_owner_to_yojson x.s3_bucket_owner); ("S3Bucket", Some (s3_bucket_to_yojson x.s3_bucket)); - ("ClientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "ClientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("ExportTime", option_to_yojson export_time_to_yojson x.export_time); ("TableArn", Some (table_arn_to_yojson x.table_arn)); ] @@ -2519,7 +2528,10 @@ let execute_transaction_input_to_yojson (x : execute_transaction_input) = [ ( "ReturnConsumedCapacity", option_to_yojson return_consumed_capacity_to_yojson x.return_consumed_capacity ); - ("ClientRequestToken", option_to_yojson client_request_token_to_yojson x.client_request_token); + ( "ClientRequestToken", + Some + (client_request_token_to_yojson + (Option.value x.client_request_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("TransactStatements", Some (parameterized_statements_to_yojson x.transact_statements)); ] diff --git a/sdks/dynamodb/types.ml b/sdks/dynamodb/types.ml index 73277f55..f254931d 100644 --- a/sdks/dynamodb/types.ml +++ b/sdks/dynamodb/types.ml @@ -122,7 +122,7 @@ type nonrec witness_status = | CREATING [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec long_object = int [@@ocaml.doc ""] +type nonrec long_object = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec warm_throughput = { write_units_per_second : long_object option; @@ -260,7 +260,7 @@ type nonrec index_status = | CREATING [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec positive_long_object = int [@@ocaml.doc ""] +type nonrec positive_long_object = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec boolean_object = bool [@@ocaml.doc ""] @@ -623,7 +623,7 @@ type nonrec key_schema = key_schema_element list [@@ocaml.doc ""] type nonrec date = Smaws_Lib.CoreTypes.Timestamp.t [@@ocaml.doc ""] -type nonrec non_negative_long_object = int [@@ocaml.doc ""] +type nonrec non_negative_long_object = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec provisioned_throughput_description = { write_capacity_units : non_negative_long_object option; @@ -4304,7 +4304,7 @@ type nonrec source_table_feature_details = { "Contains the details of the features enabled on the table when the backup was created. For \ example, LSIs, GSIs, streams, TTL. \n"] -type nonrec item_count = int [@@ocaml.doc ""] +type nonrec item_count = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec source_table_details = { billing_mode : billing_mode option; @@ -5656,7 +5656,7 @@ type nonrec put_item_input = { } [@@ocaml.doc "Represents the input of a [PutItem] operation.\n"] -type nonrec processed_item_count = int [@@ocaml.doc ""] +type nonrec processed_item_count = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec prepared_statement_parameters = attribute_value list [@@ocaml.doc ""] @@ -5739,7 +5739,7 @@ type nonrec parameterized_statements = parameterized_statement list [@@ocaml.doc type nonrec next_token_string = string [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec list_tags_of_resource_output = { next_token : next_token_string option; @@ -6015,7 +6015,7 @@ type nonrec backup_type = | USER [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec backup_size_bytes = int [@@ocaml.doc ""] +type nonrec backup_size_bytes = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec backup_summary = { backup_size_bytes : backup_size_bytes option; [@ocaml.doc "Size of the backup in bytes.\n"] @@ -6316,11 +6316,11 @@ type nonrec incremental_export_specification = { } [@@ocaml.doc "Optional object containing the parameters specific to an incremental export.\n"] -type nonrec imported_item_count = int [@@ocaml.doc ""] +type nonrec imported_item_count = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec client_token = string [@@ocaml.doc ""] -type nonrec error_count = int [@@ocaml.doc ""] +type nonrec error_count = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec failure_code = string [@@ocaml.doc ""] @@ -6577,7 +6577,7 @@ type nonrec export_manifest = string [@@ocaml.doc ""] type nonrec export_format = ION [@ocaml.doc ""] | DYNAMODB_JSON [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec billed_size_bytes = int [@@ocaml.doc ""] +type nonrec billed_size_bytes = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec export_description = { incremental_export_specification : incremental_export_specification option; diff --git a/sdks/dynamodb/types.mli b/sdks/dynamodb/types.mli index 73277f55..f254931d 100644 --- a/sdks/dynamodb/types.mli +++ b/sdks/dynamodb/types.mli @@ -122,7 +122,7 @@ type nonrec witness_status = | CREATING [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec long_object = int [@@ocaml.doc ""] +type nonrec long_object = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec warm_throughput = { write_units_per_second : long_object option; @@ -260,7 +260,7 @@ type nonrec index_status = | CREATING [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec positive_long_object = int [@@ocaml.doc ""] +type nonrec positive_long_object = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec boolean_object = bool [@@ocaml.doc ""] @@ -623,7 +623,7 @@ type nonrec key_schema = key_schema_element list [@@ocaml.doc ""] type nonrec date = Smaws_Lib.CoreTypes.Timestamp.t [@@ocaml.doc ""] -type nonrec non_negative_long_object = int [@@ocaml.doc ""] +type nonrec non_negative_long_object = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec provisioned_throughput_description = { write_capacity_units : non_negative_long_object option; @@ -4304,7 +4304,7 @@ type nonrec source_table_feature_details = { "Contains the details of the features enabled on the table when the backup was created. For \ example, LSIs, GSIs, streams, TTL. \n"] -type nonrec item_count = int [@@ocaml.doc ""] +type nonrec item_count = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec source_table_details = { billing_mode : billing_mode option; @@ -5656,7 +5656,7 @@ type nonrec put_item_input = { } [@@ocaml.doc "Represents the input of a [PutItem] operation.\n"] -type nonrec processed_item_count = int [@@ocaml.doc ""] +type nonrec processed_item_count = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec prepared_statement_parameters = attribute_value list [@@ocaml.doc ""] @@ -5739,7 +5739,7 @@ type nonrec parameterized_statements = parameterized_statement list [@@ocaml.doc type nonrec next_token_string = string [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec list_tags_of_resource_output = { next_token : next_token_string option; @@ -6015,7 +6015,7 @@ type nonrec backup_type = | USER [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec backup_size_bytes = int [@@ocaml.doc ""] +type nonrec backup_size_bytes = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec backup_summary = { backup_size_bytes : backup_size_bytes option; [@ocaml.doc "Size of the backup in bytes.\n"] @@ -6316,11 +6316,11 @@ type nonrec incremental_export_specification = { } [@@ocaml.doc "Optional object containing the parameters specific to an incremental export.\n"] -type nonrec imported_item_count = int [@@ocaml.doc ""] +type nonrec imported_item_count = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec client_token = string [@@ocaml.doc ""] -type nonrec error_count = int [@@ocaml.doc ""] +type nonrec error_count = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec failure_code = string [@@ocaml.doc ""] @@ -6577,7 +6577,7 @@ type nonrec export_manifest = string [@@ocaml.doc ""] type nonrec export_format = ION [@ocaml.doc ""] | DYNAMODB_JSON [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec billed_size_bytes = int [@@ocaml.doc ""] +type nonrec billed_size_bytes = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec export_description = { incremental_export_specification : incremental_export_specification option; diff --git a/sdks/eventbridge/types.ml b/sdks/eventbridge/types.ml index 0a4381e1..7e53a074 100644 --- a/sdks/eventbridge/types.ml +++ b/sdks/eventbridge/types.ml @@ -2074,7 +2074,7 @@ type nonrec partner_event_source_account_list = partner_event_source_account lis type nonrec next_token = string [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec list_targets_by_rule_response = { next_token : next_token option; diff --git a/sdks/eventbridge/types.mli b/sdks/eventbridge/types.mli index 0a4381e1..7e53a074 100644 --- a/sdks/eventbridge/types.mli +++ b/sdks/eventbridge/types.mli @@ -2074,7 +2074,7 @@ type nonrec partner_event_source_account_list = partner_event_source_account lis type nonrec next_token = string [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec list_targets_by_rule_response = { next_token : next_token option; diff --git a/sdks/fms/types.ml b/sdks/fms/types.ml index 8f8fa619..8769e37d 100644 --- a/sdks/fms/types.ml +++ b/sdks/fms/types.ml @@ -93,7 +93,7 @@ type nonrec remediation_action_description = string [@@ocaml.doc ""] type nonrec cid_r = string [@@ocaml.doc ""] -type nonrec ip_port_number = int [@@ocaml.doc ""] +type nonrec ip_port_number = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec security_group_rule_description = { to_port : ip_port_number option; @@ -1947,7 +1947,7 @@ type nonrec resource_list = resource list [@@ocaml.doc ""] type nonrec resource_description = string [@@ocaml.doc ""] -type nonrec resource_count = int [@@ocaml.doc ""] +type nonrec resource_count = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec aws_region = string [@@ocaml.doc ""] diff --git a/sdks/fms/types.mli b/sdks/fms/types.mli index 8f8fa619..8769e37d 100644 --- a/sdks/fms/types.mli +++ b/sdks/fms/types.mli @@ -93,7 +93,7 @@ type nonrec remediation_action_description = string [@@ocaml.doc ""] type nonrec cid_r = string [@@ocaml.doc ""] -type nonrec ip_port_number = int [@@ocaml.doc ""] +type nonrec ip_port_number = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec security_group_rule_description = { to_port : ip_port_number option; @@ -1947,7 +1947,7 @@ type nonrec resource_list = resource list [@@ocaml.doc ""] type nonrec resource_description = string [@@ocaml.doc ""] -type nonrec resource_count = int [@@ocaml.doc ""] +type nonrec resource_count = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec aws_region = string [@@ocaml.doc ""] diff --git a/sdks/kendra/json_serializers.ml b/sdks/kendra/json_serializers.ml index 8ba6d3fe..5287f518 100644 --- a/sdks/kendra/json_serializers.ml +++ b/sdks/kendra/json_serializers.ml @@ -3259,7 +3259,10 @@ let client_token_name_to_yojson = string_to_yojson let create_thesaurus_request_to_yojson (x : create_thesaurus_request) = assoc_to_yojson [ - ("ClientToken", option_to_yojson client_token_name_to_yojson x.client_token); + ( "ClientToken", + Some + (client_token_name_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("SourceS3Path", Some (s3_path_to_yojson x.source_s3_path)); ("Tags", option_to_yojson tag_list_to_yojson x.tags); ("RoleArn", Some (role_arn_to_yojson x.role_arn)); @@ -3278,7 +3281,10 @@ let create_query_suggestions_block_list_request_to_yojson [ ("Tags", option_to_yojson tag_list_to_yojson x.tags); ("RoleArn", Some (role_arn_to_yojson x.role_arn)); - ("ClientToken", option_to_yojson client_token_name_to_yojson x.client_token); + ( "ClientToken", + Some + (client_token_name_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("SourceS3Path", Some (s3_path_to_yojson x.source_s3_path)); ("Description", option_to_yojson description_to_yojson x.description); ("Name", Some (query_suggestions_block_list_name_to_yojson x.name)); @@ -3298,7 +3304,10 @@ let create_index_request_to_yojson (x : create_index_request) = ( "UserTokenConfigurations", option_to_yojson user_token_configuration_list_to_yojson x.user_token_configurations ); ("Tags", option_to_yojson tag_list_to_yojson x.tags); - ("ClientToken", option_to_yojson client_token_name_to_yojson x.client_token); + ( "ClientToken", + Some + (client_token_name_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("Description", option_to_yojson description_to_yojson x.description); ( "ServerSideEncryptionConfiguration", option_to_yojson server_side_encryption_configuration_to_yojson @@ -3335,7 +3344,10 @@ let create_faq_request_to_yojson (x : create_faq_request) = assoc_to_yojson [ ("LanguageCode", option_to_yojson language_code_to_yojson x.language_code); - ("ClientToken", option_to_yojson client_token_name_to_yojson x.client_token); + ( "ClientToken", + Some + (client_token_name_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("FileFormat", option_to_yojson faq_file_format_to_yojson x.file_format); ("Tags", option_to_yojson tag_list_to_yojson x.tags); ("RoleArn", Some (role_arn_to_yojson x.role_arn)); @@ -3351,7 +3363,10 @@ let create_experience_response_to_yojson (x : create_experience_response) = let create_experience_request_to_yojson (x : create_experience_request) = assoc_to_yojson [ - ("ClientToken", option_to_yojson client_token_name_to_yojson x.client_token); + ( "ClientToken", + Some + (client_token_name_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("Description", option_to_yojson description_to_yojson x.description); ("Configuration", option_to_yojson experience_configuration_to_yojson x.configuration); ("RoleArn", option_to_yojson role_arn_to_yojson x.role_arn); @@ -3369,7 +3384,10 @@ let create_data_source_request_to_yojson (x : create_data_source_request) = option_to_yojson custom_document_enrichment_configuration_to_yojson x.custom_document_enrichment_configuration ); ("LanguageCode", option_to_yojson language_code_to_yojson x.language_code); - ("ClientToken", option_to_yojson client_token_name_to_yojson x.client_token); + ( "ClientToken", + Some + (client_token_name_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("Tags", option_to_yojson tag_list_to_yojson x.tags); ("RoleArn", option_to_yojson role_arn_to_yojson x.role_arn); ("Schedule", option_to_yojson scan_schedule_to_yojson x.schedule); @@ -3390,7 +3408,10 @@ let create_access_control_configuration_request_to_yojson (x : create_access_control_configuration_request) = assoc_to_yojson [ - ("ClientToken", option_to_yojson client_token_name_to_yojson x.client_token); + ( "ClientToken", + Some + (client_token_name_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ( "HierarchicalAccessControlList", option_to_yojson hierarchical_principal_list_to_yojson x.hierarchical_access_control_list ); ("AccessControlList", option_to_yojson principal_list_to_yojson x.access_control_list); diff --git a/sdks/kendra/types.ml b/sdks/kendra/types.ml index b30eb9d0..fe6b4ea3 100644 --- a/sdks/kendra/types.ml +++ b/sdks/kendra/types.ml @@ -979,7 +979,7 @@ type nonrec featured_document = { type nonrec featured_document_list = featured_document list [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec featured_results_set = { creation_timestamp : long option; @@ -3672,7 +3672,7 @@ type nonrec text_with_highlights = { type nonrec indexed_text_documents_count = int [@@ocaml.doc ""] -type nonrec indexed_text_bytes = int [@@ocaml.doc ""] +type nonrec indexed_text_bytes = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec text_document_statistics = { indexed_text_bytes : indexed_text_bytes; @@ -4774,7 +4774,7 @@ type nonrec group_members = { "A list of users that belong to a group. This is useful for user context filtering, where search \ results are filtered based on the user or their group access to documents.\n"] -type nonrec principal_ordering_id = int [@@ocaml.doc ""] +type nonrec principal_ordering_id = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec put_principal_mapping_request = { role_arn : role_arn option; diff --git a/sdks/kendra/types.mli b/sdks/kendra/types.mli index b30eb9d0..fe6b4ea3 100644 --- a/sdks/kendra/types.mli +++ b/sdks/kendra/types.mli @@ -979,7 +979,7 @@ type nonrec featured_document = { type nonrec featured_document_list = featured_document list [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec featured_results_set = { creation_timestamp : long option; @@ -3672,7 +3672,7 @@ type nonrec text_with_highlights = { type nonrec indexed_text_documents_count = int [@@ocaml.doc ""] -type nonrec indexed_text_bytes = int [@@ocaml.doc ""] +type nonrec indexed_text_bytes = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec text_document_statistics = { indexed_text_bytes : indexed_text_bytes; @@ -4774,7 +4774,7 @@ type nonrec group_members = { "A list of users that belong to a group. This is useful for user context filtering, where search \ results are filtered based on the user or their group access to documents.\n"] -type nonrec principal_ordering_id = int [@@ocaml.doc ""] +type nonrec principal_ordering_id = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec put_principal_mapping_request = { role_arn : role_arn option; diff --git a/sdks/keyspaces/types.ml b/sdks/keyspaces/types.ml index 44eb0258..73764e0e 100644 --- a/sdks/keyspaces/types.ml +++ b/sdks/keyspaces/types.ml @@ -85,7 +85,7 @@ type nonrec column_definition_list = column_definition list [@@ocaml.doc ""] type nonrec throughput_mode = PAY_PER_REQUEST [@ocaml.doc ""] | PROVISIONED [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec capacity_units = int [@@ocaml.doc ""] +type nonrec capacity_units = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec capacity_specification = { write_capacity_units : capacity_units option; diff --git a/sdks/keyspaces/types.mli b/sdks/keyspaces/types.mli index 44eb0258..73764e0e 100644 --- a/sdks/keyspaces/types.mli +++ b/sdks/keyspaces/types.mli @@ -85,7 +85,7 @@ type nonrec column_definition_list = column_definition list [@@ocaml.doc ""] type nonrec throughput_mode = PAY_PER_REQUEST [@ocaml.doc ""] | PROVISIONED [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec capacity_units = int [@@ocaml.doc ""] +type nonrec capacity_units = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec capacity_specification = { write_capacity_units : capacity_units option; diff --git a/sdks/kinesis-analytics-v2/types.ml b/sdks/kinesis-analytics-v2/types.ml index 1bab2267..79c3a711 100644 --- a/sdks/kinesis-analytics-v2/types.ml +++ b/sdks/kinesis-analytics-v2/types.ml @@ -368,7 +368,7 @@ type nonrec application_status = | DELETING [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec application_version_id = int [@@ocaml.doc ""] +type nonrec application_version_id = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec timestamp = Smaws_Lib.CoreTypes.Timestamp.t [@@ocaml.doc ""] @@ -777,7 +777,7 @@ type nonrec text_content = string [@@ocaml.doc ""] type nonrec code_m_d5 = string [@@ocaml.doc ""] -type nonrec code_size = int [@@ocaml.doc ""] +type nonrec code_size = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec s3_application_code_location_description = { object_version : object_version option; @@ -865,9 +865,9 @@ type nonrec run_configuration_description = { type nonrec configuration_type = CUSTOM [@ocaml.doc ""] | DEFAULT [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec checkpoint_interval = int [@@ocaml.doc ""] +type nonrec checkpoint_interval = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] -type nonrec min_pause_between_checkpoints = int [@@ocaml.doc ""] +type nonrec min_pause_between_checkpoints = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec checkpoint_configuration_description = { min_pause_between_checkpoints : min_pause_between_checkpoints option; @@ -2087,7 +2087,7 @@ type nonrec snapshot_details = { type nonrec snapshot_summaries = snapshot_details list [@@ocaml.doc ""] -type nonrec session_expiration_duration_in_seconds = int [@@ocaml.doc ""] +type nonrec session_expiration_duration_in_seconds = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec service_unavailable_exception = { message : error_message option [@ocaml.doc ""] } [@@ocaml.doc "The service cannot complete the request.\n"] diff --git a/sdks/kinesis-analytics-v2/types.mli b/sdks/kinesis-analytics-v2/types.mli index 1bab2267..79c3a711 100644 --- a/sdks/kinesis-analytics-v2/types.mli +++ b/sdks/kinesis-analytics-v2/types.mli @@ -368,7 +368,7 @@ type nonrec application_status = | DELETING [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec application_version_id = int [@@ocaml.doc ""] +type nonrec application_version_id = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec timestamp = Smaws_Lib.CoreTypes.Timestamp.t [@@ocaml.doc ""] @@ -777,7 +777,7 @@ type nonrec text_content = string [@@ocaml.doc ""] type nonrec code_m_d5 = string [@@ocaml.doc ""] -type nonrec code_size = int [@@ocaml.doc ""] +type nonrec code_size = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec s3_application_code_location_description = { object_version : object_version option; @@ -865,9 +865,9 @@ type nonrec run_configuration_description = { type nonrec configuration_type = CUSTOM [@ocaml.doc ""] | DEFAULT [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec checkpoint_interval = int [@@ocaml.doc ""] +type nonrec checkpoint_interval = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] -type nonrec min_pause_between_checkpoints = int [@@ocaml.doc ""] +type nonrec min_pause_between_checkpoints = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec checkpoint_configuration_description = { min_pause_between_checkpoints : min_pause_between_checkpoints option; @@ -2087,7 +2087,7 @@ type nonrec snapshot_details = { type nonrec snapshot_summaries = snapshot_details list [@@ocaml.doc ""] -type nonrec session_expiration_duration_in_seconds = int [@@ocaml.doc ""] +type nonrec session_expiration_duration_in_seconds = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec service_unavailable_exception = { message : error_message option [@ocaml.doc ""] } [@@ocaml.doc "The service cannot complete the request.\n"] diff --git a/sdks/kinesis-analytics/types.ml b/sdks/kinesis-analytics/types.ml index 6d12ce7f..694767b6 100644 --- a/sdks/kinesis-analytics/types.ml +++ b/sdks/kinesis-analytics/types.ml @@ -2,7 +2,7 @@ type nonrec update_application_response = unit [@@ocaml.doc ""] type nonrec application_name = string [@@ocaml.doc ""] -type nonrec application_version_id = int [@@ocaml.doc ""] +type nonrec application_version_id = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec id = string [@@ocaml.doc ""] diff --git a/sdks/kinesis-analytics/types.mli b/sdks/kinesis-analytics/types.mli index 6d12ce7f..694767b6 100644 --- a/sdks/kinesis-analytics/types.mli +++ b/sdks/kinesis-analytics/types.mli @@ -2,7 +2,7 @@ type nonrec update_application_response = unit [@@ocaml.doc ""] type nonrec application_name = string [@@ocaml.doc ""] -type nonrec application_version_id = int [@@ocaml.doc ""] +type nonrec application_version_id = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec id = string [@@ocaml.doc ""] diff --git a/sdks/kinesis/types.ml b/sdks/kinesis/types.ml index 24f914f5..049996c0 100644 --- a/sdks/kinesis/types.ml +++ b/sdks/kinesis/types.ml @@ -329,7 +329,7 @@ type nonrec record = { type nonrec record_list = record list [@@ocaml.doc ""] -type nonrec millis_behind_latest = int [@@ocaml.doc ""] +type nonrec millis_behind_latest = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec shard_id = string [@@ocaml.doc ""] diff --git a/sdks/kinesis/types.mli b/sdks/kinesis/types.mli index 24f914f5..049996c0 100644 --- a/sdks/kinesis/types.mli +++ b/sdks/kinesis/types.mli @@ -329,7 +329,7 @@ type nonrec record = { type nonrec record_list = record list [@@ocaml.doc ""] -type nonrec millis_behind_latest = int [@@ocaml.doc ""] +type nonrec millis_behind_latest = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec shard_id = string [@@ocaml.doc ""] diff --git a/sdks/lightsail/types.ml b/sdks/lightsail/types.ml index b6a269fc..f9d377cc 100644 --- a/sdks/lightsail/types.ml +++ b/sdks/lightsail/types.ml @@ -125,7 +125,7 @@ type nonrec setup_history = { type nonrec setup_history_list = setup_history list [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec integer = int [@@ocaml.doc ""] diff --git a/sdks/lightsail/types.mli b/sdks/lightsail/types.mli index b6a269fc..f9d377cc 100644 --- a/sdks/lightsail/types.mli +++ b/sdks/lightsail/types.mli @@ -125,7 +125,7 @@ type nonrec setup_history = { type nonrec setup_history_list = setup_history list [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec integer = int [@@ocaml.doc ""] diff --git a/sdks/marketplace-agreement/json_serializers.ml b/sdks/marketplace-agreement/json_serializers.ml index 6e79bde5..9ed7c48c 100644 --- a/sdks/marketplace-agreement/json_serializers.ml +++ b/sdks/marketplace-agreement/json_serializers.ml @@ -348,7 +348,10 @@ let send_agreement_payment_request_input_to_yojson (x : send_agreement_payment_r ("name", Some (payment_request_name_to_yojson x.name)); ("termId", Some (term_id_to_yojson x.term_id)); ("agreementId", Some (agreement_id_to_yojson x.agreement_id)); - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ] let agreement_cancellation_request_id_to_yojson = string_to_yojson @@ -398,7 +401,10 @@ let send_agreement_cancellation_request_input_to_yojson [ ( "description", option_to_yojson agreement_cancellation_request_description_to_yojson x.description ); - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("reasonCode", Some (agreement_cancellation_request_reason_code_to_yojson x.reason_code)); ("agreementId", Some (agreement_id_to_yojson x.agreement_id)); ] @@ -1284,7 +1290,10 @@ let create_agreement_request_input_to_yojson (x : create_agreement_request_input option_to_yojson resource_id_to_yojson x.source_agreement_identifier ); ("requestedTerms", Some (requested_term_list_to_yojson x.requested_terms)); ("intent", Some (intent_to_yojson x.intent)); - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ] let cancel_agreement_payment_request_output_to_yojson (x : cancel_agreement_payment_request_output) diff --git a/sdks/marketplace-agreement/types.ml b/sdks/marketplace-agreement/types.ml index a758c16e..0e0f3931 100644 --- a/sdks/marketplace-agreement/types.ml +++ b/sdks/marketplace-agreement/types.ml @@ -215,7 +215,7 @@ type nonrec update_purchase_orders_output = unit [@@ocaml.doc ""] type nonrec resource_id = string [@@ocaml.doc ""] -type nonrec charge_revision = int [@@ocaml.doc ""] +type nonrec charge_revision = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec purchase_order_reference = string [@@ocaml.doc ""] diff --git a/sdks/marketplace-agreement/types.mli b/sdks/marketplace-agreement/types.mli index a758c16e..0e0f3931 100644 --- a/sdks/marketplace-agreement/types.mli +++ b/sdks/marketplace-agreement/types.mli @@ -215,7 +215,7 @@ type nonrec update_purchase_orders_output = unit [@@ocaml.doc ""] type nonrec resource_id = string [@@ocaml.doc ""] -type nonrec charge_revision = int [@@ocaml.doc ""] +type nonrec charge_revision = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec purchase_order_reference = string [@@ocaml.doc ""] diff --git a/sdks/opensearchserverless/json_serializers.ml b/sdks/opensearchserverless/json_serializers.ml index d4eec4fa..ffa342aa 100644 --- a/sdks/opensearchserverless/json_serializers.ml +++ b/sdks/opensearchserverless/json_serializers.ml @@ -114,7 +114,10 @@ let client_token_to_yojson = string_to_yojson let update_vpc_endpoint_request_to_yojson (x : update_vpc_endpoint_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ( "removeSecurityGroupIds", option_to_yojson security_group_ids_to_yojson x.remove_security_group_ids ); ("addSecurityGroupIds", option_to_yojson security_group_ids_to_yojson x.add_security_group_ids); @@ -169,7 +172,10 @@ let policy_document_to_yojson = string_to_yojson let update_security_policy_request_to_yojson (x : update_security_policy_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("policy", option_to_yojson policy_document_to_yojson x.policy); ("description", option_to_yojson policy_description_to_yojson x.description); ("policyVersion", Some (policy_version_to_yojson x.policy_version)); @@ -297,7 +303,10 @@ let update_iam_identity_center_config_options_to_yojson let update_security_config_request_to_yojson (x : update_security_config_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ( "iamFederationOptions", option_to_yojson iam_federation_config_options_to_yojson x.iam_federation_options ); ( "iamIdentityCenterOptionsUpdates", @@ -337,7 +346,10 @@ let update_lifecycle_policy_response_to_yojson (x : update_lifecycle_policy_resp let update_lifecycle_policy_request_to_yojson (x : update_lifecycle_policy_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("policy", option_to_yojson policy_document_to_yojson x.policy); ("description", option_to_yojson policy_description_to_yojson x.description); ("policyVersion", Some (policy_version_to_yojson x.policy_version)); @@ -407,7 +419,10 @@ let update_collection_response_to_yojson (x : update_collection_response) = let update_collection_request_to_yojson (x : update_collection_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("deletionProtection", option_to_yojson deletion_protection_to_yojson x.deletion_protection); ("vectorOptions", option_to_yojson vector_options_to_yojson x.vector_options); ( "description", @@ -471,7 +486,10 @@ let update_collection_group_response_to_yojson (x : update_collection_group_resp let update_collection_group_request_to_yojson (x : update_collection_group_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ( "capacityLimits", option_to_yojson collection_group_capacity_limits_to_yojson x.capacity_limits ); ( "description", @@ -532,7 +550,10 @@ let update_access_policy_response_to_yojson (x : update_access_policy_response) let update_access_policy_request_to_yojson (x : update_access_policy_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("policy", option_to_yojson policy_document_to_yojson x.policy); ("description", option_to_yojson policy_description_to_yojson x.description); ("policyVersion", Some (policy_version_to_yojson x.policy_version)); @@ -680,7 +701,10 @@ let create_security_policy_response_to_yojson (x : create_security_policy_respon let create_security_policy_request_to_yojson (x : create_security_policy_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("policy", Some (policy_document_to_yojson x.policy)); ("description", option_to_yojson policy_description_to_yojson x.description); ("name", Some (policy_name_to_yojson x.name)); @@ -697,7 +721,10 @@ let create_lifecycle_policy_response_to_yojson (x : create_lifecycle_policy_resp let create_lifecycle_policy_request_to_yojson (x : create_lifecycle_policy_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("policy", Some (policy_document_to_yojson x.policy)); ("description", option_to_yojson policy_description_to_yojson x.description); ("name", Some (policy_name_to_yojson x.name)); @@ -1267,7 +1294,10 @@ let delete_vpc_endpoint_response_to_yojson (x : delete_vpc_endpoint_response) = let delete_vpc_endpoint_request_to_yojson (x : delete_vpc_endpoint_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("id", Some (vpc_endpoint_id_to_yojson x.id)); ] @@ -1276,7 +1306,10 @@ let delete_security_policy_response_to_yojson = unit_to_yojson let delete_security_policy_request_to_yojson (x : delete_security_policy_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("name", Some (policy_name_to_yojson x.name)); ("type", Some (security_policy_type_to_yojson x.type_)); ] @@ -1286,7 +1319,10 @@ let delete_security_config_response_to_yojson = unit_to_yojson let delete_security_config_request_to_yojson (x : delete_security_config_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("id", Some (security_config_id_to_yojson x.id)); ] @@ -1295,7 +1331,10 @@ let delete_lifecycle_policy_response_to_yojson = unit_to_yojson let delete_lifecycle_policy_request_to_yojson (x : delete_lifecycle_policy_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("name", Some (policy_name_to_yojson x.name)); ("type", Some (lifecycle_policy_type_to_yojson x.type_)); ] @@ -1328,7 +1367,10 @@ let delete_collection_response_to_yojson (x : delete_collection_response) = let delete_collection_request_to_yojson (x : delete_collection_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("id", Some (collection_id_to_yojson x.id)); ] @@ -1337,7 +1379,10 @@ let delete_collection_group_response_to_yojson = unit_to_yojson let delete_collection_group_request_to_yojson (x : delete_collection_group_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("id", Some (collection_group_id_to_yojson x.id)); ] @@ -1346,7 +1391,10 @@ let delete_access_policy_response_to_yojson = unit_to_yojson let delete_access_policy_request_to_yojson (x : delete_access_policy_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("name", Some (policy_name_to_yojson x.name)); ("type", Some (access_policy_type_to_yojson x.type_)); ] @@ -1369,7 +1417,10 @@ let create_vpc_endpoint_response_to_yojson (x : create_vpc_endpoint_response) = let create_vpc_endpoint_request_to_yojson (x : create_vpc_endpoint_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("securityGroupIds", option_to_yojson security_group_ids_to_yojson x.security_group_ids); ("subnetIds", Some (subnet_ids_to_yojson x.subnet_ids)); ("vpcId", Some (vpc_id_to_yojson x.vpc_id)); @@ -1399,7 +1450,10 @@ let create_iam_identity_center_config_options_to_yojson let create_security_config_request_to_yojson (x : create_security_config_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ( "iamFederationOptions", option_to_yojson iam_federation_config_options_to_yojson x.iam_federation_options ); ( "iamIdentityCenterOptions", @@ -1455,7 +1509,10 @@ let create_collection_response_to_yojson (x : create_collection_response) = let create_collection_request_to_yojson (x : create_collection_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("deletionProtection", option_to_yojson deletion_protection_to_yojson x.deletion_protection); ("encryptionConfig", option_to_yojson encryption_config_to_yojson x.encryption_config); ( "collectionGroupName", @@ -1497,7 +1554,10 @@ let create_collection_group_response_to_yojson (x : create_collection_group_resp let create_collection_group_request_to_yojson (x : create_collection_group_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("generation", option_to_yojson serverless_generation_to_yojson x.generation); ( "capacityLimits", option_to_yojson collection_group_capacity_limits_to_yojson x.capacity_limits ); @@ -1517,7 +1577,10 @@ let create_access_policy_response_to_yojson (x : create_access_policy_response) let create_access_policy_request_to_yojson (x : create_access_policy_request) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("policy", Some (policy_document_to_yojson x.policy)); ("description", option_to_yojson policy_description_to_yojson x.description); ("name", Some (policy_name_to_yojson x.name)); diff --git a/sdks/proton/json_serializers.ml b/sdks/proton/json_serializers.ml index 76c75488..fc748d4c 100644 --- a/sdks/proton/json_serializers.ml +++ b/sdks/proton/json_serializers.ml @@ -426,7 +426,10 @@ let client_token_to_yojson = string_to_yojson let update_service_instance_input_to_yojson (x : update_service_instance_input) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ( "templateMinorVersion", option_to_yojson template_version_part_to_yojson x.template_minor_version ); ( "templateMajorVersion", @@ -710,7 +713,10 @@ let template_file_contents_to_yojson = string_to_yojson let update_component_input_to_yojson (x : update_component_input) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("templateFile", option_to_yojson template_file_contents_to_yojson x.template_file); ("serviceSpec", option_to_yojson spec_contents_to_yojson x.service_spec); ( "serviceInstanceName", @@ -2128,7 +2134,10 @@ let create_service_template_version_input_to_yojson (x : create_service_template ("majorVersion", option_to_yojson template_version_part_to_yojson x.major_version); ("description", option_to_yojson description_to_yojson x.description); ("templateName", Some (resource_name_to_yojson x.template_name)); - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ] let create_service_template_output_to_yojson (x : create_service_template_output) = @@ -2168,7 +2177,10 @@ let create_service_instance_output_to_yojson (x : create_service_instance_output let create_service_instance_input_to_yojson (x : create_service_instance_input) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("tags", option_to_yojson tag_list_to_yojson x.tags); ( "templateMinorVersion", option_to_yojson template_version_part_to_yojson x.template_minor_version ); @@ -2225,7 +2237,10 @@ let create_environment_template_version_input_to_yojson ("majorVersion", option_to_yojson template_version_part_to_yojson x.major_version); ("description", option_to_yojson description_to_yojson x.description); ("templateName", Some (resource_name_to_yojson x.template_name)); - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ] let create_environment_template_output_to_yojson (x : create_environment_template_output) = @@ -2285,7 +2300,10 @@ let create_environment_account_connection_input_to_yojson ("environmentName", Some (resource_name_to_yojson x.environment_name)); ("roleArn", option_to_yojson role_arn_to_yojson x.role_arn); ("managementAccountId", Some (aws_account_id_to_yojson x.management_account_id)); - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ] let create_component_output_to_yojson (x : create_component_output) = @@ -2294,7 +2312,10 @@ let create_component_output_to_yojson (x : create_component_output) = let create_component_input_to_yojson (x : create_component_input) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("tags", option_to_yojson tag_list_to_yojson x.tags); ("serviceSpec", option_to_yojson spec_contents_to_yojson x.service_spec); ("manifest", Some (template_manifest_contents_to_yojson x.manifest)); diff --git a/sdks/resource-groups-tagging-api/types.ml b/sdks/resource-groups-tagging-api/types.ml index 1a3263cb..ad8cbbc5 100644 --- a/sdks/resource-groups-tagging-api/types.ml +++ b/sdks/resource-groups-tagging-api/types.ml @@ -210,7 +210,7 @@ type nonrec region = string [@@ocaml.doc ""] type nonrec amazon_resource_type = string [@@ocaml.doc ""] -type nonrec non_compliant_resources = int [@@ocaml.doc ""] +type nonrec non_compliant_resources = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec summary = { non_compliant_resources : non_compliant_resources option; diff --git a/sdks/resource-groups-tagging-api/types.mli b/sdks/resource-groups-tagging-api/types.mli index 1a3263cb..ad8cbbc5 100644 --- a/sdks/resource-groups-tagging-api/types.mli +++ b/sdks/resource-groups-tagging-api/types.mli @@ -210,7 +210,7 @@ type nonrec region = string [@@ocaml.doc ""] type nonrec amazon_resource_type = string [@@ocaml.doc ""] -type nonrec non_compliant_resources = int [@@ocaml.doc ""] +type nonrec non_compliant_resources = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec summary = { non_compliant_resources : non_compliant_resources option; diff --git a/sdks/servicediscovery/json_serializers.ml b/sdks/servicediscovery/json_serializers.ml index 28fb3edb..c76393f2 100644 --- a/sdks/servicediscovery/json_serializers.ml +++ b/sdks/servicediscovery/json_serializers.ml @@ -112,7 +112,10 @@ let update_public_dns_namespace_request_to_yojson (x : update_public_dns_namespa assoc_to_yojson [ ("Namespace", Some (public_dns_namespace_change_to_yojson x.namespace)); - ("UpdaterRequestId", option_to_yojson resource_id_to_yojson x.updater_request_id); + ( "UpdaterRequestId", + Some + (resource_id_to_yojson + (Option.value x.updater_request_id ~default:(Smaws_Lib.Uuid.generate ()))) ); ("Id", Some (arn_to_yojson x.id)); ] @@ -144,7 +147,10 @@ let update_private_dns_namespace_request_to_yojson (x : update_private_dns_names assoc_to_yojson [ ("Namespace", Some (private_dns_namespace_change_to_yojson x.namespace)); - ("UpdaterRequestId", option_to_yojson resource_id_to_yojson x.updater_request_id); + ( "UpdaterRequestId", + Some + (resource_id_to_yojson + (Option.value x.updater_request_id ~default:(Smaws_Lib.Uuid.generate ()))) ); ("Id", Some (arn_to_yojson x.id)); ] @@ -176,7 +182,10 @@ let update_http_namespace_request_to_yojson (x : update_http_namespace_request) assoc_to_yojson [ ("Namespace", Some (http_namespace_change_to_yojson x.namespace)); - ("UpdaterRequestId", option_to_yojson resource_id_to_yojson x.updater_request_id); + ( "UpdaterRequestId", + Some + (resource_id_to_yojson + (Option.value x.updater_request_id ~default:(Smaws_Lib.Uuid.generate ()))) ); ("Id", Some (arn_to_yojson x.id)); ] @@ -342,7 +351,10 @@ let register_instance_request_to_yojson (x : register_instance_request) = assoc_to_yojson [ ("Attributes", Some (attributes_to_yojson x.attributes)); - ("CreatorRequestId", option_to_yojson resource_id_to_yojson x.creator_request_id); + ( "CreatorRequestId", + Some + (resource_id_to_yojson + (Option.value x.creator_request_id ~default:(Smaws_Lib.Uuid.generate ()))) ); ("InstanceId", Some (instance_id_to_yojson x.instance_id)); ("ServiceId", Some (arn_to_yojson x.service_id)); ] @@ -754,7 +766,10 @@ let create_service_request_to_yojson (x : create_service_request) = ("HealthCheckConfig", option_to_yojson health_check_config_to_yojson x.health_check_config); ("DnsConfig", option_to_yojson dns_config_to_yojson x.dns_config); ("Description", option_to_yojson resource_description_to_yojson x.description); - ("CreatorRequestId", option_to_yojson resource_id_to_yojson x.creator_request_id); + ( "CreatorRequestId", + Some + (resource_id_to_yojson + (Option.value x.creator_request_id ~default:(Smaws_Lib.Uuid.generate ()))) ); ("NamespaceId", option_to_yojson arn_to_yojson x.namespace_id); ("Name", Some (service_name_to_yojson x.name)); ] @@ -785,7 +800,10 @@ let create_public_dns_namespace_request_to_yojson (x : create_public_dns_namespa ("Properties", option_to_yojson public_dns_namespace_properties_to_yojson x.properties); ("Tags", option_to_yojson tag_list_to_yojson x.tags); ("Description", option_to_yojson resource_description_to_yojson x.description); - ("CreatorRequestId", option_to_yojson resource_id_to_yojson x.creator_request_id); + ( "CreatorRequestId", + Some + (resource_id_to_yojson + (Option.value x.creator_request_id ~default:(Smaws_Lib.Uuid.generate ()))) ); ("Name", Some (namespace_name_public_to_yojson x.name)); ] @@ -808,7 +826,10 @@ let create_private_dns_namespace_request_to_yojson (x : create_private_dns_names ("Tags", option_to_yojson tag_list_to_yojson x.tags); ("Vpc", Some (resource_id_to_yojson x.vpc)); ("Description", option_to_yojson resource_description_to_yojson x.description); - ("CreatorRequestId", option_to_yojson resource_id_to_yojson x.creator_request_id); + ( "CreatorRequestId", + Some + (resource_id_to_yojson + (Option.value x.creator_request_id ~default:(Smaws_Lib.Uuid.generate ()))) ); ("Name", Some (namespace_name_private_to_yojson x.name)); ] @@ -820,6 +841,9 @@ let create_http_namespace_request_to_yojson (x : create_http_namespace_request) [ ("Tags", option_to_yojson tag_list_to_yojson x.tags); ("Description", option_to_yojson resource_description_to_yojson x.description); - ("CreatorRequestId", option_to_yojson resource_id_to_yojson x.creator_request_id); + ( "CreatorRequestId", + Some + (resource_id_to_yojson + (Option.value x.creator_request_id ~default:(Smaws_Lib.Uuid.generate ()))) ); ("Name", Some (namespace_name_http_to_yojson x.name)); ] diff --git a/sdks/servicediscovery/types.ml b/sdks/servicediscovery/types.ml index 38533c2f..80631650 100644 --- a/sdks/servicediscovery/types.ml +++ b/sdks/servicediscovery/types.ml @@ -20,7 +20,7 @@ type nonrec record_type = | SRV [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec record_tt_l = int [@@ocaml.doc ""] +type nonrec record_tt_l = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec dns_record = { tt_l : record_tt_l; @@ -2128,7 +2128,7 @@ type nonrec request_limit_exceeded = { message : error_message option [@ocaml.do {{:https://docs.aws.amazon.com/cloud-map/latest/dg/throttling.html}Cloud Map API request \ throttling quota} in the {i Cloud Map Developer Guide}.\n"] -type nonrec revision = int [@@ocaml.doc ""] +type nonrec revision = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec discover_instances_revision_response = { instances_revision : revision option; diff --git a/sdks/servicediscovery/types.mli b/sdks/servicediscovery/types.mli index 38533c2f..80631650 100644 --- a/sdks/servicediscovery/types.mli +++ b/sdks/servicediscovery/types.mli @@ -20,7 +20,7 @@ type nonrec record_type = | SRV [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec record_tt_l = int [@@ocaml.doc ""] +type nonrec record_tt_l = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec dns_record = { tt_l : record_tt_l; @@ -2128,7 +2128,7 @@ type nonrec request_limit_exceeded = { message : error_message option [@ocaml.do {{:https://docs.aws.amazon.com/cloud-map/latest/dg/throttling.html}Cloud Map API request \ throttling quota} in the {i Cloud Map Developer Guide}.\n"] -type nonrec revision = int [@@ocaml.doc ""] +type nonrec revision = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec discover_instances_revision_response = { instances_revision : revision option; diff --git a/sdks/sfn/json_serializers.ml b/sdks/sfn/json_serializers.ml index 8331098b..4d55c0a5 100644 --- a/sdks/sfn/json_serializers.ml +++ b/sdks/sfn/json_serializers.ml @@ -756,7 +756,10 @@ let client_token_to_yojson = string_to_yojson let redrive_execution_input_to_yojson (x : redrive_execution_input) = assoc_to_yojson [ - ("clientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "clientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("executionArn", Some (arn_to_yojson x.execution_arn)); ] diff --git a/sdks/sfn/types.ml b/sdks/sfn/types.ml index e9fc796c..d1ad84a4 100644 --- a/sdks/sfn/types.ml +++ b/sdks/sfn/types.ml @@ -429,7 +429,7 @@ type nonrec max_concurrency = int [@@ocaml.doc ""] type nonrec tolerated_failure_percentage = float [@@ocaml.doc ""] -type nonrec tolerated_failure_count = int [@@ocaml.doc ""] +type nonrec tolerated_failure_count = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec update_map_run_input = { tolerated_failure_count : tolerated_failure_count option; @@ -458,7 +458,7 @@ type nonrec untag_resource_input = { } [@@ocaml.doc ""] -type nonrec unsigned_long = int [@@ocaml.doc ""] +type nonrec unsigned_long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec unsigned_integer = int [@@ocaml.doc ""] @@ -475,7 +475,7 @@ type nonrec too_many_tags = { {{:https://docs.aws.amazon.com/step-functions/latest/dg/limits.html} Limits Topic} in the Step \ Functions Developer Guide.\n"] -type nonrec timeout_in_seconds = int [@@ocaml.doc ""] +type nonrec timeout_in_seconds = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec test_state_state_name = string [@@ocaml.doc ""] @@ -1135,9 +1135,9 @@ type nonrec cloud_watch_events_execution_data_details = { } [@@ocaml.doc "Provides details about execution input or output.\n"] -type nonrec billed_memory_used = int [@@ocaml.doc ""] +type nonrec billed_memory_used = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] -type nonrec billed_duration = int [@@ocaml.doc ""] +type nonrec billed_duration = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec billing_details = { billed_duration_in_milliseconds : billed_duration option; @@ -1522,7 +1522,7 @@ type nonrec map_run_list = map_run_list_item list [@@ocaml.doc ""] type nonrec map_run_label = string [@@ocaml.doc ""] -type nonrec long_object = int [@@ocaml.doc ""] +type nonrec long_object = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec map_run_item_counts = { pending_redrive : long_object option; @@ -2145,7 +2145,7 @@ type nonrec history_event_type = | ActivityFailed [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec event_id = int [@@ocaml.doc ""] +type nonrec event_id = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec activity_failed_event_details = { cause : sensitive_cause option; diff --git a/sdks/sfn/types.mli b/sdks/sfn/types.mli index e9fc796c..d1ad84a4 100644 --- a/sdks/sfn/types.mli +++ b/sdks/sfn/types.mli @@ -429,7 +429,7 @@ type nonrec max_concurrency = int [@@ocaml.doc ""] type nonrec tolerated_failure_percentage = float [@@ocaml.doc ""] -type nonrec tolerated_failure_count = int [@@ocaml.doc ""] +type nonrec tolerated_failure_count = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec update_map_run_input = { tolerated_failure_count : tolerated_failure_count option; @@ -458,7 +458,7 @@ type nonrec untag_resource_input = { } [@@ocaml.doc ""] -type nonrec unsigned_long = int [@@ocaml.doc ""] +type nonrec unsigned_long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec unsigned_integer = int [@@ocaml.doc ""] @@ -475,7 +475,7 @@ type nonrec too_many_tags = { {{:https://docs.aws.amazon.com/step-functions/latest/dg/limits.html} Limits Topic} in the Step \ Functions Developer Guide.\n"] -type nonrec timeout_in_seconds = int [@@ocaml.doc ""] +type nonrec timeout_in_seconds = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec test_state_state_name = string [@@ocaml.doc ""] @@ -1135,9 +1135,9 @@ type nonrec cloud_watch_events_execution_data_details = { } [@@ocaml.doc "Provides details about execution input or output.\n"] -type nonrec billed_memory_used = int [@@ocaml.doc ""] +type nonrec billed_memory_used = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] -type nonrec billed_duration = int [@@ocaml.doc ""] +type nonrec billed_duration = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec billing_details = { billed_duration_in_milliseconds : billed_duration option; @@ -1522,7 +1522,7 @@ type nonrec map_run_list = map_run_list_item list [@@ocaml.doc ""] type nonrec map_run_label = string [@@ocaml.doc ""] -type nonrec long_object = int [@@ocaml.doc ""] +type nonrec long_object = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec map_run_item_counts = { pending_redrive : long_object option; @@ -2145,7 +2145,7 @@ type nonrec history_event_type = | ActivityFailed [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec event_id = int [@@ocaml.doc ""] +type nonrec event_id = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec activity_failed_event_details = { cause : sensitive_cause option; diff --git a/sdks/shield/types.ml b/sdks/shield/types.ml index 50404fbd..f63364db 100644 --- a/sdks/shield/types.ml +++ b/sdks/shield/types.ml @@ -243,7 +243,7 @@ type nonrec unit_ = | BITS [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec contributor = { value : long option; @@ -381,7 +381,7 @@ type nonrec subscription_limits = { } [@@ocaml.doc "Limits settings for your subscription. \n"] -type nonrec duration_in_seconds = int [@@ocaml.doc ""] +type nonrec duration_in_seconds = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec proactive_engagement_status = | PENDING [@ocaml.doc ""] @@ -949,7 +949,7 @@ type nonrec list_attacks_request = { type nonrec limit_type = string [@@ocaml.doc ""] -type nonrec limit_number = int [@@ocaml.doc ""] +type nonrec limit_number = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec limits_exceeded_exception = { limit : limit_number option; [@ocaml.doc "The threshold that would be exceeded.\n"] diff --git a/sdks/shield/types.mli b/sdks/shield/types.mli index 50404fbd..f63364db 100644 --- a/sdks/shield/types.mli +++ b/sdks/shield/types.mli @@ -243,7 +243,7 @@ type nonrec unit_ = | BITS [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec contributor = { value : long option; @@ -381,7 +381,7 @@ type nonrec subscription_limits = { } [@@ocaml.doc "Limits settings for your subscription. \n"] -type nonrec duration_in_seconds = int [@@ocaml.doc ""] +type nonrec duration_in_seconds = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec proactive_engagement_status = | PENDING [@ocaml.doc ""] @@ -949,7 +949,7 @@ type nonrec list_attacks_request = { type nonrec limit_type = string [@@ocaml.doc ""] -type nonrec limit_number = int [@@ocaml.doc ""] +type nonrec limit_number = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec limits_exceeded_exception = { limit : limit_number option; [@ocaml.doc "The threshold that would be exceeded.\n"] diff --git a/sdks/snowball/types.ml b/sdks/snowball/types.ml index bf9cef9c..373d0f0a 100644 --- a/sdks/snowball/types.ml +++ b/sdks/snowball/types.ml @@ -617,7 +617,7 @@ type nonrec long_term_pricing_id_list = long_term_pricing_id list [@@ocaml.doc " type nonrec long_term_pricing_entry_list = long_term_pricing_list_entry list [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec dependent_service = { service_version : service_version option; [@ocaml.doc "The version of the dependent service.\n"] diff --git a/sdks/snowball/types.mli b/sdks/snowball/types.mli index bf9cef9c..373d0f0a 100644 --- a/sdks/snowball/types.mli +++ b/sdks/snowball/types.mli @@ -617,7 +617,7 @@ type nonrec long_term_pricing_id_list = long_term_pricing_id list [@@ocaml.doc " type nonrec long_term_pricing_entry_list = long_term_pricing_list_entry list [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec dependent_service = { service_version : service_version option; [@ocaml.doc "The version of the dependent service.\n"] diff --git a/sdks/sqs/types.ml b/sdks/sqs/types.ml index 78985e36..af7f787f 100644 --- a/sdks/sqs/types.ml +++ b/sdks/sqs/types.ml @@ -1392,11 +1392,11 @@ type nonrec purge_queue_in_progress = { message : exception_message option [@oca "Indicates that the specified queue previously received a [PurgeQueue] request within the last \ 60 seconds (the time it can take to delete the messages in the queue).\n"] -type nonrec nullable_long = int [@@ocaml.doc ""] +type nonrec nullable_long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec message_not_inflight = unit [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec list_queues_result = { next_token : token option; diff --git a/sdks/sqs/types.mli b/sdks/sqs/types.mli index 78985e36..af7f787f 100644 --- a/sdks/sqs/types.mli +++ b/sdks/sqs/types.mli @@ -1392,11 +1392,11 @@ type nonrec purge_queue_in_progress = { message : exception_message option [@oca "Indicates that the specified queue previously received a [PurgeQueue] request within the last \ 60 seconds (the time it can take to delete the messages in the queue).\n"] -type nonrec nullable_long = int [@@ocaml.doc ""] +type nonrec nullable_long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec message_not_inflight = unit [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec list_queues_result = { next_token : token option; diff --git a/sdks/ssm/json_serializers.ml b/sdks/ssm/json_serializers.ml index 2e9470a5..a6bbf28e 100644 --- a/sdks/ssm/json_serializers.ml +++ b/sdks/ssm/json_serializers.ml @@ -2282,7 +2282,10 @@ let register_task_with_maintenance_window_request_to_yojson ("AlarmConfiguration", option_to_yojson alarm_configuration_to_yojson x.alarm_configuration); ( "CutoffBehavior", option_to_yojson maintenance_window_task_cutoff_behavior_to_yojson x.cutoff_behavior ); - ("ClientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "ClientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("Description", option_to_yojson maintenance_window_description_to_yojson x.description); ("Name", option_to_yojson maintenance_window_name_to_yojson x.name); ("LoggingInfo", option_to_yojson logging_info_to_yojson x.logging_info); @@ -2318,7 +2321,10 @@ let register_target_with_maintenance_window_request_to_yojson (x : register_target_with_maintenance_window_request) = assoc_to_yojson [ - ("ClientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "ClientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("Description", option_to_yojson maintenance_window_description_to_yojson x.description); ("Name", option_to_yojson maintenance_window_name_to_yojson x.name); ("OwnerInformation", option_to_yojson owner_information_to_yojson x.owner_information); @@ -6378,7 +6384,9 @@ let delete_inventory_result_to_yojson (x : delete_inventory_result) = let delete_inventory_request_to_yojson (x : delete_inventory_request) = assoc_to_yojson [ - ("ClientToken", option_to_yojson uui_d_to_yojson x.client_token); + ( "ClientToken", + Some (uui_d_to_yojson (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) + ); ("DryRun", option_to_yojson dry_run_to_yojson x.dry_run); ( "SchemaDeleteOption", option_to_yojson inventory_schema_delete_option_to_yojson x.schema_delete_option ); @@ -6431,7 +6439,10 @@ let create_patch_baseline_request_to_yojson (x : create_patch_baseline_request) assoc_to_yojson [ ("Tags", option_to_yojson tag_list_to_yojson x.tags); - ("ClientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "ClientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ( "AvailableSecurityUpdatesComplianceStatus", option_to_yojson patch_compliance_status_to_yojson x.available_security_updates_compliance_status ); @@ -6497,7 +6508,10 @@ let create_maintenance_window_request_to_yojson (x : create_maintenance_window_r assoc_to_yojson [ ("Tags", option_to_yojson tag_list_to_yojson x.tags); - ("ClientToken", option_to_yojson client_token_to_yojson x.client_token); + ( "ClientToken", + Some + (client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ( "AllowUnassociatedTargets", Some (maintenance_window_allow_unassociated_targets_to_yojson x.allow_unassociated_targets) ); diff --git a/sdks/ssm/types.ml b/sdks/ssm/types.ml index e2110462..3075a571 100644 --- a/sdks/ssm/types.ml +++ b/sdks/ssm/types.ml @@ -2773,7 +2773,7 @@ type nonrec unlabel_parameter_version_result = { type nonrec ps_parameter_name = string [@@ocaml.doc ""] -type nonrec ps_parameter_version = int [@@ocaml.doc ""] +type nonrec ps_parameter_version = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec unlabel_parameter_version_request = { labels : parameter_label_list; @@ -2916,7 +2916,7 @@ type nonrec step_preview_map = (impact_type * integer) list [@@ocaml.doc ""] type nonrec automation_action_name = string [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec automation_execution_status = | EXITED [@ocaml.doc ""] @@ -10223,7 +10223,7 @@ type nonrec get_execution_preview_request = { } [@@ocaml.doc ""] -type nonrec content_length = int [@@ocaml.doc ""] +type nonrec content_length = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec attachment_hash = string [@@ocaml.doc ""] diff --git a/sdks/ssm/types.mli b/sdks/ssm/types.mli index e2110462..3075a571 100644 --- a/sdks/ssm/types.mli +++ b/sdks/ssm/types.mli @@ -2773,7 +2773,7 @@ type nonrec unlabel_parameter_version_result = { type nonrec ps_parameter_name = string [@@ocaml.doc ""] -type nonrec ps_parameter_version = int [@@ocaml.doc ""] +type nonrec ps_parameter_version = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec unlabel_parameter_version_request = { labels : parameter_label_list; @@ -2916,7 +2916,7 @@ type nonrec step_preview_map = (impact_type * integer) list [@@ocaml.doc ""] type nonrec automation_action_name = string [@@ocaml.doc ""] -type nonrec long = int [@@ocaml.doc ""] +type nonrec long = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec automation_execution_status = | EXITED [@ocaml.doc ""] @@ -10223,7 +10223,7 @@ type nonrec get_execution_preview_request = { } [@@ocaml.doc ""] -type nonrec content_length = int [@@ocaml.doc ""] +type nonrec content_length = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec attachment_hash = string [@@ocaml.doc ""] diff --git a/sdks/swf/types.ml b/sdks/swf/types.ml index 3443c7ee..f6562d96 100644 --- a/sdks/swf/types.ml +++ b/sdks/swf/types.ml @@ -273,7 +273,7 @@ type nonrec workflow_execution = { } [@@ocaml.doc "Represents a workflow execution.\n"] -type nonrec event_id = int [@@ocaml.doc ""] +type nonrec event_id = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec workflow_execution_started_event_attributes = { lambda_role : arn option; [@ocaml.doc "The IAM role attached to the workflow execution.\n"] diff --git a/sdks/swf/types.mli b/sdks/swf/types.mli index 3443c7ee..f6562d96 100644 --- a/sdks/swf/types.mli +++ b/sdks/swf/types.mli @@ -273,7 +273,7 @@ type nonrec workflow_execution = { } [@@ocaml.doc "Represents a workflow execution.\n"] -type nonrec event_id = int [@@ocaml.doc ""] +type nonrec event_id = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec workflow_execution_started_event_attributes = { lambda_role : arn option; [@ocaml.doc "The IAM role attached to the workflow execution.\n"] diff --git a/sdks/transcribe/types.ml b/sdks/transcribe/types.ml index ecfcbb66..4aacee43 100644 --- a/sdks/transcribe/types.ml +++ b/sdks/transcribe/types.ml @@ -417,7 +417,7 @@ type nonrec update_medical_vocabulary_request = { type nonrec category_name = string [@@ocaml.doc ""] -type nonrec timestamp_milliseconds = int [@@ocaml.doc ""] +type nonrec timestamp_milliseconds = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec absolute_time_range = { last : timestamp_milliseconds option; diff --git a/sdks/transcribe/types.mli b/sdks/transcribe/types.mli index ecfcbb66..4aacee43 100644 --- a/sdks/transcribe/types.mli +++ b/sdks/transcribe/types.mli @@ -417,7 +417,7 @@ type nonrec update_medical_vocabulary_request = { type nonrec category_name = string [@@ocaml.doc ""] -type nonrec timestamp_milliseconds = int [@@ocaml.doc ""] +type nonrec timestamp_milliseconds = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec absolute_time_range = { last : timestamp_milliseconds option; diff --git a/sdks/waf/types.ml b/sdks/waf/types.ml index 2e241502..c60785c4 100644 --- a/sdks/waf/types.ml +++ b/sdks/waf/types.ml @@ -1196,7 +1196,7 @@ type nonrec comparison_operator = | EQ [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec size = int [@@ocaml.doc ""] +type nonrec size = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec size_constraint = { size : size; @@ -1821,7 +1821,7 @@ type nonrec update_rate_based_rule_response = { } [@@ocaml.doc ""] -type nonrec rate_limit = int [@@ocaml.doc ""] +type nonrec rate_limit = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec update_rate_based_rule_request = { rate_limit : rate_limit; @@ -2946,7 +2946,7 @@ type nonrec http_request = { of the web requests that were returned by [GetSampledRequests]. \n\ \ "] -type nonrec sample_weight = int [@@ocaml.doc ""] +type nonrec sample_weight = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec action = string [@@ocaml.doc ""] @@ -3427,7 +3427,7 @@ type nonrec put_logging_configuration_request = { } [@@ocaml.doc ""] -type nonrec population_size = int [@@ocaml.doc ""] +type nonrec population_size = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec pagination_limit = int [@@ocaml.doc ""] @@ -4150,7 +4150,7 @@ type nonrec get_sampled_requests_response = { } [@@ocaml.doc ""] -type nonrec get_sampled_requests_max_items = int [@@ocaml.doc ""] +type nonrec get_sampled_requests_max_items = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec get_sampled_requests_request = { max_items : get_sampled_requests_max_items; diff --git a/sdks/waf/types.mli b/sdks/waf/types.mli index 2e241502..c60785c4 100644 --- a/sdks/waf/types.mli +++ b/sdks/waf/types.mli @@ -1196,7 +1196,7 @@ type nonrec comparison_operator = | EQ [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec size = int [@@ocaml.doc ""] +type nonrec size = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec size_constraint = { size : size; @@ -1821,7 +1821,7 @@ type nonrec update_rate_based_rule_response = { } [@@ocaml.doc ""] -type nonrec rate_limit = int [@@ocaml.doc ""] +type nonrec rate_limit = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec update_rate_based_rule_request = { rate_limit : rate_limit; @@ -2946,7 +2946,7 @@ type nonrec http_request = { of the web requests that were returned by [GetSampledRequests]. \n\ \ "] -type nonrec sample_weight = int [@@ocaml.doc ""] +type nonrec sample_weight = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec action = string [@@ocaml.doc ""] @@ -3427,7 +3427,7 @@ type nonrec put_logging_configuration_request = { } [@@ocaml.doc ""] -type nonrec population_size = int [@@ocaml.doc ""] +type nonrec population_size = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec pagination_limit = int [@@ocaml.doc ""] @@ -4150,7 +4150,7 @@ type nonrec get_sampled_requests_response = { } [@@ocaml.doc ""] -type nonrec get_sampled_requests_max_items = int [@@ocaml.doc ""] +type nonrec get_sampled_requests_max_items = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec get_sampled_requests_request = { max_items : get_sampled_requests_max_items; diff --git a/sdks/wafv2/types.ml b/sdks/wafv2/types.ml index 2b28a6b3..b93cee7f 100644 --- a/sdks/wafv2/types.ml +++ b/sdks/wafv2/types.ml @@ -1129,7 +1129,7 @@ type nonrec comparison_operator = | EQ [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec size = int [@@ocaml.doc ""] +type nonrec size = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec size_constraint_statement = { text_transformations : text_transformations; @@ -1885,9 +1885,9 @@ type nonrec regex_pattern_set_reference_statement = { When you update the referenced set, WAF automatically updates all rules that reference it.\n\ \ "] -type nonrec rate_limit = int [@@ocaml.doc ""] +type nonrec rate_limit = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] -type nonrec evaluation_window_sec = int [@@ocaml.doc ""] +type nonrec evaluation_window_sec = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec rate_based_statement_aggregate_key_type = | CONSTANT [@ocaml.doc ""] @@ -3187,7 +3187,7 @@ type nonrec regex_match_statement = { "A rule statement used to search web request components for a match against a single regular \ expression. \n"] -type nonrec as_n = int [@@ocaml.doc ""] +type nonrec as_n = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec asn_list = as_n list [@@ocaml.doc ""] @@ -3913,7 +3913,7 @@ type nonrec visibility_config = { } [@@ocaml.doc "Defines and enables Amazon CloudWatch metrics and web request sample collection. \n"] -type nonrec time_window_second = int [@@ocaml.doc ""] +type nonrec time_window_second = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec immunity_time_property = { immunity_time : time_window_second; @@ -4145,7 +4145,7 @@ type nonrec data_protection_config = { \ This is part of the data protection configuration for a web ACL. \n\ \ "] -type nonrec consumed_capacity = int [@@ocaml.doc ""] +type nonrec consumed_capacity = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec firewall_manager_statement = { rule_group_reference_statement : rule_group_reference_statement option; @@ -5485,7 +5485,7 @@ type nonrec percentage_value = float [@@ocaml.doc ""] type nonrec monetization_amount_value = string [@@ocaml.doc ""] -type nonrec request_count = int [@@ocaml.doc ""] +type nonrec request_count = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec source_statistics = { group_by_value : filter_string option; @@ -5517,7 +5517,7 @@ type nonrec source_statistics_list = source_statistics list [@@ocaml.doc ""] type nonrec sort_order = DESC [@ocaml.doc ""] | ASC [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec solve_timestamp = int [@@ocaml.doc ""] +type nonrec solve_timestamp = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec settlement_status = | DUPLICATE [@ocaml.doc ""] @@ -5675,7 +5675,7 @@ type nonrec http_request = { [Request] in the response syntax. [HTTPRequest] contains information about one of the web \ requests. \n"] -type nonrec sample_weight = int [@@ocaml.doc ""] +type nonrec sample_weight = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec action = string [@@ocaml.doc ""] @@ -5815,7 +5815,7 @@ type nonrec rule_group_summary = { type nonrec rule_group_summaries = rule_group_summary list [@@ocaml.doc ""] -type nonrec capacity_unit = int [@@ocaml.doc ""] +type nonrec capacity_unit = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec label_summary = { name : label_name option; [@ocaml.doc "An individual label specification.\n"] @@ -6449,7 +6449,7 @@ type nonrec product_id = string [@@ocaml.doc ""] type nonrec product_description = string [@@ocaml.doc ""] -type nonrec population_size = int [@@ocaml.doc ""] +type nonrec population_size = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec platform = ANDROID [@ocaml.doc ""] | IOS [@ocaml.doc ""] [@@ocaml.doc ""] @@ -7116,7 +7116,7 @@ type nonrec list_mobile_sdk_releases_request = { } [@@ocaml.doc ""] -type nonrec list_max_items = int [@@ocaml.doc ""] +type nonrec list_max_items = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec list_managed_rule_sets_response = { managed_rule_sets : managed_rule_set_summaries option; diff --git a/sdks/wafv2/types.mli b/sdks/wafv2/types.mli index 2b28a6b3..b93cee7f 100644 --- a/sdks/wafv2/types.mli +++ b/sdks/wafv2/types.mli @@ -1129,7 +1129,7 @@ type nonrec comparison_operator = | EQ [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec size = int [@@ocaml.doc ""] +type nonrec size = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec size_constraint_statement = { text_transformations : text_transformations; @@ -1885,9 +1885,9 @@ type nonrec regex_pattern_set_reference_statement = { When you update the referenced set, WAF automatically updates all rules that reference it.\n\ \ "] -type nonrec rate_limit = int [@@ocaml.doc ""] +type nonrec rate_limit = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] -type nonrec evaluation_window_sec = int [@@ocaml.doc ""] +type nonrec evaluation_window_sec = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec rate_based_statement_aggregate_key_type = | CONSTANT [@ocaml.doc ""] @@ -3187,7 +3187,7 @@ type nonrec regex_match_statement = { "A rule statement used to search web request components for a match against a single regular \ expression. \n"] -type nonrec as_n = int [@@ocaml.doc ""] +type nonrec as_n = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec asn_list = as_n list [@@ocaml.doc ""] @@ -3913,7 +3913,7 @@ type nonrec visibility_config = { } [@@ocaml.doc "Defines and enables Amazon CloudWatch metrics and web request sample collection. \n"] -type nonrec time_window_second = int [@@ocaml.doc ""] +type nonrec time_window_second = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec immunity_time_property = { immunity_time : time_window_second; @@ -4145,7 +4145,7 @@ type nonrec data_protection_config = { \ This is part of the data protection configuration for a web ACL. \n\ \ "] -type nonrec consumed_capacity = int [@@ocaml.doc ""] +type nonrec consumed_capacity = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec firewall_manager_statement = { rule_group_reference_statement : rule_group_reference_statement option; @@ -5485,7 +5485,7 @@ type nonrec percentage_value = float [@@ocaml.doc ""] type nonrec monetization_amount_value = string [@@ocaml.doc ""] -type nonrec request_count = int [@@ocaml.doc ""] +type nonrec request_count = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec source_statistics = { group_by_value : filter_string option; @@ -5517,7 +5517,7 @@ type nonrec source_statistics_list = source_statistics list [@@ocaml.doc ""] type nonrec sort_order = DESC [@ocaml.doc ""] | ASC [@ocaml.doc ""] [@@ocaml.doc ""] -type nonrec solve_timestamp = int [@@ocaml.doc ""] +type nonrec solve_timestamp = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec settlement_status = | DUPLICATE [@ocaml.doc ""] @@ -5675,7 +5675,7 @@ type nonrec http_request = { [Request] in the response syntax. [HTTPRequest] contains information about one of the web \ requests. \n"] -type nonrec sample_weight = int [@@ocaml.doc ""] +type nonrec sample_weight = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec action = string [@@ocaml.doc ""] @@ -5815,7 +5815,7 @@ type nonrec rule_group_summary = { type nonrec rule_group_summaries = rule_group_summary list [@@ocaml.doc ""] -type nonrec capacity_unit = int [@@ocaml.doc ""] +type nonrec capacity_unit = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec label_summary = { name : label_name option; [@ocaml.doc "An individual label specification.\n"] @@ -6449,7 +6449,7 @@ type nonrec product_id = string [@@ocaml.doc ""] type nonrec product_description = string [@@ocaml.doc ""] -type nonrec population_size = int [@@ocaml.doc ""] +type nonrec population_size = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec platform = ANDROID [@ocaml.doc ""] | IOS [@ocaml.doc ""] [@@ocaml.doc ""] @@ -7116,7 +7116,7 @@ type nonrec list_mobile_sdk_releases_request = { } [@@ocaml.doc ""] -type nonrec list_max_items = int [@@ocaml.doc ""] +type nonrec list_max_items = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec list_managed_rule_sets_response = { managed_rule_sets : managed_rule_set_summaries option; diff --git a/sdks/workmail/json_serializers.ml b/sdks/workmail/json_serializers.ml index 08516295..237a5ff4 100644 --- a/sdks/workmail/json_serializers.ml +++ b/sdks/workmail/json_serializers.ml @@ -389,7 +389,10 @@ let register_mail_domain_request_to_yojson (x : register_mail_domain_request) = [ ("DomainName", Some (work_mail_domain_name_to_yojson x.domain_name)); ("OrganizationId", Some (organization_id_to_yojson x.organization_id)); - ("ClientToken", option_to_yojson idempotency_client_token_to_yojson x.client_token); + ( "ClientToken", + Some + (idempotency_client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ] let put_retention_policy_response_to_yojson = unit_to_yojson @@ -1629,7 +1632,10 @@ let delete_organization_request_to_yojson (x : delete_organization_request) = ("ForceDelete", option_to_yojson boolean__to_yojson x.force_delete); ("DeleteDirectory", Some (boolean__to_yojson x.delete_directory)); ("OrganizationId", Some (organization_id_to_yojson x.organization_id)); - ("ClientToken", option_to_yojson idempotency_client_token_to_yojson x.client_token); + ( "ClientToken", + Some + (idempotency_client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ] let delete_mobile_device_access_rule_response_to_yojson = unit_to_yojson @@ -1790,7 +1796,10 @@ let create_organization_request_to_yojson (x : create_organization_request) = ("EnableInteroperability", option_to_yojson boolean__to_yojson x.enable_interoperability); ("KmsKeyArn", option_to_yojson kms_key_arn_to_yojson x.kms_key_arn); ("Domains", option_to_yojson domains_to_yojson x.domains); - ("ClientToken", option_to_yojson idempotency_client_token_to_yojson x.client_token); + ( "ClientToken", + Some + (idempotency_client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("Alias", Some (organization_name_to_yojson x.alias)); ("DirectoryId", option_to_yojson directory_id_to_yojson x.directory_id); ] @@ -1821,7 +1830,10 @@ let create_mobile_device_access_rule_request_to_yojson ("Effect", Some (mobile_device_access_rule_effect_to_yojson x.effect_)); ("Description", option_to_yojson mobile_device_access_rule_description_to_yojson x.description); ("Name", Some (mobile_device_access_rule_name_to_yojson x.name)); - ("ClientToken", option_to_yojson idempotency_client_token_to_yojson x.client_token); + ( "ClientToken", + Some + (idempotency_client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("OrganizationId", Some (organization_id_to_yojson x.organization_id)); ] @@ -1840,7 +1852,10 @@ let create_impersonation_role_request_to_yojson (x : create_impersonation_role_r ("Type", Some (impersonation_role_type_to_yojson x.type_)); ("Name", Some (impersonation_role_name_to_yojson x.name)); ("OrganizationId", Some (organization_id_to_yojson x.organization_id)); - ("ClientToken", option_to_yojson idempotency_client_token_to_yojson x.client_token); + ( "ClientToken", + Some + (idempotency_client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ] let create_identity_center_application_response_to_yojson @@ -1854,7 +1869,10 @@ let create_identity_center_application_request_to_yojson (x : create_identity_center_application_request) = assoc_to_yojson [ - ("ClientToken", option_to_yojson idempotency_client_token_to_yojson x.client_token); + ( "ClientToken", + Some + (idempotency_client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ("InstanceArn", Some (instance_arn_to_yojson x.instance_arn)); ("Name", Some (identity_center_application_name_to_yojson x.name)); ] @@ -1881,7 +1899,10 @@ let create_availability_configuration_request_to_yojson ("EwsProvider", option_to_yojson ews_availability_provider_to_yojson x.ews_provider); ("DomainName", Some (domain_name_to_yojson x.domain_name)); ("OrganizationId", Some (organization_id_to_yojson x.organization_id)); - ("ClientToken", option_to_yojson idempotency_client_token_to_yojson x.client_token); + ( "ClientToken", + Some + (idempotency_client_token_to_yojson + (Option.value x.client_token ~default:(Smaws_Lib.Uuid.generate ()))) ); ] let create_alias_response_to_yojson = unit_to_yojson diff --git a/sdks/workmail/types.ml b/sdks/workmail/types.ml index 91d7e46a..421b0645 100644 --- a/sdks/workmail/types.ml +++ b/sdks/workmail/types.ml @@ -2977,7 +2977,7 @@ type nonrec cancel_mailbox_export_job_request = { type nonrec impersonation_token = string [@@ocaml.doc ""] -type nonrec expires_in = int [@@ocaml.doc ""] +type nonrec expires_in = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec assume_impersonation_role_response = { expires_in : expires_in option; [@ocaml.doc "The authentication token's validity, in seconds.\n"] diff --git a/sdks/workmail/types.mli b/sdks/workmail/types.mli index 91d7e46a..421b0645 100644 --- a/sdks/workmail/types.mli +++ b/sdks/workmail/types.mli @@ -2977,7 +2977,7 @@ type nonrec cancel_mailbox_export_job_request = { type nonrec impersonation_token = string [@@ocaml.doc ""] -type nonrec expires_in = int [@@ocaml.doc ""] +type nonrec expires_in = Smaws_Lib.CoreTypes.Int64.t [@@ocaml.doc ""] type nonrec assume_impersonation_role_response = { expires_in : expires_in option; [@ocaml.doc "The authentication token's validity, in seconds.\n"] diff --git a/smaws-lib.opam b/smaws-lib.opam index 420a6f0c..6863b985 100644 --- a/smaws-lib.opam +++ b/smaws-lib.opam @@ -16,6 +16,8 @@ depends: [ "xmlm" {>= "1.4.0"} "base64" {>= "3.4.0"} "digestif" {>= "1.1.4"} + "zarith" + "uuidm" "eio-ssl" {>= "0.3.0"} "uri" {>= "4.2.0"} "logs" {>= "0.7.0"} diff --git a/smaws_lib/CoreTypes.ml b/smaws_lib/CoreTypes.ml index 99a2dedf..53d65200 100644 --- a/smaws_lib/CoreTypes.ml +++ b/smaws_lib/CoreTypes.ml @@ -31,3 +31,69 @@ module Blob = struct let empty = Bytes.empty let sub = Bytes.sub end + +module Int64 = struct + type t = int64 [@@deriving show, eq] + + let of_int = Int64.of_int + let to_int = Int64.to_int + let of_string = Int64.of_string + let to_string = Int64.to_string +end + +(** Big integers backed by zarith so they can exceed the 63-bit OCaml [int] range. *) +module BigInt = struct + type t = Z.t + + let pp fmt v = Fmt.pf fmt "%s" (Z.to_string v) + let equal = Z.equal + let of_string = Z.of_string + let to_string = Z.to_string + let of_int = Z.of_int +end + +(** Big decimals backed by an arbitrary-precision mantissa and a decimal scale. This preserves >15 + significant digits that would be lost in an OCaml [float]. *) +module BigDecimal = struct + type t = { mantissa : Z.t; scale : int } + + let of_string s = + match String.index_opt s '.' with + | None -> { mantissa = Z.of_string s; scale = 0 } + | Some idx -> + let int_part = String.sub s 0 idx in + let frac_part = String.sub s (idx + 1) (String.length s - idx - 1) in + let scale = String.length frac_part in + let raw_mantissa = Z.of_string (int_part ^ frac_part) in + let mantissa = + if String.length int_part > 0 && s.[0] = '-' then Z.neg (Z.abs raw_mantissa) + else raw_mantissa + in + { mantissa; scale } + + let to_string { mantissa; scale } = + let s = Z.to_string (Z.abs mantissa) in + let neg = Z.lt mantissa Z.zero in + if scale = 0 then (if neg then "-" else "") ^ s + else ( + let s = + if String.length s <= scale then String.make (scale - String.length s + 1) '0' ^ s else s + in + let int_len = String.length s - scale in + let int_part = String.sub s 0 int_len in + let frac_part = String.sub s int_len scale in + (if neg then "-" else "") ^ int_part ^ "." ^ frac_part) + + let pp fmt t = Fmt.pf fmt "%s" (to_string t) + let equal a b = Z.equal a.mantissa b.mantissa && Int.equal a.scale b.scale + + let canonical { mantissa; scale } = + let rec strip_trailing_zero mantissa scale = + if scale <= 0 then (mantissa, 0) + else ( + let mantissa', rem = Z.div_rem mantissa (Z.of_int 10) in + if Z.equal rem Z.zero then strip_trailing_zero mantissa' (scale - 1) else (mantissa, scale)) + in + let mantissa, scale = strip_trailing_zero mantissa scale in + { mantissa; scale } +end diff --git a/smaws_lib/Json.ml b/smaws_lib/Json.ml index c7bf875a..d6e80e02 100644 --- a/smaws_lib/Json.ml +++ b/smaws_lib/Json.ml @@ -12,7 +12,11 @@ module SerializeHelpers = struct let int_to_yojson (x : int) : t = `Int x let byte_to_yojson (x : int) : t = `Int x (* TODO: check number range *) let short_to_yojson (x : int) : t = `Int x (* TODO: check number range *) - let long_to_yojson (x : int) : t = `Int x (* TODO: check number range *) + + let long_to_yojson (x : CoreTypes.Int64.t) : t = + if x >= CoreTypes.Int64.of_int min_int && x <= CoreTypes.Int64.of_int max_int then + `Int (CoreTypes.Int64.to_int x) + else `String (CoreTypes.Int64.to_string x) let float_to_yojson (x : float) : t = match x with @@ -29,7 +33,7 @@ module SerializeHelpers = struct | _ -> `Float x let list_to_yojson (converter : 'a -> t) (x : 'a list) : t = `List (List.map converter x) - let big_int_to_yojson (x : int64) : t = `Int (Int64.to_int x) + let big_int_to_yojson (x : CoreTypes.BigInt.t) : t = `String (CoreTypes.BigInt.to_string x) let bool_to_yojson (x : bool) : t = `Bool x let json_to_yojson (x : t) = x @@ -40,7 +44,9 @@ module SerializeHelpers = struct x) let blob_to_yojson (x : Bytes.t) : t = `String (Base64.encode_exn (Bytes.to_string x)) - let big_decimal_to_yojson (x : string) : t = `String x + + let big_decimal_to_yojson (x : CoreTypes.BigDecimal.t) : t = + `String (CoreTypes.BigDecimal.to_string x) let map_to_yojson (key_converter : 'k -> t) (value_converter : 'v -> t) (x : ('k * 'v) list) : t = `Assoc @@ -161,7 +167,10 @@ module DeserializeHelpers = struct match tree with `Int x -> x | _ -> raise (deserialize_wrong_type_error path "int") let long_of_yojson (tree : t) path = - match tree with `Int x -> x | _ -> raise (deserialize_wrong_type_error path "long") + match tree with + | `Int x -> CoreTypes.Int64.of_int x + | `String s -> CoreTypes.Int64.of_string s + | _ -> raise (deserialize_wrong_type_error path "long") let float_of_yojson (tree : t) path = match tree with @@ -186,7 +195,8 @@ module DeserializeHelpers = struct let big_int_of_yojson (tree : t) path = match tree with - | `Int x -> Int64.of_int x + | `Int x -> CoreTypes.BigInt.of_int x + | `String s -> CoreTypes.BigInt.of_string s | _ -> raise (deserialize_wrong_type_error path "bigint") let bool_of_yojson (tree : t) path = @@ -212,7 +222,8 @@ module DeserializeHelpers = struct let big_decimal_of_yojson (tree : t) path = match tree with - | `String str -> str + | `String str -> CoreTypes.BigDecimal.of_string str + | `Float f -> CoreTypes.BigDecimal.of_string (Float.to_string f) | _ -> raise (deserialize_wrong_type_error path "bigdecimal") let timestamp_epoch_seconds_of_yojson (tree : t) path = diff --git a/smaws_lib/Smaws_Lib.ml b/smaws_lib/Smaws_Lib.ml index b23d8037..bf85a4e1 100644 --- a/smaws_lib/Smaws_Lib.ml +++ b/smaws_lib/Smaws_Lib.ml @@ -8,6 +8,7 @@ module Http = Http module Json = Json module Xml = Xml module UInt64 = UInt64 +module Uuid = Uuid module Protocols = Protocols module Service = Service module Sign = Sign diff --git a/smaws_lib/Smithy_api.ml b/smaws_lib/Smithy_api.ml index bc33028f..336ee7f6 100644 --- a/smaws_lib/Smithy_api.ml +++ b/smaws_lib/Smithy_api.ml @@ -1,7 +1,7 @@ module Types = struct type unit_ = unit [@@deriving show, eq] type short = int [@@deriving show, eq] - type long = int [@@deriving show, eq] + type long = CoreTypes.Int64.t [@@deriving show, eq] type integer = int [@@deriving show, eq] type byte = int [@@deriving show, eq] type float_ = float [@@deriving show, eq] @@ -9,7 +9,8 @@ module Types = struct type string_ = string [@@deriving show, eq] type boolean_ = bool [@@deriving show, eq] type char_ = int [@@deriving show, eq] - type bigint = int64 [@@deriving show, eq] + type bigint = CoreTypes.BigInt.t [@@deriving show, eq] + type bigdecimal = CoreTypes.BigDecimal.t [@@deriving show, eq] type timestamp = CoreTypes.Timestamp.t [@@deriving show, eq] type document = CoreTypes.Document.t [@@deriving show, eq] type resource = CoreTypes.Resource.t [@@deriving show, eq] @@ -29,6 +30,7 @@ module Json_serializers = struct let boolean__to_yojson = Json.SerializeHelpers.bool_to_yojson let char__to_yojson = Json.SerializeHelpers.int_to_yojson let bigint_to_yojson = Json.SerializeHelpers.big_int_to_yojson + let bigdecimal_to_yojson = Json.SerializeHelpers.big_decimal_to_yojson let timestamp_to_yojson = Json.SerializeHelpers.timestamp_epoch_seconds_to_yojson let timestamp_epoch_seconds_to_yojson = Json.SerializeHelpers.timestamp_epoch_seconds_to_yojson let timestamp_iso_8601_to_yojson = Json.SerializeHelpers.timestamp_iso_8601_to_yojson @@ -41,7 +43,9 @@ module Query_serializers = struct let unit__to_query _path _v = [] let string__to_query = Protocols_impl.AwsQuery.Serialize.string_field let integer_to_query = Protocols_impl.AwsQuery.Serialize.int_field - let long_to_query = Protocols_impl.AwsQuery.Serialize.int_field + let long_to_query = Protocols_impl.AwsQuery.Serialize.long_field + let bigint_to_query = Protocols_impl.AwsQuery.Serialize.big_int_field + let bigdecimal_to_query = Protocols_impl.AwsQuery.Serialize.big_decimal_field let short_to_query = Protocols_impl.AwsQuery.Serialize.int_field let byte_to_query = Protocols_impl.AwsQuery.Serialize.int_field let float__to_query = Protocols_impl.AwsQuery.Serialize.float_field @@ -58,7 +62,9 @@ module Query_deserializers = struct let unit__of_xml _ = () let string__of_xml i = Xml.Parse.Read.data i let integer_of_xml i = int_of_string (Xml.Parse.Read.data i) - let long_of_xml i = int_of_string (Xml.Parse.Read.data i) + let long_of_xml i = CoreTypes.Int64.of_string (Xml.Parse.Read.data i) + let bigint_of_xml i = CoreTypes.BigInt.of_string (Xml.Parse.Read.data i) + let bigdecimal_of_xml i = CoreTypes.BigDecimal.of_string (Xml.Parse.Read.data i) let short_of_xml i = int_of_string (Xml.Parse.Read.data i) let byte_of_xml i = int_of_string (Xml.Parse.Read.data i) let float__of_xml i = float_of_string (Xml.Parse.Read.data i) @@ -91,6 +97,7 @@ module Json_deserializers = struct let boolean__of_yojson = Json.DeserializeHelpers.bool_of_yojson let char__of_yojson = Json.DeserializeHelpers.int_of_yojson let bigint_of_yojson = Json.DeserializeHelpers.big_int_of_yojson + let bigdecimal_of_yojson = Json.DeserializeHelpers.big_decimal_of_yojson let timestamp_of_yojson = Json.DeserializeHelpers.timestamp_epoch_seconds_of_yojson let timestamp_epoch_seconds_of_yojson = Json.DeserializeHelpers.timestamp_epoch_seconds_of_yojson let timestamp_iso_8601_of_yojson = Json.DeserializeHelpers.timestamp_iso_8601_of_yojson diff --git a/smaws_lib/Uuid.ml b/smaws_lib/Uuid.ml new file mode 100644 index 00000000..98e58af3 --- /dev/null +++ b/smaws_lib/Uuid.ml @@ -0,0 +1,19 @@ +type t = Uuidm.t + +let to_string = Uuidm.to_string ~upper:false +let v4_state = Random.State.make_self_init () + +(** Default generator produces random version-4 UUIDs (RFC 4122). *) +let v4 () = Uuidm.v4_gen v4_state () |> to_string + +(** Global generator used by generated SDKs when auto-filling idempotency tokens. Tests can override + this to produce deterministic values. *) +let generator = ref v4 + +let generate () = !generator () +let set_generator f = generator := f + +let with_generator f thunk = + let prev = !generator in + generator := f; + Fun.protect thunk ~finally:(fun () -> generator := prev) diff --git a/smaws_lib/Xml.ml b/smaws_lib/Xml.ml index 5b716202..f5223000 100644 --- a/smaws_lib/Xml.ml +++ b/smaws_lib/Xml.ml @@ -46,7 +46,8 @@ module Parse = struct let next = input i in match next with | `El_start ((nns, nname), attributes) - when (Option.is_none ns || String.equal nns (Option.value ns ~default:"")) + when (Option.is_none ns || String.equal nns "" + || String.equal nns (Option.value ns ~default:"")) && String.equal nname tag -> (nns, nname, attributes) | _ -> raise (XmlUnexpectedConstruct (expected, next, Xmlm.pos i)) @@ -70,7 +71,8 @@ module Parse = struct end let tag_equal name ns ((nns, nname), _) = - String.equal name nname && (Option.is_none ns || String.equal nns (Option.value ns ~default:"")) + String.equal name nname + && (Option.is_none ns || String.equal nns "" || String.equal nns (Option.value ns ~default:"")) module Read = struct type 'a reader = input -> attribute list -> 'a diff --git a/smaws_lib/dune b/smaws_lib/dune index 846c9ec8..94c5851d 100644 --- a/smaws_lib/dune +++ b/smaws_lib/dune @@ -12,7 +12,9 @@ digestif xmlm ptime - yojson) + yojson + zarith + uuidm) (preprocess (pps ppx_deriving.show ppx_deriving.eq))) diff --git a/smaws_lib/protocols_impl/AwsJson.ml b/smaws_lib/protocols_impl/AwsJson.ml index 88b8de96..6ac9d808 100644 --- a/smaws_lib/protocols_impl/AwsJson.ml +++ b/smaws_lib/protocols_impl/AwsJson.ml @@ -41,6 +41,44 @@ type json_type = Yojson.Basic.t let json_to_string = Yojson.Basic.to_string let json_of_string = Yojson.Basic.from_string +let normalize_error_name s = + let without_uri = match String.index_opt s ':' with Some i -> String.sub s 0 i | None -> s in + match String.split_on_char '#' without_uri with _ :: name :: _ -> name | _ -> without_uri + +let find_header ~name headers = + List.find_map + (fun (k, v) -> if String.equal (String.lowercase_ascii k) name then Some v else None) + headers + +let error_name_from_headers headers = + Option.map normalize_error_name (find_header ~name:"x-amzn-errortype" headers) + +let rec assoc_find key = function + | [] -> None + | (k, v) :: _ when String.equal k key -> Some v + | _ :: rest -> assoc_find key rest + +let error_name_from_body body_json = + match body_json with + | `Assoc fields -> ( + match assoc_find "__type" fields with + | Some (`String s) -> Some (normalize_error_name s) + | _ -> + Option.map normalize_error_name + (match assoc_find "code" fields with Some (`String s) -> Some s | _ -> None)) + | _ -> None + +let ensure_error_type ~(headers : Http.headers) (body_json : json_type) : json_type = + let name_from_headers = error_name_from_headers headers in + let name_from_body = error_name_from_body body_json in + let name = match name_from_headers with Some n -> Some n | None -> name_from_body in + match name with + | Some name -> ( + match body_json with + | `Assoc fields -> `Assoc (("__type", `String name) :: List.remove_assoc "__type" fields) + | _ -> `Assoc [ ("__type", `String name) ]) + | None -> body_json + module Errors = struct open AwsErrors @@ -109,7 +147,8 @@ let request (type http_t) ~(shape_name : string) ~(service : Service.descriptor) (deserialize_res output_deserializer) body_res |> Result.map_error (fun e -> `JsonParseError e) | _ -> ( - match (deserialize_res error_deserializer) body_res with + let error_body = ensure_error_type ~headers:(Http.Response.headers response) body_res in + match (deserialize_res error_deserializer) error_body with | Ok error -> Error error | Error error -> Error (`JsonParseError error)) end diff --git a/smaws_lib/protocols_impl/AwsQuery.ml b/smaws_lib/protocols_impl/AwsQuery.ml index 77bf8255..de7e2022 100644 --- a/smaws_lib/protocols_impl/AwsQuery.ml +++ b/smaws_lib/protocols_impl/AwsQuery.ml @@ -22,6 +22,9 @@ module Serialize = struct let join_path path = String.concat "." path let string_field path v = [ (join_path path, [ v ]) ] let int_field path v = string_field path (string_of_int v) + let long_field path v = string_field path (CoreTypes.Int64.to_string v) + let big_int_field path v = string_field path (CoreTypes.BigInt.to_string v) + let big_decimal_field path v = string_field path (CoreTypes.BigDecimal.to_string v) let bool_field path v = string_field path (string_of_bool v) (* Shortest round-trip-safe decimal representation of a float. Starts at the @@ -177,6 +180,9 @@ module Deserialize = struct | None -> failwith ("invalid http-date: " ^ s)) let int_of_string s = Stdlib.int_of_string s + let long_of_string s = CoreTypes.Int64.of_string s + let big_int_of_string s = CoreTypes.BigInt.of_string s + let big_decimal_of_string s = CoreTypes.BigDecimal.of_string s let bool_of_string s = Stdlib.bool_of_string s let float_of_string s = Stdlib.float_of_string s let blob_of_string s = Bytes.of_string (Base64.decode_exn s) @@ -203,11 +209,17 @@ module Response = struct Read.dtd xmlSource; Read.sequence xmlSource (action ^ "Response") ~ns:xmlNamespace (fun _ _ -> + (* AWS Query responses for operations with no output members may omit the + wrapper and include only . Try to read the + result element if present; otherwise run the deserializer at the current + position (which works for unit outputs that ignore the input) and skip any + trailing siblings. *) let result = - Read.sequence xmlSource (action ^ "Result") (fun i _ -> resultParser i) () + match Xmlm.peek xmlSource with + | `El_start el when tag_equal (action ^ "Result") (Some xmlNamespace) el -> + Read.sequence xmlSource (action ^ "Result") (fun i _ -> resultParser i) () + | _ -> resultParser xmlSource in - (* Skip trailing siblings such as mandated by the - awsQuery protocol before the response end tag. *) Read.skip_to_end xmlSource; result) ()) diff --git a/smithy_ast/Trait.ml b/smithy_ast/Trait.ml index 28955358..a195a39f 100644 --- a/smithy_ast/Trait.ml +++ b/smithy_ast/Trait.ml @@ -188,6 +188,7 @@ let isSparseTrait trait = match trait with SparseTrait -> true | _ -> false let isErrorTrait trait = match trait with ErrorTrait _ -> true | _ -> false let isAwsApiServiceTrait trait = match trait with ServiceTrait _ -> true | _ -> false let isTimestampFormatTrait trait = match trait with TimestampFormatTrait _ -> true | _ -> false +let isIdempotencyTokenTrait trait = match trait with IdempotencyTokenTrait -> true | _ -> false let hasTrait traitsOption traitTest = Option.value ~default:false From 512253197b60b3c10f492041fd993be1912e514e Mon Sep 17 00:00:00 2001 From: Chris Armstrong Date: Mon, 6 Jul 2026 18:37:47 +1000 Subject: [PATCH 2/2] Delete OF --- OF | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 OF diff --git a/OF b/OF deleted file mode 100644 index e69de29b..00000000