Skip to content

Commit 3eadcaa

Browse files
Merge pull request #943 from aws/staging/bc86c3ff-c385-4d45-8499-6d061cf85869
Pull request: release <- staging/bc86c3ff-c385-4d45-8499-6d061cf85869
2 parents 59fb6fa + 359a16d commit 3eadcaa

File tree

298 files changed

+1261
-370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

298 files changed

+1261
-370
lines changed

.changes/2.14.9.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"version": "2.14.9",
3+
"date": "2020-09-01",
4+
"entries": [
5+
{
6+
"type": "feature",
7+
"category": "AWS SecurityHub",
8+
"description": "Added a PatchSummary object for security findings. The PatchSummary object provides details about the patch compliance status of an instance."
9+
},
10+
{
11+
"type": "bugfix",
12+
"category": "AWS SDK for Java v2",
13+
"description": "Code Generator test failures on Windows systems were fixed."
14+
},
15+
{
16+
"type": "feature",
17+
"category": "Amazon CodeGuru Reviewer",
18+
"description": "Add support for repository analysis based code reviews"
19+
}
20+
]
21+
}

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# __2.14.9__ __2020-09-01__
2+
## __AWS SDK for Java v2__
3+
- ### Bugfixes
4+
- Code Generator test failures on Windows systems were fixed.
5+
6+
## __AWS SecurityHub__
7+
- ### Features
8+
- Added a PatchSummary object for security findings. The PatchSummary object provides details about the patch compliance status of an instance.
9+
10+
## __Amazon CodeGuru Reviewer__
11+
- ### Features
12+
- Add support for repository analysis based code reviews
13+
114
# __2.14.8__ __2020-08-31__
215
## __AWS Backup__
316
- ### Features

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ checklist below:
123123
* [ ] If the change is related to an existing Bug Report or Feature Request,
124124
the issue number is referenced
125125
* [ ] A short description of the change added to
126-
[CHANGELOG.md](./CHANGELOG.md). Adding a new entry can be accomplished by
126+
[CHANGELOG.md](./CHANGELOG.md). Adding a new entry must be accomplished by
127127
running the `scripts/new-change` script and following the instructions.
128128
Commit the new file created by the script in `.changes/next-release` with
129129
your changes.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ To automatically manage module versions (currently all modules have the same ver
4949
<dependency>
5050
<groupId>software.amazon.awssdk</groupId>
5151
<artifactId>bom</artifactId>
52-
<version>2.14.8</version>
52+
<version>2.14.9</version>
5353
<type>pom</type>
5454
<scope>import</scope>
5555
</dependency>
@@ -83,12 +83,12 @@ Alternatively you can add dependencies for the specific services you use only:
8383
<dependency>
8484
<groupId>software.amazon.awssdk</groupId>
8585
<artifactId>ec2</artifactId>
86-
<version>2.14.8</version>
86+
<version>2.14.9</version>
8787
</dependency>
8888
<dependency>
8989
<groupId>software.amazon.awssdk</groupId>
9090
<artifactId>s3</artifactId>
91-
<version>2.14.8</version>
91+
<version>2.14.9</version>
9292
</dependency>
9393
```
9494

@@ -100,7 +100,7 @@ You can import the whole SDK into your project (includes *ALL* services). Please
100100
<dependency>
101101
<groupId>software.amazon.awssdk</groupId>
102102
<artifactId>aws-sdk-java</artifactId>
103-
<version>2.14.8</version>
103+
<version>2.14.9</version>
104104
</dependency>
105105
```
106106

archetypes/archetype-lambda/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<artifactId>archetypes</artifactId>
2222
<groupId>software.amazon.awssdk</groupId>
23-
<version>2.14.8</version>
23+
<version>2.14.9</version>
2424
</parent>
2525
<modelVersion>4.0.0</modelVersion>
2626
<artifactId>archetype-lambda</artifactId>

archetypes/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<artifactId>aws-sdk-java-pom</artifactId>
2222
<groupId>software.amazon.awssdk</groupId>
23-
<version>2.14.8</version>
23+
<version>2.14.9</version>
2424
</parent>
2525
<modelVersion>4.0.0</modelVersion>
2626
<artifactId>archetypes</artifactId>

aws-sdk-java/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<parent>
1818
<groupId>software.amazon.awssdk</groupId>
1919
<artifactId>aws-sdk-java-pom</artifactId>
20-
<version>2.14.8</version>
20+
<version>2.14.9</version>
2121
<relativePath>../pom.xml</relativePath>
2222
</parent>
2323
<artifactId>aws-sdk-java</artifactId>

bom-internal/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<artifactId>aws-sdk-java-pom</artifactId>
2222
<groupId>software.amazon.awssdk</groupId>
23-
<version>2.14.8</version>
23+
<version>2.14.9</version>
2424
</parent>
2525
<modelVersion>4.0.0</modelVersion>
2626

bom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<parent>
1818
<groupId>software.amazon.awssdk</groupId>
1919
<artifactId>aws-sdk-java-pom</artifactId>
20-
<version>2.14.8</version>
20+
<version>2.14.9</version>
2121
<relativePath>../pom.xml</relativePath>
2222
</parent>
2323
<artifactId>bom</artifactId>

bundle/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>software.amazon.awssdk</groupId>
2323
<artifactId>aws-sdk-java-pom</artifactId>
24-
<version>2.14.8</version>
24+
<version>2.14.9</version>
2525
</parent>
2626
<artifactId>bundle</artifactId>
2727
<packaging>jar</packaging>

codegen-lite-maven-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>software.amazon.awssdk</groupId>
2424
<artifactId>aws-sdk-java-pom</artifactId>
25-
<version>2.14.8</version>
25+
<version>2.14.9</version>
2626
<relativePath>../pom.xml</relativePath>
2727
</parent>
2828
<artifactId>codegen-lite-maven-plugin</artifactId>

codegen-lite/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>software.amazon.awssdk</groupId>
2323
<artifactId>aws-sdk-java-pom</artifactId>
24-
<version>2.14.8</version>
24+
<version>2.14.9</version>
2525
</parent>
2626
<artifactId>codegen-lite</artifactId>
2727
<name>AWS Java SDK :: Code Generator Lite</name>

codegen-maven-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>software.amazon.awssdk</groupId>
2424
<artifactId>aws-sdk-java-pom</artifactId>
25-
<version>2.14.8</version>
25+
<version>2.14.9</version>
2626
<relativePath>../pom.xml</relativePath>
2727
</parent>
2828
<artifactId>codegen-maven-plugin</artifactId>

codegen/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>software.amazon.awssdk</groupId>
2323
<artifactId>aws-sdk-java-pom</artifactId>
24-
<version>2.14.8</version>
24+
<version>2.14.9</version>
2525
</parent>
2626
<artifactId>codegen</artifactId>
2727
<name>AWS Java SDK :: Code Generator</name>

codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/CustomizationConfig.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,13 @@ public class CustomizationConfig {
165165
*/
166166
private boolean enableEndpointDiscoveryMethodRequired = false;
167167

168+
/**
169+
* Allow a customer to set an endpoint override AND bypass endpoint discovery on their client even when endpoint discovery
170+
* enabled is true and endpoint discovery is required for an operation. This customization should almost never be "true"
171+
* because it creates a confusing customer experience.
172+
*/
173+
private boolean allowEndpointOverrideForEndpointDiscoveryRequiredOperations = false;
174+
168175
private CustomizationConfig() {
169176
}
170177

@@ -420,4 +427,14 @@ public boolean isEnableEndpointDiscoveryMethodRequired() {
420427
public void setEnableEndpointDiscoveryMethodRequired(boolean enableEndpointDiscoveryMethodRequired) {
421428
this.enableEndpointDiscoveryMethodRequired = enableEndpointDiscoveryMethodRequired;
422429
}
430+
431+
public boolean allowEndpointOverrideForEndpointDiscoveryRequiredOperations() {
432+
return allowEndpointOverrideForEndpointDiscoveryRequiredOperations;
433+
}
434+
435+
public void setAllowEndpointOverrideForEndpointDiscoveryRequiredOperations(
436+
boolean allowEndpointOverrideForEndpointDiscoveryRequiredOperations) {
437+
this.allowEndpointOverrideForEndpointDiscoveryRequiredOperations =
438+
allowEndpointOverrideForEndpointDiscoveryRequiredOperations;
439+
}
423440
}

codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/AsyncClientClass.java

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,17 @@ private MethodSpec constructor(Builder classBuilder) {
166166
EndpointDiscoveryRefreshCache.class,
167167
poetExtensions.getClientClass(model.getNamingStrategy().getServiceName() +
168168
"AsyncEndpointDiscoveryCacheLoader"));
169+
170+
if (model.getCustomizationConfig().allowEndpointOverrideForEndpointDiscoveryRequiredOperations()) {
171+
builder.beginControlFlow("if (clientConfiguration.option(SdkClientOption.ENDPOINT_OVERRIDDEN) == "
172+
+ "Boolean.TRUE)");
173+
builder.addStatement("log.warn($S)",
174+
"Endpoint discovery is enabled for this client, and an endpoint override was also "
175+
+ "specified. This will disable endpoint discovery for methods that require it, instead "
176+
+ "using the specified endpoint override. This may or may not be what you intended.");
177+
builder.endControlFlow();
178+
}
179+
169180
builder.endControlFlow();
170181
}
171182

@@ -220,8 +231,37 @@ protected MethodSpec.Builder operationBody(MethodSpec.Builder builder, Operation
220231
builder.addCode(eventToByteBufferPublisher(opModel));
221232

222233
if (opModel.getEndpointDiscovery() != null) {
234+
builder.addStatement("boolean endpointDiscoveryEnabled = "
235+
+ "clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED)");
236+
builder.addStatement("boolean endpointOverridden = "
237+
+ "clientConfiguration.option(SdkClientOption.ENDPOINT_OVERRIDDEN) == Boolean.TRUE");
238+
239+
if (opModel.getEndpointDiscovery().isRequired()) {
240+
if (!model.getCustomizationConfig().allowEndpointOverrideForEndpointDiscoveryRequiredOperations()) {
241+
builder.beginControlFlow("if (endpointOverridden)");
242+
builder.addStatement("throw new $T($S)", IllegalStateException.class,
243+
"This operation requires endpoint discovery, but an endpoint override was specified "
244+
+ "when the client was created. This is not supported.");
245+
builder.endControlFlow();
246+
247+
builder.beginControlFlow("if (!endpointDiscoveryEnabled)");
248+
builder.addStatement("throw new $T($S)", IllegalStateException.class,
249+
"This operation requires endpoint discovery, but endpoint discovery was disabled on the "
250+
+ "client.");
251+
builder.endControlFlow();
252+
} else {
253+
builder.beginControlFlow("if (endpointOverridden)");
254+
builder.addStatement("endpointDiscoveryEnabled = false");
255+
builder.nextControlFlow("else if (!endpointDiscoveryEnabled)");
256+
builder.addStatement("throw new $T($S)", IllegalStateException.class,
257+
"This operation requires endpoint discovery to be enabled, or for you to specify an "
258+
+ "endpoint override when the client is created.");
259+
builder.endControlFlow();
260+
}
261+
}
262+
223263
builder.addStatement("$T cachedEndpoint = null", URI.class);
224-
builder.beginControlFlow("if (clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED))");
264+
builder.beginControlFlow("if (endpointDiscoveryEnabled)");
225265
builder.addStatement("\n\nString key = clientConfiguration.option($T.CREDENTIALS_PROVIDER).resolveCredentials()" +
226266
".accessKeyId()", AwsClientOption.class);
227267
builder.addStatement("EndpointDiscoveryRequest endpointDiscoveryRequest = $T.builder().required($L)" +

codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/SyncClientClass.java

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import software.amazon.awssdk.metrics.MetricCollector;
6161
import software.amazon.awssdk.metrics.MetricPublisher;
6262
import software.amazon.awssdk.metrics.NoOpMetricCollector;
63+
import software.amazon.awssdk.utils.Logger;
6364

6465
//TODO Make SyncClientClass extend SyncClientInterface (similar to what we do in AsyncClientClass)
6566
public class SyncClientClass implements ClassSpec {
@@ -86,6 +87,7 @@ public TypeSpec poetSpec() {
8687
.addSuperinterface(interfaceClass)
8788
.addJavadoc("Internal implementation of {@link $1T}.\n\n@see $1T#builder()",
8889
interfaceClass)
90+
.addField(logger())
8991
.addField(SyncClientHandler.class, "clientHandler", PRIVATE, FINAL)
9092
.addField(protocolSpec.protocolFactory(model))
9193
.addField(SdkClientConfiguration.class, "clientConfiguration", PRIVATE, FINAL)
@@ -119,6 +121,12 @@ public TypeSpec poetSpec() {
119121
return classBuilder.build();
120122
}
121123

124+
private FieldSpec logger() {
125+
return FieldSpec.builder(Logger.class, "log", PRIVATE, STATIC, FINAL)
126+
.initializer("$T.loggerFor($T.class)", Logger.class, className)
127+
.build();
128+
}
129+
122130
private MethodSpec nameMethod() {
123131
return MethodSpec.methodBuilder("serviceName")
124132
.addAnnotation(Override.class)
@@ -154,6 +162,17 @@ private MethodSpec constructor() {
154162
EndpointDiscoveryRefreshCache.class,
155163
poetExtensions.getClientClass(model.getNamingStrategy().getServiceName() +
156164
"EndpointDiscoveryCacheLoader"));
165+
166+
if (model.getCustomizationConfig().allowEndpointOverrideForEndpointDiscoveryRequiredOperations()) {
167+
builder.beginControlFlow("if (clientConfiguration.option(SdkClientOption.ENDPOINT_OVERRIDDEN) == "
168+
+ "Boolean.TRUE)");
169+
builder.addStatement("log.warn(() -> $S)",
170+
"Endpoint discovery is enabled for this client, and an endpoint override was also "
171+
+ "specified. This will disable endpoint discovery for methods that require it, instead "
172+
+ "using the specified endpoint override. This may or may not be what you intended.");
173+
builder.endControlFlow();
174+
}
175+
157176
builder.endControlFlow();
158177
}
159178

@@ -181,8 +200,37 @@ private List<MethodSpec> operationMethodSpecs(OperationModel opModel) {
181200
protocolSpec.errorResponseHandler(opModel).ifPresent(method::addCode);
182201

183202
if (opModel.getEndpointDiscovery() != null) {
203+
method.addStatement("boolean endpointDiscoveryEnabled = "
204+
+ "clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED)");
205+
method.addStatement("boolean endpointOverridden = "
206+
+ "clientConfiguration.option(SdkClientOption.ENDPOINT_OVERRIDDEN) == Boolean.TRUE");
207+
208+
if (opModel.getEndpointDiscovery().isRequired()) {
209+
if (!model.getCustomizationConfig().allowEndpointOverrideForEndpointDiscoveryRequiredOperations()) {
210+
method.beginControlFlow("if (endpointOverridden)");
211+
method.addStatement("throw new $T($S)", IllegalStateException.class,
212+
"This operation requires endpoint discovery, but an endpoint override was specified "
213+
+ "when the client was created. This is not supported.");
214+
method.endControlFlow();
215+
216+
method.beginControlFlow("if (!endpointDiscoveryEnabled)");
217+
method.addStatement("throw new $T($S)", IllegalStateException.class,
218+
"This operation requires endpoint discovery, but endpoint discovery was disabled on the "
219+
+ "client.");
220+
method.endControlFlow();
221+
} else {
222+
method.beginControlFlow("if (endpointOverridden)");
223+
method.addStatement("endpointDiscoveryEnabled = false");
224+
method.nextControlFlow("else if (!endpointDiscoveryEnabled)");
225+
method.addStatement("throw new $T($S)", IllegalStateException.class,
226+
"This operation requires endpoint discovery to be enabled, or for you to specify an "
227+
+ "endpoint override when the client is created.");
228+
method.endControlFlow();
229+
}
230+
}
231+
184232
method.addStatement("$T cachedEndpoint = null", URI.class);
185-
method.beginControlFlow("if (clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED))");
233+
method.beginControlFlow("if (endpointDiscoveryEnabled)");
186234
method.addStatement("\n\nString key = clientConfiguration.option($T.CREDENTIALS_PROVIDER)." +
187235
"resolveCredentials().accessKeyId()", AwsClientOption.class);
188236
method.addStatement("EndpointDiscoveryRequest endpointDiscoveryRequest = $T.builder().required($L)" +
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package software.amazon.awssdk.codegen;
2+
3+
import software.amazon.awssdk.codegen.internal.Constant;
4+
5+
/**
6+
* Various convenience methods for strings manipulation required in Code Generator tests.
7+
*/
8+
public final class TestStringUtils {
9+
10+
/**
11+
* Not intended to be constructed directly.
12+
*/
13+
private TestStringUtils() {
14+
}
15+
16+
/**
17+
* Replaces all the newline (line feed/LF) characters ('&#x5c;u000A' or '\n') with the platform-dependent line separator char
18+
* (e.g. "&#x5c;u000D&#x5c;u000A" or "\r\n" on Windows systems).
19+
*
20+
* @param str string, containing '\n' chars to be replaced
21+
* @return original string with '\n' chars replaced with platform-dependent line separator chars
22+
* @see Constant#LF
23+
*/
24+
public static String toPlatformLfs(String str) {
25+
return str.replaceAll("\n", Constant.LF);
26+
}
27+
28+
}

codegen/src/test/java/software/amazon/awssdk/codegen/emitters/PoetGeneratorTaskIntegrationTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import static org.hamcrest.CoreMatchers.startsWith;
2121
import static org.hamcrest.MatcherAssert.assertThat;
2222
import static org.hamcrest.core.CombinableMatcher.both;
23+
import static software.amazon.awssdk.codegen.TestStringUtils.toPlatformLfs;
2324
import static software.amazon.awssdk.utils.FunctionalUtils.safeConsumer;
2425

2526
import com.squareup.javapoet.ClassName;
@@ -43,7 +44,7 @@ public final class PoetGeneratorTaskIntegrationTest {
4344
public void canGenerateJavaClass() throws Exception {
4445
String randomBaseDirectory = Files.createTempDirectory(getClass().getSimpleName()).toString();
4546
tempDirectories.add(randomBaseDirectory);
46-
String fileHeader = "/*\n * this is the file header\n */";
47+
String fileHeader = toPlatformLfs("/*\n * this is the file header\n */");
4748
ClassSpec classSpec = dummyClass();
4849

4950
PoetGeneratorTask sut = new PoetGeneratorTask(randomBaseDirectory, fileHeader, classSpec);

0 commit comments

Comments
 (0)