Skip to content

Add support for AWS Query protocol in the client#1029

Draft
adwsingh wants to merge 3 commits intomainfrom
adwsingh/aws-query
Draft

Add support for AWS Query protocol in the client#1029
adwsingh wants to merge 3 commits intomainfrom
adwsingh/aws-query

Conversation

@adwsingh
Copy link
Contributor

@adwsingh adwsingh commented Feb 4, 2026

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.

@ProtocolTestFilter(
skipTests = {
"AwsQueryClientPopulatesDefaultsValuesWhenMissingInResponse",
"QueryCustomizedError",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to leave a comment here explaining why we ignore this one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plan on fixing this, wanted to get a draft out early.

writePercentEncoded(0x80 | (c & 0x3F));
} else if (Character.isHighSurrogate(c) && i + 1 < len) {
char low = s.charAt(++i);
if (Character.isLowSurrogate(low)) {
Copy link
Member

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?

Copy link
Contributor Author

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 {
Copy link
Member

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.

Copy link
Contributor Author

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"))
Copy link
Member

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?

return HttpRequest.builder()
.method("POST")
.uri(endpoint)
.headers(HttpHeaders.of(Map.of("Content-Type", CONTENT_TYPE_LIST)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants