-
Notifications
You must be signed in to change notification settings - Fork 23
Add support for AWS Query protocol in the client #1029
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
...query/src/it/java/software/amazon/smithy/java/aws/client/awsquery/AwsQueryProtocolTests.java
Outdated
Show resolved
Hide resolved
...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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when it's not a low surrogate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
| import java.nio.ByteBuffer; | ||
| import java.util.Arrays; | ||
|
|
||
| final class FormUrlEncodedSink { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this application/x-www-form-urlencoded or RFC 3986 encoding? Should document.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can xmlName or whatever the trait is, change the wrapper names?
...ry/src/main/java/software/amazon/smithy/java/aws/client/awsquery/AwsQueryClientProtocol.java
Outdated
Show resolved
Hide resolved
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to be able to customize this slightly for "EC2 query". Could probably be a followup.
d8e82d4 to
91a9f85
Compare
...ry/src/main/java/software/amazon/smithy/java/aws/client/awsquery/AwsQueryFormSerializer.java
Outdated
Show resolved
Hide resolved
...ry/src/main/java/software/amazon/smithy/java/aws/client/awsquery/AwsQueryFormSerializer.java
Outdated
Show resolved
Hide resolved
d5c54b0 to
de51146
Compare
|
approved but disabled automerge so michael can review tomorrow |
| this.service = Objects.requireNonNull(service, "service is required"); | ||
| this.version = Objects.requireNonNull(version, "version is required"); | ||
| this.errorDeserializer = HttpErrorDeserializer.builder() | ||
| .codec(XmlCodec.builder().build()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be different than the codec on the instance?
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.