Skip to content

Commit

Permalink
Merge pull request #954 from aws/staging/c38a7134-93cb-4c57-a609-b36b…
Browse files Browse the repository at this point in the history
…60c6179c

Pull request: release <- staging/c38a7134-93cb-4c57-a609-b36b60c6179c
  • Loading branch information
aws-sdk-java-automation authored Sep 14, 2020
2 parents b82aec6 + 2317516 commit c24f2e6
Show file tree
Hide file tree
Showing 311 changed files with 1,879 additions and 674 deletions.
36 changes: 36 additions & 0 deletions .changes/2.14.17.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"version": "2.14.17",
"date": "2020-09-14",
"entries": [
{
"type": "feature",
"category": "Amazon Elastic Compute Cloud",
"description": "This release adds support for the T4G instance family to the EC2 ModifyDefaultCreditSpecification and GetDefaultCreditSpecification APIs."
},
{
"type": "feature",
"category": "Amazon Managed Blockchain",
"description": "Introducing support for Hyperledger Fabric 1.4. When using framework version 1.4, the state database may optionally be specified when creating peer nodes (defaults to CouchDB)."
},
{
"type": "bugfix",
"category": "AWS SDK for Java v2",
"description": "Fix a bug in the SDK where the contents of the `AsyncRequestBody` is not included in the AWS Signature Version 4 calculation, which is required for some streaming operations such as Glacier `UploadArchive' and ClouSearch Domain `UploadDocuments`."
},
{
"type": "feature",
"category": "AWS Step Functions",
"description": "This release of the AWS Step Functions SDK introduces support for AWS X-Ray."
},
{
"type": "feature",
"category": "Amazon DocumentDB with MongoDB compatibility",
"description": "Updated API documentation and added paginators for DescribeCertificates, DescribeDBClusterParameterGroups, DescribeDBClusterParameters, DescribeDBClusterSnapshots and DescribePendingMaintenanceActions"
},
{
"type": "feature",
"category": "AWS SDK for Java v2",
"description": "Updated service endpoint metadata."
}
]
}
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# __2.14.17__ __2020-09-14__
## __AWS SDK for Java v2__
- ### Features
- Updated service endpoint metadata.

- ### Bugfixes
- Fix a bug in the SDK where the contents of the `AsyncRequestBody` is not included in the AWS Signature Version 4 calculation, which is required for some streaming operations such as Glacier `UploadArchive' and ClouSearch Domain `UploadDocuments`.

## __AWS Step Functions__
- ### Features
- This release of the AWS Step Functions SDK introduces support for AWS X-Ray.

## __Amazon DocumentDB with MongoDB compatibility__
- ### Features
- Updated API documentation and added paginators for DescribeCertificates, DescribeDBClusterParameterGroups, DescribeDBClusterParameters, DescribeDBClusterSnapshots and DescribePendingMaintenanceActions

## __Amazon Elastic Compute Cloud__
- ### Features
- This release adds support for the T4G instance family to the EC2 ModifyDefaultCreditSpecification and GetDefaultCreditSpecification APIs.

## __Amazon Managed Blockchain__
- ### Features
- Introducing support for Hyperledger Fabric 1.4. When using framework version 1.4, the state database may optionally be specified when creating peer nodes (defaults to CouchDB).

# __2.14.16__ __2020-09-11__
## __AWS SDK for Java v2__
- ### Features
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ To automatically manage module versions (currently all modules have the same ver
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.14.16</version>
<version>2.14.17</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -83,12 +83,12 @@ Alternatively you can add dependencies for the specific services you use only:
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>ec2</artifactId>
<version>2.14.16</version>
<version>2.14.17</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
<version>2.14.16</version>
<version>2.14.17</version>
</dependency>
```

Expand All @@ -100,7 +100,7 @@ You can import the whole SDK into your project (includes *ALL* services). Please
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java</artifactId>
<version>2.14.16</version>
<version>2.14.17</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion archetypes/archetype-lambda/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>archetypes</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.14.16</version>
<version>2.14.17</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>archetype-lambda</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion archetypes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>aws-sdk-java-pom</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.14.16</version>
<version>2.14.17</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>archetypes</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion aws-sdk-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java-pom</artifactId>
<version>2.14.16</version>
<version>2.14.17</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>aws-sdk-java</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion bom-internal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>aws-sdk-java-pom</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.14.16</version>
<version>2.14.17</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java-pom</artifactId>
<version>2.14.16</version>
<version>2.14.17</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>bom</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java-pom</artifactId>
<version>2.14.16</version>
<version>2.14.17</version>
</parent>
<artifactId>bundle</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion codegen-lite-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java-pom</artifactId>
<version>2.14.16</version>
<version>2.14.17</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>codegen-lite-maven-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion codegen-lite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java-pom</artifactId>
<version>2.14.16</version>
<version>2.14.17</version>
</parent>
<artifactId>codegen-lite</artifactId>
<name>AWS Java SDK :: Code Generator Lite</name>
Expand Down
2 changes: 1 addition & 1 deletion codegen-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java-pom</artifactId>
<version>2.14.16</version>
<version>2.14.17</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>codegen-maven-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion codegen/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java-pom</artifactId>
<version>2.14.16</version>
<version>2.14.17</version>
</parent>
<artifactId>codegen</artifactId>
<name>AWS Java SDK :: Code Generator</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.auth.signer.AsyncAws4Signer;
import software.amazon.awssdk.awscore.client.config.AwsClientOption;
import software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler;
import software.amazon.awssdk.awscore.client.handler.AwsClientHandlerUtils;
Expand All @@ -49,7 +50,9 @@
import software.amazon.awssdk.codegen.model.config.customization.UtilitiesMethod;
import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel;
import software.amazon.awssdk.codegen.model.intermediate.OperationModel;
import software.amazon.awssdk.codegen.model.intermediate.Protocol;
import software.amazon.awssdk.codegen.model.intermediate.ShapeModel;
import software.amazon.awssdk.codegen.model.service.AuthType;
import software.amazon.awssdk.codegen.poet.PoetExtensions;
import software.amazon.awssdk.codegen.poet.PoetUtils;
import software.amazon.awssdk.codegen.poet.StaticImport;
Expand Down Expand Up @@ -119,8 +122,9 @@ public TypeSpec poetSpec() {
classBuilder.addMethod(applyPaginatorUserAgentMethod(poetExtensions, model));
}

if (model.containsRequestSigners() || model.containsRequestEventStreams()) {
if (model.containsRequestSigners() || model.containsRequestEventStreams() || hasStreamingV4AuthOperations()) {
classBuilder.addMethod(applySignerOverrideMethod(poetExtensions, model));
classBuilder.addMethod(isSignerOverriddenOnClientMethod());
}

if (model.getCustomizationConfig().getUtilitiesMethod() != null) {
Expand Down Expand Up @@ -224,9 +228,14 @@ protected MethodSpec.Builder operationBody(MethodSpec.Builder builder, Operation
builder.addStatement("apiCallMetricCollector.reportMetric($T.$L, $S)",
CoreMetric.class, "OPERATION_NAME", opModel.getOperationName());

builder.addCode(ClientClassUtils.callApplySignerOverrideMethod(opModel))
.addCode(ClientClassUtils.addEndpointTraitCode(opModel))
.addCode(protocolSpec.responseHandler(model, opModel));
if (model.getMetadata().getProtocol() != Protocol.API_GATEWAY && shouldUseAsyncWithBodySigner(opModel)) {
builder.addCode(applyAsyncWithBodyV4SignerOverride(opModel));
} else {
builder.addCode(ClientClassUtils.callApplySignerOverrideMethod(opModel));
}

builder.addCode(ClientClassUtils.addEndpointTraitCode(opModel))
.addCode(protocolSpec.responseHandler(model, opModel));
protocolSpec.errorResponseHandler(opModel).ifPresent(builder::addCode);
builder.addCode(eventToByteBufferPublisher(opModel));

Expand Down Expand Up @@ -400,4 +409,44 @@ private MethodSpec resolveMetricPublishersMethod() {

return methodBuilder.build();
}

private boolean shouldUseAsyncWithBodySigner(OperationModel opModel) {
if (opModel.getInputShape().getRequestSignerClassFqcn() != null) {
return false;
}

AuthType authTypeForOperation = opModel.getAuthType();

if (authTypeForOperation == AuthType.IAM) {
authTypeForOperation = model.getMetadata().getAuthType();
}

return authTypeForOperation == AuthType.V4 && opModel.hasStreamingInput();
}

private CodeBlock applyAsyncWithBodyV4SignerOverride(OperationModel opModel) {
return CodeBlock.builder()
.beginControlFlow("if (!isSignerOverridden($N))", "clientConfiguration")
.addStatement("$1L = applySignerOverride($1L, $2T.create())",
opModel.getInput().getVariableName(), AsyncAws4Signer.class)
.endControlFlow()
.build();
}

private MethodSpec isSignerOverriddenOnClientMethod() {
String clientConfigurationName = "clientConfiguration";

return MethodSpec.methodBuilder("isSignerOverridden")
.returns(boolean.class)
.addModifiers(PRIVATE, STATIC)
.addParameter(SdkClientConfiguration.class, clientConfigurationName)
.addStatement("return $T.TRUE.equals($N.option($T.$N))", Boolean.class, clientConfigurationName,
SdkClientOption.class, "SIGNER_OVERRIDDEN")
.build();
}

private boolean hasStreamingV4AuthOperations() {
return model.getOperations().values().stream()
.anyMatch(this::shouldUseAsyncWithBodySigner);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ static CodeBlock callApplySignerOverrideMethod(OperationModel opModel) {
} else if (opModel.hasEventStreamInput()) {
code.addStatement("$1L = applySignerOverride($1L, $2T.create())",
opModel.getInput().getVariableName(), EventStreamAws4Signer.class);

}

return code.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ public CodeBlock executionHandler(OperationModel opModel) {
ClassName requestType = poetExtensions.getModelClass(opModel.getInput().getVariableType());
ClassName marshaller = poetExtensions.getRequestTransformClass(opModel.getInputShape().getShapeName() + "Marshaller");


CodeBlock.Builder codeBlock = CodeBlock
.builder()
.add("\n\nreturn clientHandler.execute(new $T<$T, $T>()\n" +
Expand Down
Loading

0 comments on commit c24f2e6

Please sign in to comment.