diff --git a/CHANGELOG.md b/CHANGELOG.md index a0903bb1d..30cba9198 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ ## Unreleased +## v0.6.0 + +### Breaking Changes + +* Generated operation outputs and modeled errors now reserve a + `response_metadata` attribute, carrying the request ID, extended request ID, + and HTTP status code of the response that produced them. A modeled member + named `responseMetadata` on an output or error is now generated as + `response_metadata_` to avoid the collision; only the Python attribute name + changes, not the wire representation. + ## v0.5.0 ### Breaking Changes diff --git a/codegen-output/aws-json-1-0/src/awsjson10/models.py b/codegen-output/aws-json-1-0/src/awsjson10/models.py index d1c06df81..959e3afe0 100644 --- a/codegen-output/aws-json-1-0/src/awsjson10/models.py +++ b/codegen-output/aws-json-1-0/src/awsjson10/models.py @@ -10,6 +10,7 @@ from smithy_core.deserializers import ShapeDeserializer from smithy_core.documents import Document, TypeRegistry from smithy_core.exceptions import ModeledError, SerializationError +from smithy_core.response import EMPTY_RESPONSE_METADATA, ResponseMetadata from smithy_core.schemas import APIOperation, Schema from smithy_core.serializers import ShapeSerializer from smithy_core.shapes import ShapeID @@ -256,6 +257,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class ContentTypeParametersOutput: """Dataclass for ContentTypeParametersOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_CONTENT_TYPE_PARAMETERS_OUTPUT, self) @@ -827,6 +838,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class EmptyInputAndEmptyOutputOutput: """Dataclass for EmptyInputAndEmptyOutputOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_EMPTY_INPUT_AND_EMPTY_OUTPUT_OUTPUT, self) @@ -895,6 +916,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class EndpointOperationOutput: """Dataclass for EndpointOperationOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_ENDPOINT_OPERATION_OUTPUT, self) @@ -976,6 +1007,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class EndpointWithHostLabelOperationOutput: """Dataclass for EndpointWithHostLabelOperationOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_ENDPOINT_WITH_HOST_LABEL_OPERATION_OUTPUT, self) @@ -1088,6 +1129,16 @@ class GreetingWithErrorsOutput: greeting: str | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_GREETING_WITH_ERRORS_OUTPUT, self) @@ -1209,6 +1260,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class HostWithPathOperationOutput: """Dataclass for HostWithPathOperationOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_HOST_WITH_PATH_OPERATION_OUTPUT, self) @@ -1667,6 +1728,16 @@ class JsonUnionsOutput: contents: MyUnion | None = None """A union with a representative set of types for members.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_JSON_UNIONS_OUTPUT, self) @@ -1741,6 +1812,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class NoInputAndNoOutputOutput: """Dataclass for NoInputAndNoOutputOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_NO_INPUT_AND_NO_OUTPUT_OUTPUT, self) @@ -1809,6 +1890,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class NoInputAndOutputOutput: """Dataclass for NoInputAndOutputOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_NO_INPUT_AND_OUTPUT_OUTPUT, self) @@ -1982,6 +2073,16 @@ class OperationWithDefaultsOutput: zero_double: float = 0.0 + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_OPERATION_WITH_DEFAULTS_OUTPUT, self) @@ -2390,6 +2491,16 @@ class OperationWithNestedStructureOutput: dialog_map: dict[str, Dialog] = field(default_factory=dict[str, Dialog]) + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_OPERATION_WITH_NESTED_STRUCTURE_OUTPUT, self) @@ -2570,6 +2681,16 @@ class OperationWithRequiredMembersOutput: required_map: dict[str, str] + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_OPERATION_WITH_REQUIRED_MEMBERS_OUTPUT, self) @@ -2841,6 +2962,16 @@ class OperationWithRequiredMembersWithDefaultsOutput: required_int_enum: int = RequiredIntEnum(1) + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct( _SCHEMA_OPERATION_WITH_REQUIRED_MEMBERS_WITH_DEFAULTS_OUTPUT, self @@ -3126,6 +3257,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class PutWithContentEncodingOutput: """Dataclass for PutWithContentEncodingOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_PUT_WITH_CONTENT_ENCODING_OUTPUT, self) @@ -3196,6 +3337,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class QueryIncompatibleOperationOutput: """Dataclass for QueryIncompatibleOperationOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_QUERY_INCOMPATIBLE_OPERATION_OUTPUT, self) @@ -3294,6 +3445,16 @@ class SimpleScalarPropertiesOutput: double_value: float | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_SIMPLE_SCALAR_PROPERTIES_OUTPUT, self) diff --git a/codegen-output/aws-json-1-1/src/awsjson11/models.py b/codegen-output/aws-json-1-1/src/awsjson11/models.py index 9f0eb434e..785831f43 100644 --- a/codegen-output/aws-json-1-1/src/awsjson11/models.py +++ b/codegen-output/aws-json-1-1/src/awsjson11/models.py @@ -1,6 +1,6 @@ # Code generated by smithy-python-codegen DO NOT EDIT. -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import IntEnum, StrEnum import logging @@ -9,6 +9,7 @@ from smithy_core.deserializers import ShapeDeserializer from smithy_core.documents import Document, TypeRegistry from smithy_core.exceptions import ModeledError, SerializationError +from smithy_core.response import EMPTY_RESPONSE_METADATA, ResponseMetadata from smithy_core.schemas import APIOperation, Schema from smithy_core.serializers import ShapeSerializer from smithy_core.shapes import ShapeID @@ -225,6 +226,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class ContentTypeParametersOutput: """Dataclass for ContentTypeParametersOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_CONTENT_TYPE_PARAMETERS_OUTPUT, self) @@ -295,6 +306,16 @@ class DatetimeOffsetsOutput: datetime_: datetime | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_DATETIME_OFFSETS_OUTPUT, self) @@ -369,6 +390,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class EmptyOperationOutput: """Dataclass for EmptyOperationOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_EMPTY_OPERATION_OUTPUT, self) @@ -462,6 +493,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class EndpointOperationOutput: """Dataclass for EndpointOperationOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_ENDPOINT_OPERATION_OUTPUT, self) @@ -543,6 +584,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class EndpointWithHostLabelOperationOutput: """Dataclass for EndpointWithHostLabelOperationOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_ENDPOINT_WITH_HOST_LABEL_OPERATION_OUTPUT, self) @@ -953,6 +1004,16 @@ class FractionalSecondsOutput: datetime_: datetime | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_FRACTIONAL_SECONDS_OUTPUT, self) @@ -1029,6 +1090,16 @@ class GreetingWithErrorsOutput: greeting: str | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_GREETING_WITH_ERRORS_OUTPUT, self) @@ -1150,6 +1221,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class HostWithPathOperationOutput: """Dataclass for HostWithPathOperationOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_HOST_WITH_PATH_OPERATION_OUTPUT, self) @@ -1392,6 +1473,16 @@ class JsonEnumsOutput: foo_enum_map: dict[str, str] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_JSON_ENUMS_OUTPUT, self) @@ -1700,6 +1791,16 @@ class JsonIntEnumsOutput: int_enum_map: dict[str, int] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_JSON_INT_ENUMS_OUTPUT, self) @@ -2189,6 +2290,16 @@ class JsonUnionsOutput: contents: MyUnion | None = None """A union with a representative set of types for members.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_JSON_UNIONS_OUTPUT, self) @@ -2273,6 +2384,16 @@ class NullOperationOutput: string: str | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_NULL_OPERATION_OUTPUT, self) @@ -2366,6 +2487,16 @@ class OperationWithOptionalInputOutputOutput: value: str | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct( _SCHEMA_OPERATION_WITH_OPTIONAL_INPUT_OUTPUT_OUTPUT, self @@ -2464,6 +2595,16 @@ class PutAndGetInlineDocumentsOutput: inline_document: Document | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_PUT_AND_GET_INLINE_DOCUMENTS_OUTPUT, self) @@ -2568,6 +2709,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class PutWithContentEncodingOutput: """Dataclass for PutWithContentEncodingOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_PUT_WITH_CONTENT_ENCODING_OUTPUT, self) @@ -2666,6 +2817,16 @@ class SimpleScalarPropertiesOutput: double_value: float | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_SIMPLE_SCALAR_PROPERTIES_OUTPUT, self) @@ -2848,6 +3009,16 @@ class SparseNullsOperationOutput: sparse_string_map: dict[str, str | None] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_SPARSE_NULLS_OPERATION_OUTPUT, self) @@ -3846,6 +4017,16 @@ class KitchenSinkOperationOutput: unix_timestamp: datetime | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_KITCHEN_SINK_OPERATION_OUTPUT, self) diff --git a/codegen-output/aws-query/src/awsquery/models.py b/codegen-output/aws-query/src/awsquery/models.py index be31c9db4..ba02f0cbf 100644 --- a/codegen-output/aws-query/src/awsquery/models.py +++ b/codegen-output/aws-query/src/awsquery/models.py @@ -1,6 +1,6 @@ # Code generated by smithy-python-codegen DO NOT EDIT. -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import IntEnum, StrEnum import logging @@ -9,6 +9,7 @@ from smithy_core.deserializers import ShapeDeserializer from smithy_core.documents import TypeRegistry from smithy_core.exceptions import ModeledError +from smithy_core.response import EMPTY_RESPONSE_METADATA, ResponseMetadata from smithy_core.schemas import APIOperation, Schema from smithy_core.serializers import ShapeSerializer from smithy_core.shapes import ShapeID @@ -174,6 +175,16 @@ class DatetimeOffsetsOutput: datetime_: datetime | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_DATETIME_OFFSETS_OUTPUT, self) @@ -250,6 +261,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class EmptyInputAndEmptyOutputOutput: """Dataclass for EmptyInputAndEmptyOutputOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_EMPTY_INPUT_AND_EMPTY_OUTPUT_OUTPUT, self) @@ -318,6 +339,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class EndpointOperationOutput: """Dataclass for EndpointOperationOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_ENDPOINT_OPERATION_OUTPUT, self) @@ -399,6 +430,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class EndpointWithHostLabelOperationOutput: """Dataclass for EndpointWithHostLabelOperationOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_ENDPOINT_WITH_HOST_LABEL_OPERATION_OUTPUT, self) @@ -503,6 +544,16 @@ class FlattenedXmlMapOutput: my_map: dict[str, str] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_FLATTENED_XML_MAP_OUTPUT, self) @@ -609,6 +660,16 @@ class FlattenedXmlMapWithXmlNameOutput: my_map: dict[str, str] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_FLATTENED_XML_MAP_WITH_XML_NAME_OUTPUT, self) @@ -724,6 +785,16 @@ class FlattenedXmlMapWithXmlNamespaceOutput: my_map: dict[str, str] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct( _SCHEMA_FLATTENED_XML_MAP_WITH_XML_NAMESPACE_OUTPUT, self @@ -811,6 +882,16 @@ class FractionalSecondsOutput: datetime_: datetime | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_FRACTIONAL_SECONDS_OUTPUT, self) @@ -1010,6 +1091,16 @@ class GreetingWithErrorsOutput: greeting: str | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_GREETING_WITH_ERRORS_OUTPUT, self) @@ -1135,6 +1226,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class HostWithPathOperationOutput: """Dataclass for HostWithPathOperationOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_HOST_WITH_PATH_OPERATION_OUTPUT, self) @@ -1207,6 +1308,16 @@ class IgnoresWrappingXmlNameOutput: foo: str | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_IGNORES_WRAPPING_XML_NAME_OUTPUT, self) @@ -1256,6 +1367,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class NestedStructuresOutput: """Dataclass for NestedStructuresOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_NESTED_STRUCTURES_OUTPUT, self) @@ -1312,6 +1433,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class NoInputAndNoOutputOutput: """Dataclass for NoInputAndNoOutputOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_NO_INPUT_AND_NO_OUTPUT_OUTPUT, self) @@ -1380,6 +1511,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class NoInputAndOutputOutput: """Dataclass for NoInputAndOutputOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_NO_INPUT_AND_OUTPUT_OUTPUT, self) @@ -1471,6 +1612,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class PutWithContentEncodingOutput: """Dataclass for PutWithContentEncodingOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_PUT_WITH_CONTENT_ENCODING_OUTPUT, self) @@ -1552,6 +1703,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class QueryIdempotencyTokenAutoFillOutput: """Dataclass for QueryIdempotencyTokenAutoFillOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_QUERY_IDEMPOTENCY_TOKEN_AUTO_FILL_OUTPUT, self) @@ -1856,6 +2017,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class QueryListsOutput: """Dataclass for QueryListsOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_QUERY_LISTS_OUTPUT, self) @@ -2175,6 +2346,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class QueryMapsOutput: """Dataclass for QueryMapsOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_QUERY_MAPS_OUTPUT, self) @@ -2276,6 +2457,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class QueryTimestampsOutput: """Dataclass for QueryTimestampsOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_QUERY_TIMESTAMPS_OUTPUT, self) @@ -2487,6 +2678,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class SimpleInputParamsOutput: """Dataclass for SimpleInputParamsOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_SIMPLE_INPUT_PARAMS_OUTPUT, self) @@ -2575,6 +2776,16 @@ class SimpleScalarXmlPropertiesOutput: double_value: float | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_SIMPLE_SCALAR_XML_PROPERTIES_OUTPUT, self) @@ -2771,6 +2982,16 @@ class XmlBlobsOperationOutput: data: bytes | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_XML_BLOBS_OPERATION_OUTPUT, self) @@ -2847,6 +3068,16 @@ class XmlEmptyBlobsOutput: data: bytes | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_XML_EMPTY_BLOBS_OUTPUT, self) @@ -3280,6 +3511,16 @@ class XmlEmptyListsOutput: structure_list: list[StructureListMember] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_XML_EMPTY_LISTS_OUTPUT, self) @@ -3552,6 +3793,16 @@ class XmlEmptyMapsOutput: my_map: dict[str, GreetingStruct] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_XML_EMPTY_MAPS_OUTPUT, self) @@ -3664,6 +3915,16 @@ class XmlEnumsOutput: foo_enum_map: dict[str, str] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_XML_ENUMS_OUTPUT, self) @@ -3858,6 +4119,16 @@ class XmlIntEnumsOutput: int_enum_map: dict[str, int] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_XML_INT_ENUMS_OUTPUT, self) @@ -4023,6 +4294,16 @@ class XmlListsOperationOutput: structure_list: list[StructureListMember] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_XML_LISTS_OPERATION_OUTPUT, self) @@ -4275,6 +4556,16 @@ class XmlMapsOperationOutput: my_map: dict[str, GreetingStruct] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_XML_MAPS_OPERATION_OUTPUT, self) @@ -4379,6 +4670,16 @@ class XmlMapsXmlNameOutput: my_map: dict[str, GreetingStruct] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_XML_MAPS_XML_NAME_OUTPUT, self) @@ -4532,6 +4833,16 @@ class XmlNamespacesOutput: nested: XmlNamespaceNested | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_XML_NAMESPACES_OUTPUT, self) @@ -4618,6 +4929,16 @@ class XmlTimestampsOutput: http_date_on_target: datetime | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_XML_TIMESTAMPS_OUTPUT, self) @@ -4939,6 +5260,16 @@ class RecursiveXmlShapesOutput: nested: "RecursiveXmlShapesOutputNested1 | None" = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_RECURSIVE_XML_SHAPES_OUTPUT, self) diff --git a/codegen-output/rest-json-1/src/restjson/models.py b/codegen-output/rest-json-1/src/restjson/models.py index 5dce1cdb9..95a9d4c71 100644 --- a/codegen-output/rest-json-1/src/restjson/models.py +++ b/codegen-output/rest-json-1/src/restjson/models.py @@ -12,6 +12,7 @@ from smithy_core.documents import Document, TypeRegistry from smithy_core.exceptions import ModeledError, SerializationError from smithy_core.prelude import UNIT as _SCHEMA_UNIT +from smithy_core.response import EMPTY_RESPONSE_METADATA, ResponseMetadata from smithy_core.schemas import APIOperation, Schema from smithy_core.serializers import ShapeSerializer from smithy_core.shapes import ShapeID @@ -1027,6 +1028,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class AllQueryStringTypesOutput: """Dataclass for AllQueryStringTypesOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_ALL_QUERY_STRING_TYPES_OUTPUT, self) @@ -1295,6 +1306,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class ConstantAndVariableQueryStringOutput: """Dataclass for ConstantAndVariableQueryStringOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_CONSTANT_AND_VARIABLE_QUERY_STRING_OUTPUT, self) @@ -1375,6 +1396,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class ConstantQueryStringOutput: """Dataclass for ConstantQueryStringOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_CONSTANT_QUERY_STRING_OUTPUT, self) @@ -1455,6 +1486,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class ContentTypeParametersOutput: """Dataclass for ContentTypeParametersOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_CONTENT_TYPE_PARAMETERS_OUTPUT, self) @@ -1525,6 +1566,16 @@ class DatetimeOffsetsOutput: datetime_: datetime | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_DATETIME_OFFSETS_OUTPUT, self) @@ -2290,6 +2341,16 @@ class DocumentTypeOutput: document_value: Document | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_DOCUMENT_TYPE_OUTPUT, self) @@ -2420,6 +2481,16 @@ class DocumentTypeAsMapValueOutput: doc_valued_map: dict[str, Document] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_DOCUMENT_TYPE_AS_MAP_VALUE_OUTPUT, self) @@ -2516,6 +2587,16 @@ class DocumentTypeAsPayloadOutput: document_value: Document | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_DOCUMENT_TYPE_AS_PAYLOAD_OUTPUT, self) @@ -3294,6 +3375,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class DuplexStreamOutput: """Dataclass for DuplexStreamOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_DUPLEX_STREAM_OUTPUT, self) @@ -3479,6 +3570,16 @@ class DuplexStreamWithDistinctStreamsOutput: stream: SingletonEventStream | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct( _SCHEMA_DUPLEX_STREAM_WITH_DISTINCT_STREAMS_OUTPUT, self @@ -3577,6 +3678,16 @@ class DuplexStreamWithInitialMessagesOutput: initial_response_member: str + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct( _SCHEMA_DUPLEX_STREAM_WITH_INITIAL_MESSAGES_OUTPUT, self @@ -3706,6 +3817,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class EmptyInputAndEmptyOutputOutput: """Dataclass for EmptyInputAndEmptyOutputOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_EMPTY_INPUT_AND_EMPTY_OUTPUT_OUTPUT, self) @@ -3774,6 +3895,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class EndpointOperationOutput: """Dataclass for EndpointOperationOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_ENDPOINT_OPERATION_OUTPUT, self) @@ -3855,6 +3986,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class EndpointWithHostLabelOperationOutput: """Dataclass for EndpointWithHostLabelOperationOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_ENDPOINT_WITH_HOST_LABEL_OPERATION_OUTPUT, self) @@ -3957,6 +4098,16 @@ class FractionalSecondsOutput: datetime_: datetime | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_FRACTIONAL_SECONDS_OUTPUT, self) @@ -4033,6 +4184,16 @@ class GreetingWithErrorsOutput: greeting: str | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_GREETING_WITH_ERRORS_OUTPUT, self) @@ -4154,6 +4315,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class HostWithPathOperationOutput: """Dataclass for HostWithPathOperationOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_HOST_WITH_PATH_OPERATION_OUTPUT, self) @@ -4236,6 +4407,16 @@ class HttpChecksumRequiredOutput: foo: str | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_HTTP_CHECKSUM_REQUIRED_OUTPUT, self) @@ -4374,6 +4555,16 @@ class HttpEmptyPrefixHeadersOutput: specific_header: str | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_HTTP_EMPTY_PREFIX_HEADERS_OUTPUT, self) @@ -4486,6 +4677,16 @@ class HttpEnumPayloadOutput: payload: str | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_HTTP_ENUM_PAYLOAD_OUTPUT, self) @@ -4588,6 +4789,16 @@ class HttpPayloadTraitsOutput: blob: bytes | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_HTTP_PAYLOAD_TRAITS_OUTPUT, self) @@ -4704,6 +4915,16 @@ class HttpPayloadTraitsWithMediaTypeOutput: blob: bytes | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct( _SCHEMA_HTTP_PAYLOAD_TRAITS_WITH_MEDIA_TYPE_OUTPUT, self @@ -4857,6 +5078,16 @@ class HttpPayloadWithStructureOutput: nested: NestedPayload | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_HTTP_PAYLOAD_WITH_STRUCTURE_OUTPUT, self) @@ -5018,6 +5249,16 @@ class HttpPayloadWithUnionOutput: nested: UnionPayload | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_HTTP_PAYLOAD_WITH_UNION_OUTPUT, self) @@ -5120,6 +5361,16 @@ class HttpPrefixHeadersOutput: foo_map: dict[str, str] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_HTTP_PREFIX_HEADERS_OUTPUT, self) @@ -5210,6 +5461,16 @@ class HttpPrefixHeadersInResponseOutput: prefix_headers: dict[str, str] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_HTTP_PREFIX_HEADERS_IN_RESPONSE_OUTPUT, self) @@ -5334,6 +5595,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class HttpQueryParamsOnlyOperationOutput: """Dataclass for HttpQueryParamsOnlyOperationOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_HTTP_QUERY_PARAMS_ONLY_OPERATION_OUTPUT, self) @@ -5428,6 +5699,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class HttpRequestWithFloatLabelsOutput: """Dataclass for HttpRequestWithFloatLabelsOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_HTTP_REQUEST_WITH_FLOAT_LABELS_OUTPUT, self) @@ -5528,6 +5809,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class HttpRequestWithGreedyLabelInPathOutput: """Dataclass for HttpRequestWithGreedyLabelInPathOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct( _SCHEMA_HTTP_REQUEST_WITH_GREEDY_LABEL_IN_PATH_OUTPUT, self @@ -5700,6 +5991,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class HttpRequestWithLabelsOutput: """Dataclass for HttpRequestWithLabelsOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_HTTP_REQUEST_WITH_LABELS_OUTPUT, self) @@ -5890,6 +6191,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class HttpRequestWithLabelsAndTimestampFormatOutput: """Dataclass for HttpRequestWithLabelsAndTimestampFormatOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct( _SCHEMA_HTTP_REQUEST_WITH_LABELS_AND_TIMESTAMP_FORMAT_OUTPUT, self @@ -5973,6 +6284,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class HttpRequestWithRegexLiteralOutput: """Dataclass for HttpRequestWithRegexLiteralOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_HTTP_REQUEST_WITH_REGEX_LITERAL_OUTPUT, self) @@ -6043,6 +6364,16 @@ class HttpResponseCodeOutput: status: int | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_HTTP_RESPONSE_CODE_OUTPUT, self) @@ -6129,6 +6460,16 @@ class HttpStringPayloadOutput: payload: str | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_HTTP_STRING_PAYLOAD_OUTPUT, self) @@ -6207,6 +6548,16 @@ class IgnoreQueryParamsInResponseOutput: baz: str | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_IGNORE_QUERY_PARAMS_IN_RESPONSE_OUTPUT, self) @@ -6617,6 +6968,16 @@ class InputAndOutputWithHeadersOutput: header_integer_enum_list: list[int] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_INPUT_AND_OUTPUT_WITH_HEADERS_OUTPUT, self) @@ -6947,6 +7308,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class InputStreamOutput: """Dataclass for InputStreamOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_INPUT_STREAM_OUTPUT, self) @@ -7030,6 +7401,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class InputStreamWithInitialRequestOutput: """Dataclass for InputStreamWithInitialRequestOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_INPUT_STREAM_WITH_INITIAL_REQUEST_OUTPUT, self) @@ -7108,6 +7489,16 @@ class JsonBlobsOutput: data: bytes | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_JSON_BLOBS_OUTPUT, self) @@ -7320,6 +7711,16 @@ class JsonEnumsOutput: foo_enum_map: dict[str, str] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_JSON_ENUMS_OUTPUT, self) @@ -7596,6 +7997,16 @@ class JsonIntEnumsOutput: integer_enum_map: dict[str, int] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_JSON_INT_ENUMS_OUTPUT, self) @@ -7973,6 +8384,16 @@ class JsonListsOutput: structure_list: list[StructureListMember] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_JSON_LISTS_OUTPUT, self) @@ -8223,6 +8644,16 @@ class JsonMapsOutput: dense_set_map: dict[str, list[str]] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_JSON_MAPS_OUTPUT, self) @@ -8447,6 +8878,16 @@ class JsonTimestampsOutput: http_date_on_target: datetime | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_JSON_TIMESTAMPS_OUTPUT, self) @@ -9007,6 +9448,16 @@ class JsonUnionsOutput: contents: MyUnion | None = None """A union with a representative set of types for members.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_JSON_UNIONS_OUTPUT, self) @@ -9083,6 +9534,16 @@ class MalformedAcceptWithBodyOutput: hi: str | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_ACCEPT_WITH_BODY_OUTPUT, self) @@ -9165,6 +9626,16 @@ class MalformedAcceptWithGenericStringOutput: payload: str | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct( _SCHEMA_MALFORMED_ACCEPT_WITH_GENERIC_STRING_OUTPUT, self @@ -9250,6 +9721,16 @@ class MalformedAcceptWithPayloadOutput: payload: bytes | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_ACCEPT_WITH_PAYLOAD_OUTPUT, self) @@ -9337,6 +9818,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedBlobOutput: """Dataclass for MalformedBlobOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_BLOB_OUTPUT, self) @@ -9453,6 +9944,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedBooleanOutput: """Dataclass for MalformedBooleanOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_BOOLEAN_OUTPUT, self) @@ -9566,6 +10067,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedByteOutput: """Dataclass for MalformedByteOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_BYTE_OUTPUT, self) @@ -9644,6 +10155,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedContentTypeWithBodyOutput: """Dataclass for MalformedContentTypeWithBodyOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_CONTENT_TYPE_WITH_BODY_OUTPUT, self) @@ -9731,6 +10252,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedContentTypeWithGenericStringOutput: """Dataclass for MalformedContentTypeWithGenericStringOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct( _SCHEMA_MALFORMED_CONTENT_TYPE_WITH_GENERIC_STRING_OUTPUT, self @@ -9804,6 +10335,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedContentTypeWithoutBodyOutput: """Dataclass for MalformedContentTypeWithoutBodyOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct( _SCHEMA_MALFORMED_CONTENT_TYPE_WITHOUT_BODY_OUTPUT, self @@ -9894,6 +10435,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedContentTypeWithoutBodyEmptyInputOutput: """Dataclass for MalformedContentTypeWithoutBodyEmptyInputOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct( _SCHEMA_MALFORMED_CONTENT_TYPE_WITHOUT_BODY_EMPTY_INPUT_OUTPUT, self @@ -9980,6 +10531,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedContentTypeWithPayloadOutput: """Dataclass for MalformedContentTypeWithPayloadOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct( _SCHEMA_MALFORMED_CONTENT_TYPE_WITH_PAYLOAD_OUTPUT, self @@ -10100,6 +10661,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedDoubleOutput: """Dataclass for MalformedDoubleOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_DOUBLE_OUTPUT, self) @@ -10214,6 +10785,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedFloatOutput: """Dataclass for MalformedFloatOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_FLOAT_OUTPUT, self) @@ -10330,6 +10911,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedIntegerOutput: """Dataclass for MalformedIntegerOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_INTEGER_OUTPUT, self) @@ -10434,6 +11025,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedListOutput: """Dataclass for MalformedListOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_LIST_OUTPUT, self) @@ -10547,6 +11148,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedLongOutput: """Dataclass for MalformedLongOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_LONG_OUTPUT, self) @@ -10651,6 +11262,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedMapOutput: """Dataclass for MalformedMapOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_MAP_OUTPUT, self) @@ -10741,6 +11362,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedRequestBodyOutput: """Dataclass for MalformedRequestBodyOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_REQUEST_BODY_OUTPUT, self) @@ -10857,6 +11488,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedShortOutput: """Dataclass for MalformedShortOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_SHORT_OUTPUT, self) @@ -10933,6 +11574,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedStringOutput: """Dataclass for MalformedStringOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_STRING_OUTPUT, self) @@ -11014,6 +11665,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedTimestampBodyDateTimeOutput: """Dataclass for MalformedTimestampBodyDateTimeOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_TIMESTAMP_BODY_DATE_TIME_OUTPUT, self) @@ -11097,6 +11758,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedTimestampBodyDefaultOutput: """Dataclass for MalformedTimestampBodyDefaultOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_TIMESTAMP_BODY_DEFAULT_OUTPUT, self) @@ -11180,6 +11851,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedTimestampBodyHttpDateOutput: """Dataclass for MalformedTimestampBodyHttpDateOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_TIMESTAMP_BODY_HTTP_DATE_OUTPUT, self) @@ -11265,6 +11946,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedTimestampHeaderDateTimeOutput: """Dataclass for MalformedTimestampHeaderDateTimeOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct( _SCHEMA_MALFORMED_TIMESTAMP_HEADER_DATE_TIME_OUTPUT, self @@ -11350,6 +12041,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedTimestampHeaderDefaultOutput: """Dataclass for MalformedTimestampHeaderDefaultOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_TIMESTAMP_HEADER_DEFAULT_OUTPUT, self) @@ -11433,6 +12134,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedTimestampHeaderEpochOutput: """Dataclass for MalformedTimestampHeaderEpochOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_TIMESTAMP_HEADER_EPOCH_OUTPUT, self) @@ -11516,6 +12227,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedTimestampPathDefaultOutput: """Dataclass for MalformedTimestampPathDefaultOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_TIMESTAMP_PATH_DEFAULT_OUTPUT, self) @@ -11599,6 +12320,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedTimestampPathEpochOutput: """Dataclass for MalformedTimestampPathEpochOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_TIMESTAMP_PATH_EPOCH_OUTPUT, self) @@ -11682,6 +12413,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedTimestampPathHttpDateOutput: """Dataclass for MalformedTimestampPathHttpDateOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_TIMESTAMP_PATH_HTTP_DATE_OUTPUT, self) @@ -11765,6 +12506,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedTimestampQueryDefaultOutput: """Dataclass for MalformedTimestampQueryDefaultOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_TIMESTAMP_QUERY_DEFAULT_OUTPUT, self) @@ -11848,6 +12599,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedTimestampQueryEpochOutput: """Dataclass for MalformedTimestampQueryEpochOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_TIMESTAMP_QUERY_EPOCH_OUTPUT, self) @@ -11931,6 +12692,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedTimestampQueryHttpDateOutput: """Dataclass for MalformedTimestampQueryHttpDateOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct( _SCHEMA_MALFORMED_TIMESTAMP_QUERY_HTTP_DATE_OUTPUT, self @@ -12101,6 +12872,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class MalformedUnionOutput: """Dataclass for MalformedUnionOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MALFORMED_UNION_OUTPUT, self) @@ -12179,6 +12960,16 @@ class MediaTypeHeaderOutput: json: str | JsonString | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_MEDIA_TYPE_HEADER_OUTPUT, self) @@ -12255,6 +13046,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class NoInputAndNoOutputOutput: """Dataclass for NoInputAndNoOutputOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_NO_INPUT_AND_NO_OUTPUT_OUTPUT, self) @@ -12323,6 +13124,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class NoInputAndOutputOutput: """Dataclass for NoInputAndOutputOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_NO_INPUT_AND_OUTPUT_OUTPUT, self) @@ -12433,6 +13244,16 @@ class NullAndEmptyHeadersClientOutput: c: list[str] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_NULL_AND_EMPTY_HEADERS_CLIENT_OUTPUT, self) @@ -12575,6 +13396,16 @@ class NullAndEmptyHeadersServerOutput: c: list[str] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_NULL_AND_EMPTY_HEADERS_SERVER_OUTPUT, self) @@ -12703,6 +13534,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class OmitsNullSerializesEmptyStringOutput: """Dataclass for OmitsNullSerializesEmptyStringOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_OMITS_NULL_SERIALIZES_EMPTY_STRING_OUTPUT, self) @@ -12894,6 +13735,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class OmitsSerializingEmptyListsOutput: """Dataclass for OmitsSerializingEmptyListsOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_OMITS_SERIALIZING_EMPTY_LISTS_OUTPUT, self) @@ -13069,6 +13920,16 @@ class OperationWithDefaultsOutput: zero_double: float = 0.0 + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_OPERATION_WITH_DEFAULTS_OUTPUT, self) @@ -13477,6 +14338,16 @@ class OperationWithNestedStructureOutput: dialog_map: dict[str, Dialog] = field(default_factory=dict[str, Dialog]) + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_OPERATION_WITH_NESTED_STRUCTURE_OUTPUT, self) @@ -13579,6 +14450,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class OutputStreamOutput: """Dataclass for OutputStreamOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_OUTPUT_STREAM_OUTPUT, self) @@ -13655,6 +14536,16 @@ class OutputStreamWithInitialResponseOutput: initial_response_member: str + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct( _SCHEMA_OUTPUT_STREAM_WITH_INITIAL_RESPONSE_OUTPUT, self @@ -13885,6 +14776,16 @@ class PostPlayerActionOutput: action: PlayerAction + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_POST_PLAYER_ACTION_OUTPUT, self) @@ -14091,6 +14992,16 @@ class PostUnionWithJsonNameOutput: value: UnionWithJsonName + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_POST_UNION_WITH_JSON_NAME_OUTPUT, self) @@ -14191,6 +15102,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class PutWithContentEncodingOutput: """Dataclass for PutWithContentEncodingOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_PUT_WITH_CONTENT_ENCODING_OUTPUT, self) @@ -14272,6 +15193,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class QueryIdempotencyTokenAutoFillOutput: """Dataclass for QueryIdempotencyTokenAutoFillOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_QUERY_IDEMPOTENCY_TOKEN_AUTO_FILL_OUTPUT, self) @@ -14366,6 +15297,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class QueryParamsAsStringListMapOutput: """Dataclass for QueryParamsAsStringListMapOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_QUERY_PARAMS_AS_STRING_LIST_MAP_OUTPUT, self) @@ -14456,6 +15397,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class QueryPrecedenceOutput: """Dataclass for QueryPrecedenceOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_QUERY_PRECEDENCE_OUTPUT, self) @@ -14524,6 +15475,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class ResponseCodeHttpFallbackOutput: """Dataclass for ResponseCodeHttpFallbackOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_RESPONSE_CODE_HTTP_FALLBACK_OUTPUT, self) @@ -14596,6 +15557,16 @@ class ResponseCodeRequiredOutput: response_code: int + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_RESPONSE_CODE_REQUIRED_OUTPUT, self) @@ -14827,6 +15798,16 @@ class SimpleScalarPropertiesOutput: double_value: float | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_SIMPLE_SCALAR_PROPERTIES_OUTPUT, self) @@ -15094,6 +16075,16 @@ class SparseJsonListsOutput: sparse_short_list: list[int | None] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_SPARSE_JSON_LISTS_OUTPUT, self) @@ -15405,6 +16396,16 @@ class SparseJsonMapsOutput: sparse_set_map: dict[str, list[str] | None] | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_SPARSE_JSON_MAPS_OUTPUT, self) @@ -15555,6 +16556,16 @@ class StreamingTraitsOutput: blob: StreamingBlob = b64decode("") + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_STREAMING_TRAITS_OUTPUT, self) @@ -15662,6 +16673,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class StreamingTraitsRequireLengthOutput: """Dataclass for StreamingTraitsRequireLengthOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_STREAMING_TRAITS_REQUIRE_LENGTH_OUTPUT, self) @@ -15759,6 +16780,16 @@ class StreamingTraitsWithMediaTypeOutput: blob: StreamingBlob = b64decode("") + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_STREAMING_TRAITS_WITH_MEDIA_TYPE_OUTPUT, self) @@ -15906,6 +16937,16 @@ class TestBodyStructureOutput: test_config: TestConfig | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_TEST_BODY_STRUCTURE_OUTPUT, self) @@ -15993,6 +17034,16 @@ class TestGetNoInputNoPayloadOutput: test_id: str | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_TEST_GET_NO_INPUT_NO_PAYLOAD_OUTPUT, self) @@ -16082,6 +17133,16 @@ class TestGetNoPayloadOutput: test_id: str | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_TEST_GET_NO_PAYLOAD_OUTPUT, self) @@ -16183,6 +17244,16 @@ class TestPayloadBlobOutput: data: bytes | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_TEST_PAYLOAD_BLOB_OUTPUT, self) @@ -16295,6 +17366,16 @@ class TestPayloadStructureOutput: payload_config: PayloadConfig | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_TEST_PAYLOAD_STRUCTURE_OUTPUT, self) @@ -16384,6 +17465,16 @@ class TestPostNoInputNoPayloadOutput: test_id: str | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_TEST_POST_NO_INPUT_NO_PAYLOAD_OUTPUT, self) @@ -16473,6 +17564,16 @@ class TestPostNoPayloadOutput: test_id: str | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_TEST_POST_NO_PAYLOAD_OUTPUT, self) @@ -16658,6 +17759,16 @@ class TimestampFormatHeadersOutput: target_date_time: datetime | None = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_TIMESTAMP_FORMAT_HEADERS_OUTPUT, self) @@ -16815,6 +17926,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: class UnitInputAndOutputOutput: """Dataclass for UnitInputAndOutputOutput structure.""" + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_UNIT_INPUT_AND_OUTPUT_OUTPUT, self) @@ -16997,6 +18118,16 @@ class RecursiveShapesOutput: nested: "RecursiveShapesInputOutputNested1 | None" = None + response_metadata: ResponseMetadata = field( + default=EMPTY_RESPONSE_METADATA, repr=False, compare=False + ) + """ + Metadata about the response that produced this output. Use this to + recover the request identifiers a service's support team needs in order + to investigate a call. Members of the metadata are individually + optional. + """ + def serialize(self, serializer: ShapeSerializer): serializer.write_struct(_SCHEMA_RECURSIVE_SHAPES_OUTPUT, self) diff --git a/codegen/build.gradle.kts b/codegen/build.gradle.kts index 45841f7ed..6bd0ca19e 100644 --- a/codegen/build.gradle.kts +++ b/codegen/build.gradle.kts @@ -15,5 +15,5 @@ allprojects { group = "software.amazon.smithy.python" - version = "0.5.1" + version = "0.6.0" } diff --git a/codegen/core/src/it/java/software/amazon/smithy/python/codegen/test/PythonCodegenTest.java b/codegen/core/src/it/java/software/amazon/smithy/python/codegen/test/PythonCodegenTest.java index 0d4579175..993b7ae07 100644 --- a/codegen/core/src/it/java/software/amazon/smithy/python/codegen/test/PythonCodegenTest.java +++ b/codegen/core/src/it/java/software/amazon/smithy/python/codegen/test/PythonCodegenTest.java @@ -53,5 +53,12 @@ public void testCodegen(@TempDir Path tempDir) throws IOException { var config = Files.readString(tempDir.resolve("src/weather/config.py")); assertTrue(config.contains("self.transport = transport or AIOHTTPClient()")); assertFalse(config.contains("self.transport = transport or AWSCRTHTTPClient()")); + + // An output that models a "responseMetadata" member gets both the SDK-reserved + // response_metadata attribute and the escaped modeled member, so neither shadows + // the other. + var models = Files.readString(tempDir.resolve("src/weather/models.py")); + assertTrue(models.contains("response_metadata: ResponseMetadata")); + assertTrue(models.contains("response_metadata_:")); } } diff --git a/codegen/core/src/it/resources/META-INF/smithy/main.smithy b/codegen/core/src/it/resources/META-INF/smithy/main.smithy index 27d0c4770..2975b37d1 100644 --- a/codegen/core/src/it/resources/META-INF/smithy/main.smithy +++ b/codegen/core/src/it/resources/META-INF/smithy/main.smithy @@ -49,6 +49,9 @@ operation TestUnionListOperation { } output := { response: String + // A member named responseMetadata collides with the SDK-reserved + // response_metadata attribute and must be escaped on the generated output. + responseMetadata: String } } diff --git a/codegen/core/src/main/java/software/amazon/smithy/python/codegen/CodegenUtils.java b/codegen/core/src/main/java/software/amazon/smithy/python/codegen/CodegenUtils.java index e1f6b5f98..cf1c66444 100644 --- a/codegen/core/src/main/java/software/amazon/smithy/python/codegen/CodegenUtils.java +++ b/codegen/core/src/main/java/software/amazon/smithy/python/codegen/CodegenUtils.java @@ -55,6 +55,18 @@ public final class CodegenUtils { */ public static final int MAX_PREFERRED_LINE_LENGTH = 88; + /** + * The name of the attribute carrying response metadata on operation outputs + * and modeled errors. + * + *
Declared on {@code CallError} for errors and emitted onto operation
+ * outputs by the structure generator. Because a service is free to model a
+ * member of the same name, the name is reserved on the members of those
+ * shapes and escaped if it collides. Both the emitter and the escaper read it
+ * from here so that they cannot disagree.
+ */
+ public static final String RESPONSE_METADATA_MEMBER = "response_metadata";
+
static final Set Operation inputs and other structures are not given the attribute, so
+ * their members are left alone.
+ */
+ private boolean carriesResponseMetadata(Shape container) {
+ return container.hasTrait(ErrorTrait.class)
+ || operationIndex.isOutputStructure(container);
+ }
+
private String getDefaultShapeName(Shape shape) {
// Use the service-aliased name
return StringUtils.capitalize(shape.getId().getName(service));
diff --git a/codegen/core/src/main/java/software/amazon/smithy/python/codegen/RuntimeTypes.java b/codegen/core/src/main/java/software/amazon/smithy/python/codegen/RuntimeTypes.java
index 7c5aed8e5..059faa126 100644
--- a/codegen/core/src/main/java/software/amazon/smithy/python/codegen/RuntimeTypes.java
+++ b/codegen/core/src/main/java/software/amazon/smithy/python/codegen/RuntimeTypes.java
@@ -40,6 +40,12 @@ public final class RuntimeTypes {
public static final Symbol TYPE_REGISTRY =
createSymbol("documents", "TypeRegistry", SmithyPythonDependency.SMITHY_CORE);
+ // smithy_core.response
+ public static final Symbol RESPONSE_METADATA =
+ createSymbol("response", "ResponseMetadata", SmithyPythonDependency.SMITHY_CORE);
+ public static final Symbol EMPTY_RESPONSE_METADATA =
+ createSymbol("response", "EMPTY_RESPONSE_METADATA", SmithyPythonDependency.SMITHY_CORE);
+
// smithy_core.exceptions
public static final Symbol MODELED_ERROR =
createSymbol("exceptions", "ModeledError", SmithyPythonDependency.SMITHY_CORE);
diff --git a/codegen/core/src/main/java/software/amazon/smithy/python/codegen/generators/StructureGenerator.java b/codegen/core/src/main/java/software/amazon/smithy/python/codegen/generators/StructureGenerator.java
index 1fad59015..07e0a57ed 100644
--- a/codegen/core/src/main/java/software/amazon/smithy/python/codegen/generators/StructureGenerator.java
+++ b/codegen/core/src/main/java/software/amazon/smithy/python/codegen/generators/StructureGenerator.java
@@ -19,6 +19,7 @@
import software.amazon.smithy.codegen.core.SymbolProvider;
import software.amazon.smithy.model.Model;
import software.amazon.smithy.model.knowledge.NullableIndex;
+import software.amazon.smithy.model.knowledge.OperationIndex;
import software.amazon.smithy.model.node.Node;
import software.amazon.smithy.model.shapes.MemberShape;
import software.amazon.smithy.model.shapes.Shape;
@@ -104,6 +105,7 @@ private void renderStructure() {
class $L:
${C|}
+ ${C|}
${C|}
${C|}
@@ -116,6 +118,7 @@ class $L:
symbol.getName(),
writer.consumer(w -> writeClassDocs()),
writer.consumer(w -> writeProperties()),
+ writer.consumer(w -> writeResponseMetadataProperty()),
writer.consumer(w -> generateSerializeMethod()),
writer.consumer(w -> generateDeserializeMethod()),
writer.consumer(w -> generateSmithyDefaultMethod()));
@@ -177,6 +180,38 @@ private void writeClassDocs() {
writer.writeDocs(docs, context);
}
+ /**
+ * Writes the response metadata attribute onto operation outputs.
+ *
+ * The attribute is not part of the service's modeled data, so it is excluded
+ * from equality and from the generated repr. Excluding it from equality also
+ * keeps generated protocol tests comparing shapes by their modeled members
+ * alone.
+ *
+ * Errors receive the same attribute by inheriting it from the service error
+ * base class rather than having it written here.
+ */
+ private void writeResponseMetadataProperty() {
+ if (!OperationIndex.of(model).isOutputStructure(shape)) {
+ return;
+ }
+
+ writer.addStdlibImport("dataclasses", "field");
+ writer.write("""
+ $L: $T = field(default=$T, repr=False, compare=False)
+ $C
+ """,
+ CodegenUtils.RESPONSE_METADATA_MEMBER,
+ RuntimeTypes.RESPONSE_METADATA,
+ RuntimeTypes.EMPTY_RESPONSE_METADATA,
+ writer.consumer(w -> w.writeDocs("""
+ Metadata about the response that produced this output.
+
+ Use this to recover the request identifiers a service's support team \
+ needs in order to investigate a call. Members of the metadata are \
+ individually optional.""", context)));
+ }
+
private void writeProperties() {
for (MemberShape member : requiredMembers) {
writer.pushState();
diff --git a/codegen/core/src/test/java/software/amazon/smithy/python/codegen/PythonSymbolProviderTest.java b/codegen/core/src/test/java/software/amazon/smithy/python/codegen/PythonSymbolProviderTest.java
index dcf1f46e2..0102a560c 100644
--- a/codegen/core/src/test/java/software/amazon/smithy/python/codegen/PythonSymbolProviderTest.java
+++ b/codegen/core/src/test/java/software/amazon/smithy/python/codegen/PythonSymbolProviderTest.java
@@ -108,6 +108,76 @@ public void testOperationNameCollidingWithClientMethodIsEscaped() {
.getName());
}
+ @Test
+ public void testResponseMetadataIsEscapedOnOutputsAndErrors() {
+ Model model = loadModel(RESPONSE_METADATA_MODEL);
+ PythonSymbolProvider provider = createProvider(model);
+
+ assertEquals("response_metadata_", memberName(provider, model, "GetThingOutput$responseMetadata"));
+ assertEquals("response_metadata_", memberName(provider, model, "ThingError$responseMetadata"));
+ }
+
+ @Test
+ public void testResponseMetadataIsNotEscapedOnOtherShapes() {
+ // Only outputs and errors are given the attribute, so members elsewhere
+ // must keep their natural name.
+ Model model = loadModel(RESPONSE_METADATA_MODEL);
+ PythonSymbolProvider provider = createProvider(model);
+
+ assertEquals("response_metadata", memberName(provider, model, "GetThingInput$responseMetadata"));
+ assertEquals("response_metadata", memberName(provider, model, "Nested$responseMetadata"));
+ }
+
+ @Test
+ public void testUnrelatedMembersOnOutputsAndErrorsAreUnaffected() {
+ Model model = loadModel(RESPONSE_METADATA_MODEL);
+ PythonSymbolProvider provider = createProvider(model);
+
+ assertEquals("thing_arn", memberName(provider, model, "GetThingOutput$thingArn"));
+ assertEquals("retry_after", memberName(provider, model, "ThingError$retryAfter"));
+ }
+
+ private static final String RESPONSE_METADATA_MODEL = """
+ $version: "2"
+ namespace smithy.example
+
+ service TestService {
+ version: "2024-01-01"
+ operations: [GetThing]
+ errors: [ThingError]
+ }
+
+ operation GetThing {
+ input: GetThingInput
+ output: GetThingOutput
+ }
+
+ structure GetThingInput {
+ responseMetadata: String
+ }
+
+ structure GetThingOutput {
+ responseMetadata: String
+ thingArn: String
+ nested: Nested
+ }
+
+ structure Nested {
+ responseMetadata: String
+ }
+
+ @error("client")
+ structure ThingError {
+ responseMetadata: String
+ retryAfter: String
+ }
+ """;
+
+ private static String memberName(PythonSymbolProvider provider, Model model, String relativeId) {
+ var member = model.expectShape(ShapeId.from(NS + "#" + relativeId), MemberShape.class);
+ return provider.toMemberName(member);
+ }
+
private static Model loadModel(String smithyIdl) {
return Model.assembler().addUnparsedModel("test.smithy", smithyIdl).assemble().unwrap();
}
diff --git a/packages/smithy-aws-core/.changes/next-release/smithy-aws-core-feature-70d7c47f420d4c4b8e5bfca35eb43d1e.json b/packages/smithy-aws-core/.changes/next-release/smithy-aws-core-feature-70d7c47f420d4c4b8e5bfca35eb43d1e.json
new file mode 100644
index 000000000..a1c39565a
--- /dev/null
+++ b/packages/smithy-aws-core/.changes/next-release/smithy-aws-core-feature-70d7c47f420d4c4b8e5bfca35eb43d1e.json
@@ -0,0 +1,4 @@
+{
+ "type": "feature",
+ "description": "AWS protocols now report request identifiers on operation outputs and errors, read from the `x-amzn-requestid`, `x-amz-request-id`, and `x-amz-id-2` headers. awsQuery reads them from the response body."
+}
diff --git a/packages/smithy-aws-core/src/smithy_aws_core/_private/query/__init__.py b/packages/smithy-aws-core/src/smithy_aws_core/_private/query/__init__.py
index 694350d1f..9fee18bb5 100644
--- a/packages/smithy-aws-core/src/smithy_aws_core/_private/query/__init__.py
+++ b/packages/smithy-aws-core/src/smithy_aws_core/_private/query/__init__.py
@@ -2,9 +2,11 @@
# SPDX-License-Identifier: Apache-2.0
from .errors import create_aws_query_error
+from .metadata import parse_aws_query_request_id
from .serializers import QueryShapeSerializer
__all__ = (
"QueryShapeSerializer",
"create_aws_query_error",
+ "parse_aws_query_request_id",
)
diff --git a/packages/smithy-aws-core/src/smithy_aws_core/_private/query/_xml.py b/packages/smithy-aws-core/src/smithy_aws_core/_private/query/_xml.py
new file mode 100644
index 000000000..eec6a77a1
--- /dev/null
+++ b/packages/smithy-aws-core/src/smithy_aws_core/_private/query/_xml.py
@@ -0,0 +1,20 @@
+# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+# SPDX-License-Identifier: Apache-2.0
+"""Helpers for reading awsQuery response bodies that are not shape-modeled."""
+
+from xml.etree.ElementTree import Element
+
+
+def local_name(tag: str) -> str:
+ """Strip namespace URI from an element tag: {uri}local -> local."""
+ if tag.startswith("{"):
+ return tag.split("}", 1)[1]
+ return tag
+
+
+def find_child(element: Element, name: str) -> Element | None:
+ """Return the first child element whose local name matches ``name``."""
+ for child in element:
+ if local_name(child.tag) == name:
+ return child
+ return None
diff --git a/packages/smithy-aws-core/src/smithy_aws_core/_private/query/errors.py b/packages/smithy-aws-core/src/smithy_aws_core/_private/query/errors.py
index af86fab12..f3726af15 100644
--- a/packages/smithy-aws-core/src/smithy_aws_core/_private/query/errors.py
+++ b/packages/smithy-aws-core/src/smithy_aws_core/_private/query/errors.py
@@ -1,7 +1,7 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from typing import TYPE_CHECKING, Any
-from xml.etree.ElementTree import Element, ParseError, fromstring
+from xml.etree.ElementTree import ParseError, fromstring
from smithy_core.documents import TypeRegistry
from smithy_core.exceptions import (
@@ -15,6 +15,7 @@
from smithy_core.shapes import ShapeID
from ...traits import AwsQueryErrorTrait
+from ._xml import find_child, local_name
try:
from smithy_xml import XMLCodec
@@ -34,21 +35,6 @@ def _assert_xml() -> None:
)
-def _local_name(tag: str) -> str:
- """Strip namespace URI from an element tag: {uri}local -> local."""
- if tag.startswith("{"):
- return tag.split("}", 1)[1]
- return tag
-
-
-def _find_child(element: Element, name: str) -> Element | None:
- """Return the first child element whose local name matches ``name``."""
- for child in element:
- if _local_name(child.tag) == name:
- return child
- return None
-
-
def _parse_aws_query_error_code(
body: bytes, wrapper_elements: tuple[str, ...]
) -> str | None:
@@ -59,15 +45,15 @@ def _parse_aws_query_error_code(
return None
if wrapper_elements:
- if _local_name(element.tag) != wrapper_elements[0]:
+ if local_name(element.tag) != wrapper_elements[0]:
return None
for wrapper in wrapper_elements[1:]:
- next_element = _find_child(element, wrapper)
+ next_element = find_child(element, wrapper)
if next_element is None:
return None
element = next_element
- code_element = _find_child(element, "Code")
+ code_element = find_child(element, "Code")
return code_element.text if code_element is not None else None
diff --git a/packages/smithy-aws-core/src/smithy_aws_core/_private/query/metadata.py b/packages/smithy-aws-core/src/smithy_aws_core/_private/query/metadata.py
new file mode 100644
index 000000000..c95b36d2a
--- /dev/null
+++ b/packages/smithy-aws-core/src/smithy_aws_core/_private/query/metadata.py
@@ -0,0 +1,26 @@
+# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+# SPDX-License-Identifier: Apache-2.0
+from xml.etree.ElementTree import ParseError, fromstring
+
+from ._xml import find_child
+
+
+def parse_aws_query_request_id(body: bytes) -> str | None:
+ """Parse the request ID from an awsQuery response body.
+
+ There is no request ID header. Successes nest it under ``ResponseMetadata``,
+ errors put it directly under the root.
+ """
+ try:
+ root = fromstring(body) # noqa: S314
+ except ParseError:
+ return None
+
+ metadata = find_child(root, "ResponseMetadata")
+ if metadata is not None:
+ nested = find_child(metadata, "RequestId")
+ if nested is not None and nested.text:
+ return nested.text
+
+ direct = find_child(root, "RequestId")
+ return direct.text or None if direct is not None else None
diff --git a/packages/smithy-aws-core/src/smithy_aws_core/aio/protocols.py b/packages/smithy-aws-core/src/smithy_aws_core/aio/protocols.py
index a9f85f278..d1a54724f 100644
--- a/packages/smithy-aws-core/src/smithy_aws_core/aio/protocols.py
+++ b/packages/smithy-aws-core/src/smithy_aws_core/aio/protocols.py
@@ -1,6 +1,7 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from collections.abc import Callable
+from dataclasses import replace
from inspect import iscoroutinefunction
from io import BytesIO
from typing import TYPE_CHECKING, Any, ClassVar, Final
@@ -23,10 +24,11 @@
)
from smithy_core.interfaces import TypedProperties, URI
from smithy_core.prelude import DOCUMENT
+from smithy_core.response import ResponseMetadata
from smithy_core.schemas import APIOperation, Schema
from smithy_core.serializers import SerializeableShape
from smithy_core.shapes import ShapeID, ShapeType
-from smithy_core.types import TimestampFormat
+from smithy_core.types import PropertyKey, TimestampFormat
from smithy_http import tuples_to_fields
from smithy_http.aio import HTTPRequest as _HTTPRequest
from smithy_http.aio.interfaces import HTTPErrorIdentifier, HTTPRequest, HTTPResponse
@@ -37,9 +39,15 @@
from smithy_http.deserializers import HTTPResponseDeserializer
from .._private.query.errors import create_aws_query_error
+from .._private.query.metadata import parse_aws_query_request_id
from .._private.query.serializers import QueryShapeSerializer
from ..traits import AwsJson1_0Trait, AwsJson1_1Trait, AwsQueryTrait, RestJson1Trait
-from ..utils import parse_document_discriminator, parse_error_code, parse_retry_after
+from ..utils import (
+ parse_document_discriminator,
+ parse_error_code,
+ parse_response_metadata,
+ parse_retry_after,
+)
try:
from smithy_json import JSONCodec, JSONDocument
@@ -139,7 +147,24 @@ class AWSJSONDocument: # type: ignore[no-redef]
pass
-class RestJsonClientProtocol(HttpBindingClientProtocol):
+class _AWSResponseMetadataMixin:
+ """Adds AWS request identifiers to extracted response metadata.
+
+ Mixed into each AWS protocol ahead of its HTTP base class, which supplies
+ only the status code. AWS protocols do not share a common base, so this is
+ applied per protocol.
+ """
+
+ def extract_response_metadata(
+ self,
+ *,
+ response: HTTPResponse,
+ context: TypedProperties,
+ ) -> ResponseMetadata:
+ return parse_response_metadata(response)
+
+
+class RestJsonClientProtocol(_AWSResponseMetadataMixin, HttpBindingClientProtocol):
"""An implementation of the aws.protocols#restJson1 protocol."""
_id: Final = RestJson1Trait.id
@@ -252,7 +277,7 @@ def create_event_receiver[
)
-class _AWSJSONClientProtocol(HttpClientProtocol):
+class _AWSJSONClientProtocol(_AWSResponseMetadataMixin, HttpClientProtocol):
_error_identifier: Final = AWSErrorIdentifier()
_id: ClassVar[ShapeID]
@@ -451,7 +476,15 @@ class AwsJson11ClientProtocol(_AWSJSONClientProtocol):
_content_type: ClassVar[str] = "application/x-amz-json-1.1"
-class AwsQueryClientProtocol(HttpClientProtocol):
+_QUERY_REQUEST_ID = PropertyKey(key="aws_query_request_id", value_type=str)
+"""Where :py:class:`AwsQueryClientProtocol` records a body-sourced request ID.
+
+The body is only available while deserializing, so the value is stored there for
+``extract_response_metadata`` to read back.
+"""
+
+
+class AwsQueryClientProtocol(_AWSResponseMetadataMixin, HttpClientProtocol):
"""An implementation of the aws.protocols#awsQuery protocol."""
_id: Final = AwsQueryTrait.id
@@ -475,6 +508,28 @@ def payload_codec(self) -> "XMLCodec":
def content_type(self) -> str:
return self._content_type
+ def extract_response_metadata(
+ self,
+ *,
+ response: HTTPResponse,
+ context: TypedProperties,
+ ) -> ResponseMetadata:
+ """Report the request ID, using the one recorded from the body as a fallback.
+
+ awsQuery normally carries the identifier in the body rather than a header, so
+ the mixin's header lookup usually finds nothing and the body value recorded
+ during deserialization is used. A header still wins when a service sends one.
+ """
+ metadata = _AWSResponseMetadataMixin.extract_response_metadata(
+ self, response=response, context=context
+ )
+ if metadata.request_id is not None:
+ return metadata
+ request_id = context.get(_QUERY_REQUEST_ID)
+ if request_id is None:
+ return metadata
+ return replace(metadata, request_id=request_id)
+
def serialize_request[
OperationInput: SerializeableShape,
OperationOutput: DeserializeableShape,
@@ -525,6 +580,16 @@ async def deserialize_response[
) -> OperationOutput:
body = await response.consume_body_async()
+ # Recorded before any branch below returns or raises, so successes, empty
+ # outputs and errors alike can report the identifier. Retry attempts share
+ # one properties object, so a body without an ID must clear any value a
+ # previous attempt left behind rather than let it be reported as this one's.
+ request_id = parse_aws_query_request_id(body)
+ if request_id is not None:
+ context[_QUERY_REQUEST_ID] = request_id
+ else:
+ context.pop(_QUERY_REQUEST_ID, None)
+
if not self._is_success(operation, context, response):
raise await self._create_error(
operation=operation,
diff --git a/packages/smithy-aws-core/src/smithy_aws_core/utils.py b/packages/smithy-aws-core/src/smithy_aws_core/utils.py
index 6e03b2fac..85c764643 100644
--- a/packages/smithy-aws-core/src/smithy_aws_core/utils.py
+++ b/packages/smithy-aws-core/src/smithy_aws_core/utils.py
@@ -3,13 +3,24 @@
import logging
from smithy_core.documents import Document
+from smithy_core.response import ResponseMetadata
from smithy_core.shapes import ShapeID, ShapeType
from smithy_http.aio.interfaces import HTTPResponse
+from smithy_http.interfaces import Field
_LOGGER = logging.getLogger(__name__)
_RETRY_AFTER_HEADER = "x-amz-retry-after"
+_REQUEST_ID_HEADERS = ("x-amzn-requestid", "x-amz-request-id")
+"""Headers that may carry the request ID, in order of preference.
+
+Most services send ``x-amzn-requestid``. Services in the Amazon S3 lineage send
+``x-amz-request-id`` instead.
+"""
+
+_EXTENDED_REQUEST_ID_HEADER = "x-amz-id-2"
+
def parse_retry_after(response: HTTPResponse) -> float | None:
"""Parse the ``x-amz-retry-after`` header into a backoff duration in seconds.
@@ -35,6 +46,43 @@ def parse_retry_after(response: HTTPResponse) -> float | None:
return None
+def _first_value(field: Field) -> str | None:
+ """The field's first value, or None if it has none or the first is empty.
+
+ Identifiers are single opaque tokens, so a repeated header is read as its
+ first value rather than joined the way ``as_string`` would.
+ """
+ return field.values[0] or None if field.values else None
+
+
+def parse_response_metadata(response: HTTPResponse) -> ResponseMetadata:
+ """Extract AWS response metadata from an HTTP response.
+
+ The request ID is read from the first present header in
+ ``_REQUEST_ID_HEADERS``. The extended request ID comes from
+ ``x-amz-id-2`` and is only sent by some services.
+
+ Absent or empty headers are left unset rather than raising, since this
+ information is diagnostic and must never fail a call.
+ """
+ request_id = None
+ for header in _REQUEST_ID_HEADERS:
+ if header in response.fields:
+ request_id = _first_value(response.fields[header])
+ if request_id is not None:
+ break
+
+ extended_request_id = None
+ if _EXTENDED_REQUEST_ID_HEADER in response.fields:
+ extended_request_id = _first_value(response.fields[_EXTENDED_REQUEST_ID_HEADER])
+
+ return ResponseMetadata(
+ request_id=request_id,
+ extended_request_id=extended_request_id,
+ http_status_code=response.status,
+ )
+
+
def parse_document_discriminator(
document: Document, default_namespace: str | None
) -> ShapeID | None:
diff --git a/packages/smithy-aws-core/tests/unit/aio/test_protocols.py b/packages/smithy-aws-core/tests/unit/aio/test_protocols.py
index 1a1a31467..cfeeedf08 100644
--- a/packages/smithy-aws-core/tests/unit/aio/test_protocols.py
+++ b/packages/smithy-aws-core/tests/unit/aio/test_protocols.py
@@ -574,3 +574,122 @@ async def test_aws_query_returns_generic_error_for_unknown_code() -> None:
"Unknown error for operation com.test#FailingOperation"
" - status: 500, code: UnknownThing"
)
+
+
+async def test_aws_query_reports_request_id_from_the_response_body() -> None:
+ protocol = AwsQueryClientProtocol(_SERVICE_SCHEMA, "2020-01-08")
+ context = TypedProperties()
+ response = HTTPResponse(
+ status=400,
+ fields=tuples_to_fields([]),
+ body=(
+ b"InvalidAction"
+ b"InvalidAction"
+ b"InvalidAction"
+ b"InvalidAction"
+ b"InvalidGreeting