Skip to content
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

Make S3 SelectObjectContentInput ScanRange members pointers #2147

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changelog/0f5bdd8a631d4196bba7718e0f50e426.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "0f5bdd8a-631d-4196-bba7-718e0f50e426",
"type": "bugfix",
"description": "Fix the issue in the Amazon S3 SelectObjectContent method's parameter serialization where the Start and End parameters of the ScanRange were not being serialized correctly. The Amazon S3 API client has been updated with a breaking change to make ScanRange members pointer types.",
"modules": [
"service/s3"
]
}
8 changes: 8 additions & 0 deletions .changelog/1a2c46b4f6044155b3dd5979b26fd38e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "1a2c46b4-f604-4155-b3dd-5979b26fd38e",
"type": "announcement",
"description": "This release contains a breaking change to the Amazon S3 API client's SelectObjectContent method. ScanRange members [Start and End], of the SelectObjectContentInput were changed from value, to pointer types. Your applications using SelectObjectContent with ScanRange parameter will fail to compile and need to be updated to use pointer types for the Start and End numeric parameters. You can use the SDK helper utility [aws.Int64](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/aws#Int64) to convert literal numbers to pointer types.",
"modules": [
"service/s3"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package software.amazon.smithy.aws.go.codegen.customization;

import software.amazon.smithy.go.codegen.GoSettings;
import software.amazon.smithy.go.codegen.integration.GoIntegration;
import software.amazon.smithy.model.Model;
import software.amazon.smithy.model.shapes.ShapeId;
import software.amazon.smithy.model.shapes.StructureShape;
import software.amazon.smithy.model.traits.ClientOptionalTrait;

public class S3ScanRangeMembersClientOptional implements GoIntegration {

public static final ShapeId S3_SERVICE_SHAPE = ShapeId.from("com.amazonaws.s3#AmazonS3");
public static final ShapeId SCAN_RANGE_SHAPE = ShapeId.from("com.amazonaws.s3#ScanRange");
public static final String[] MEMBERS_TO_MAKE_OPTIONAL = { "Start", "End" };

/**
* /**
* Updates the API model to customize ScanRange member shapes to be
* clientOptional.
*
* @param model API model
* @param settings Go codegen settings
* @return updated API model
*/
@Override
public Model preprocessModel(Model model, GoSettings settings) {

if (!S3_SERVICE_SHAPE.equals(settings.getService())) {
return model;
}

Model.Builder builder = model.toBuilder();

StructureShape structureShape = model.expectShape(SCAN_RANGE_SHAPE,
StructureShape.class);
StructureShape.Builder structureShapeBuilder = structureShape.toBuilder();

for (String memberName : MEMBERS_TO_MAKE_OPTIONAL) {
structureShape.getMember(memberName).ifPresent(member -> {
structureShapeBuilder.addMember(member.toBuilder().addTrait(new ClientOptionalTrait()).build());
});
}

return builder.addShape(structureShapeBuilder.build()).build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ software.amazon.smithy.aws.go.codegen.customization.S3100Continue
software.amazon.smithy.aws.go.codegen.customization.ApiGatewayExportsNullabilityExceptionIntegration
software.amazon.smithy.aws.go.codegen.customization.LambdaRecursionDetection
software.amazon.smithy.aws.go.codegen.customization.SQSCustomizations
software.amazon.smithy.aws.go.codegen.customization.S3ScanRangeMembersClientOptional
8 changes: 4 additions & 4 deletions service/s3/serializers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions service/s3/types/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.