Add support for AWS Query protocol in the client#1029
Conversation
| @ProtocolTestFilter( | ||
| skipTests = { | ||
| "AwsQueryClientPopulatesDefaultsValuesWhenMissingInResponse", | ||
| "QueryCustomizedError", |
There was a problem hiding this comment.
Would be good to leave a comment here explaining why we ignore this one
There was a problem hiding this comment.
Plan on fixing this, wanted to get a draft out early.
...squery/src/main/java/software/amazon/smithy/java/aws/client/awsquery/FormUrlEncodedSink.java
Show resolved
Hide resolved
| writePercentEncoded(0x80 | (c & 0x3F)); | ||
| } else if (Character.isHighSurrogate(c) && i + 1 < len) { | ||
| char low = s.charAt(++i); | ||
| if (Character.isLowSurrogate(low)) { |
There was a problem hiding this comment.
What happens when it's not a low surrogate?
| import java.nio.ByteBuffer; | ||
| import java.util.Arrays; | ||
|
|
||
| final class FormUrlEncodedSink { |
There was a problem hiding this comment.
Is this application/x-www-form-urlencoded or RFC 3986 encoding? Should document.
There was a problem hiding this comment.
The later, added comments.
|
|
||
| <T extends SerializableStruct> T deserialize(ShapeBuilder<T> builder) { | ||
| try (var codec = XmlCodec.builder() | ||
| .wrapperElements(List.of(operationName + "Response", operationName + "Result")) |
There was a problem hiding this comment.
Can xmlName or whatever the trait is, change the wrapper names?
| return HttpRequest.builder() | ||
| .method("POST") | ||
| .uri(endpoint) | ||
| .headers(HttpHeaders.of(Map.of("Content-Type", CONTENT_TYPE_LIST))) |
There was a problem hiding this comment.
These are immutable headers, so they could be shared across all created requests using a static
| import software.amazon.smithy.java.xml.XmlUtil; | ||
| import software.amazon.smithy.model.shapes.ShapeId; | ||
|
|
||
| public final class AwsQueryClientProtocol extends HttpClientProtocol { |
There was a problem hiding this comment.
We might want to be able to customize this slightly for "EC2 query". Could probably be a followup.
d8e82d4 to
91a9f85
Compare
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.