Attach response metadata to operation outputs and errors, escaping collisions - #794
Open
ubaskota wants to merge 1 commit into
Open
Attach response metadata to operation outputs and errors, escaping collisions#794ubaskota wants to merge 1 commit into
ubaskota wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
Description of changes:
Response metadata was previously discarded. Every operation output and modeled error now carries a
response_metadataattribute holding the request ID, extended request ID, and HTTP status code of the response that produced it. It is always present, so callers need no null check; anhttp_status_codeofNonerecords that no response arrived.Codegen writes the field into each generated output class, since outputs share no base class. Modeled errors inherit it from
CallErrorinstead.extract_response_metadata()is added toClientProtocoland called once per call from_execute_request, on the path both successes and errors pass through, so each protocol decides where the identifiers live. AWS protocols read response headers, awsQuery reads the response body.Services that already model a member named
responseMetadataon an output or error have it renamed toresponse_metadata_so the two cannot collide. Only the Python attribute changes; the wire format is untouched.Testing:
responseMetadataon an output, an error and an input. Verified that codegen escaped the output and error members toresponse_metadata_and left the input untouched.ResponseMetadataon success, and directly under the root element on failure.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.