Skip to content

Commit 653f6ed

Browse files
Merge pull request #437 from aws/staging/2f229c79-2af1-424a-8257-60cbec683b4f
Pull request: release <- staging/2f229c79-2af1-424a-8257-60cbec683b4f
2 parents 201032d + 44e9d79 commit 653f6ed

File tree

252 files changed

+3633
-1638
lines changed

Some content is hidden

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

252 files changed

+3633
-1638
lines changed

.changes/2.5.0.json

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"date": "2019-02-28",
3+
"version": "2.5.0",
4+
"entries": [
5+
{
6+
"category": "Alexa For Business",
7+
"type": "feature",
8+
"description": "This release adds the PutInvitationConfiguration API to configure the user invitation email template with custom attributes, and the GetInvitationConfiguration API to retrieve the configured values."
9+
},
10+
{
11+
"category": "Application Auto Scaling",
12+
"type": "feature",
13+
"description": "Documentation updates for application-autoscaling"
14+
},
15+
{
16+
"category": "AWS SDK for Java v2",
17+
"type": "bugfix",
18+
"description": "Fixed a bug where the request would fail of NoSuchElementException. This bug would affect `TranscribeStreaming#startStreamTranscription` request"
19+
},
20+
{
21+
"category": "Netty Nio HTTP Client",
22+
"type": "bugfix",
23+
"description": "Added try-catch blocks to prevent uncompleted future when exception is thrown."
24+
},
25+
{
26+
"category": "AWS SDK for Java v2",
27+
"type": "bugfix",
28+
"description": "Fix a bug in the code generator where the enum getter for a structure member is not being generated in some cases. Additionally, fix a bug that generated the wrong code for enum getters where the enum is not at the top level container but is nested, such as `List<List<EnumType>>`. This breaks the interface for affected services so the minor version is increased."
29+
},
30+
{
31+
"category": "AmazonApiGatewayV2",
32+
"type": "feature",
33+
"description": "Marking certain properties as explicitly required and fixing an issue with the GetApiMappings operation for ApiMapping resources."
34+
},
35+
{
36+
"category": "Amazon Simple Systems Manager (SSM)",
37+
"type": "feature",
38+
"description": "AWS Systems Manager State Manager now supports associations using documents shared by other AWS accounts."
39+
}
40+
]
41+
}

CHANGELOG.md

+26
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
# __2.5.0__ __2019-02-28__
2+
## __AWS SDK for Java v2__
3+
- ### Bugfixes
4+
- Fix a bug in the code generator where the enum getter for a structure member is not being generated in some cases. Additionally, fix a bug that generated the wrong code for enum getters where the enum is not at the top level container but is nested, such as `List<List<EnumType>>`. This breaks the interface for affected services so the minor version is increased.
5+
- Fixed a bug where the request would fail of NoSuchElementException. This bug would affect `TranscribeStreaming#startStreamTranscription` request
6+
7+
## __Alexa For Business__
8+
- ### Features
9+
- This release adds the PutInvitationConfiguration API to configure the user invitation email template with custom attributes, and the GetInvitationConfiguration API to retrieve the configured values.
10+
11+
## __Amazon Simple Systems Manager (SSM)__
12+
- ### Features
13+
- AWS Systems Manager State Manager now supports associations using documents shared by other AWS accounts.
14+
15+
## __AmazonApiGatewayV2__
16+
- ### Features
17+
- Marking certain properties as explicitly required and fixing an issue with the GetApiMappings operation for ApiMapping resources.
18+
19+
## __Application Auto Scaling__
20+
- ### Features
21+
- Documentation updates for application-autoscaling
22+
23+
## __Netty Nio HTTP Client__
24+
- ### Bugfixes
25+
- Added try-catch blocks to prevent uncompleted future when exception is thrown.
26+
127
# __2.4.17__ __2019-02-27__
228
## __AWS WAF__
329
- ### Features

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ You can import the whole SDK into your project (includes all services) as follow
4444
<dependency>
4545
<groupId>software.amazon.awssdk</groupId>
4646
<artifactId>aws-sdk-java</artifactId>
47-
<version>2.4.17</version>
47+
<version>2.5.0</version>
4848
</dependency>
4949
```
5050

@@ -56,12 +56,12 @@ Alternatively you can add dependencies for the specific services you use only:
5656
<dependency>
5757
<groupId>software.amazon.awssdk</groupId>
5858
<artifactId>ec2</artifactId>
59-
<version>2.4.17</version>
59+
<version>2.5.0</version>
6060
</dependency>
6161
<dependency>
6262
<groupId>software.amazon.awssdk</groupId>
6363
<artifactId>s3</artifactId>
64-
<version>2.4.17</version>
64+
<version>2.5.0</version>
6565
</dependency>
6666
```
6767

@@ -75,7 +75,7 @@ To automatically manage module versions (currently all modules have the same ver
7575
<dependency>
7676
<groupId>software.amazon.awssdk</groupId>
7777
<artifactId>bom</artifactId>
78-
<version>2.4.17</version>
78+
<version>2.5.0</version>
7979
<type>pom</type>
8080
<scope>import</scope>
8181
</dependency>

aws-sdk-java/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>software.amazon.awssdk</groupId>
66
<artifactId>aws-sdk-java-pom</artifactId>
7-
<version>2.4.17</version>
7+
<version>2.5.0</version>
88
<relativePath>../pom.xml</relativePath>
99
</parent>
1010
<artifactId>aws-sdk-java</artifactId>

bom-internal/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>aws-sdk-java-pom</artifactId>
77
<groupId>software.amazon.awssdk</groupId>
8-
<version>2.4.17</version>
8+
<version>2.5.0</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

bom/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>software.amazon.awssdk</groupId>
66
<artifactId>aws-sdk-java-pom</artifactId>
7-
<version>2.4.17</version>
7+
<version>2.5.0</version>
88
<relativePath>../pom.xml</relativePath>
99
</parent>
1010
<artifactId>bom</artifactId>

bundle/pom.xml

+1-1
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.4.17</version>
24+
<version>2.5.0</version>
2525
</parent>
2626
<artifactId>bundle</artifactId>
2727
<packaging>jar</packaging>

codegen-lite-maven-plugin/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>software.amazon.awssdk</groupId>
99
<artifactId>aws-sdk-java-pom</artifactId>
10-
<version>2.4.17</version>
10+
<version>2.5.0</version>
1111
<relativePath>../pom.xml</relativePath>
1212
</parent>
1313
<artifactId>codegen-lite-maven-plugin</artifactId>

codegen-lite/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>software.amazon.awssdk</groupId>
88
<artifactId>aws-sdk-java-pom</artifactId>
9-
<version>2.4.17</version>
9+
<version>2.5.0</version>
1010
</parent>
1111
<artifactId>codegen-lite</artifactId>
1212
<name>AWS Java SDK :: Code Generator Lite</name>

codegen-maven-plugin/pom.xml

+1-1
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.4.17</version>
25+
<version>2.5.0</version>
2626
<relativePath>../pom.xml</relativePath>
2727
</parent>
2828
<artifactId>codegen-maven-plugin</artifactId>

codegen/pom.xml

+1-1
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.4.17</version>
24+
<version>2.5.0</version>
2525
</parent>
2626
<artifactId>codegen</artifactId>
2727
<name>AWS Java SDK :: Code Generator</name>

codegen/src/main/java/software/amazon/awssdk/codegen/internal/Utils.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,12 @@ public static boolean isExceptionShape(Shape shape) {
7070

7171
public static boolean isOrContainsEnumShape(Shape shape, Map<String, Shape> allShapes) {
7272
boolean isEnum = isEnumShape(shape);
73-
boolean isMapWithEnumMember = isMapShape(shape) && (isEnumShape(allShapes.get(shape.getMapKeyType().getShape())) ||
74-
isEnumShape(allShapes.get(shape.getMapValueType().getShape())));
75-
boolean isListWithEnumMember = isListShape(shape) && isEnumShape(allShapes.get(shape.getListMember().getShape()));
73+
boolean isMapWithEnumMember = isMapShape(shape)
74+
&& (isOrContainsEnumShape(allShapes.get(shape.getMapKeyType().getShape()), allShapes)
75+
|| isOrContainsEnumShape(allShapes.get(shape.getMapValueType().getShape()), allShapes));
76+
boolean isListWithEnumMember = isListShape(shape)
77+
&& isOrContainsEnumShape(allShapes.get(shape.getListMember().getShape()), allShapes);
78+
7679
return isEnum || isMapWithEnumMember || isListWithEnumMember;
7780
}
7881

codegen/src/main/java/software/amazon/awssdk/codegen/poet/model/AwsServiceModel.java

+10-42
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import java.util.ArrayList;
3131
import java.util.Collections;
3232
import java.util.List;
33-
import java.util.Objects;
3433
import java.util.Optional;
3534
import java.util.function.BiConsumer;
3635
import java.util.function.Function;
@@ -39,9 +38,7 @@
3938
import javax.lang.model.element.Modifier;
4039
import software.amazon.awssdk.annotations.SdkPublicApi;
4140
import software.amazon.awssdk.codegen.docs.DocumentationBuilder;
42-
import software.amazon.awssdk.codegen.internal.Utils;
4341
import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel;
44-
import software.amazon.awssdk.codegen.model.intermediate.MapModel;
4542
import software.amazon.awssdk.codegen.model.intermediate.MemberModel;
4643
import software.amazon.awssdk.codegen.model.intermediate.OperationModel;
4744
import software.amazon.awssdk.codegen.model.intermediate.ShapeModel;
@@ -53,7 +50,6 @@
5350
import software.amazon.awssdk.codegen.poet.eventstream.EventStreamUtils;
5451
import software.amazon.awssdk.core.SdkField;
5552
import software.amazon.awssdk.core.SdkPojo;
56-
import software.amazon.awssdk.core.runtime.TypeConverter;
5753
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
5854

5955
/**
@@ -68,6 +64,7 @@ public class AwsServiceModel implements ClassSpec {
6864
private final ShapeModelSpec shapeModelSpec;
6965
private final ModelMethodOverrides modelMethodOverrides;
7066
private final ModelBuilderSpecs modelBuilderSpecs;
67+
private final ServiceModelCopiers serviceModelCopiers;
7168

7269
public AwsServiceModel(IntermediateModel intermediateModel, ShapeModel shapeModel) {
7370
this.intermediateModel = intermediateModel;
@@ -80,6 +77,7 @@ public AwsServiceModel(IntermediateModel intermediateModel, ShapeModel shapeMode
8077
intermediateModel);
8178
this.modelMethodOverrides = new ModelMethodOverrides(this.poetExtensions);
8279
this.modelBuilderSpecs = new ModelBuilderSpecs(intermediateModel, this.shapeModel, this.typeProvider);
80+
this.serviceModelCopiers = new ServiceModelCopiers(this.intermediateModel);
8381
}
8482

8583
@Override
@@ -388,7 +386,8 @@ private Stream<MethodSpec> memberGetters(MemberModel member) {
388386
}
389387

390388
private boolean shouldGenerateEnumGetter(MemberModel member) {
391-
return Utils.isOrContainsEnum(member);
389+
return member.getEnumType() != null || MemberCopierSpec.isEnumCopyAvailable(member);
390+
392391
}
393392

394393
private MethodSpec enumMemberGetter(MemberModel member) {
@@ -411,49 +410,18 @@ private MethodSpec memberGetter(MemberModel member) {
411410

412411
private CodeBlock enumGetterStatement(MemberModel member) {
413412
String fieldName = member.getVariable().getVariableName();
414-
415-
if (member.isList()) {
416-
ClassName valueEnumClass = poetExtensions.getModelClass(member.getListModel().getListMemberModel().getEnumType());
417-
return CodeBlock.of("return $T.convert($N, $T::fromValue);", TypeConverter.class, fieldName, valueEnumClass);
418-
} else if (member.isMap()) {
419-
MapModel mapModel = member.getMapModel();
420-
String keyEnumType = mapModel.getKeyModel().getEnumType();
421-
String valueEnumType = mapModel.getValueModel().getEnumType();
422-
423-
CodeBlock keyConverter = keyEnumType != null ? enumConverterFunction(poetExtensions.getModelClass(keyEnumType))
424-
: identityFunction();
425-
CodeBlock valueConverter = valueEnumType != null ? enumConverterFunction(poetExtensions.getModelClass(valueEnumType))
426-
: identityFunction();
427-
428-
CodeBlock entryPredicate = mapEntryFilter(keyEnumType);
429-
430-
return CodeBlock.builder()
431-
.add("return $T.convert($N, ", TypeConverter.class, fieldName)
432-
.add(keyConverter).add(", ")
433-
.add(valueConverter).add(", ")
434-
.add(entryPredicate).add(");")
435-
.build();
413+
if (member.isList() || member.isMap()) {
414+
Optional<ClassName> copier = serviceModelCopiers.copierClassFor(member);
415+
if (!copier.isPresent()) {
416+
throw new IllegalStateException("Don't know how to copy " + fieldName + " with enum elements!");
417+
}
418+
return CodeBlock.of("return $T.$N($N);", copier.get(), serviceModelCopiers.stringToEnumCopyMethodName(), fieldName);
436419
} else {
437420
ClassName enumClass = poetExtensions.getModelClass(member.getEnumType());
438421
return CodeBlock.of("return $T.fromValue($N);", enumClass, fieldName);
439422
}
440423
}
441424

442-
private CodeBlock mapEntryFilter(String keyEnumType) {
443-
// Don't include UNKNOWN_TO_SDK_VERSION keys in the enum map. Customers should use the string version to get at that data.
444-
return keyEnumType != null ? CodeBlock.of("(k, v) -> !$T.equals(k, $T.UNKNOWN_TO_SDK_VERSION)",
445-
Objects.class, poetExtensions.getModelClass(keyEnumType))
446-
: CodeBlock.of("(k, v) -> true");
447-
}
448-
449-
private CodeBlock enumConverterFunction(ClassName enumClass) {
450-
return CodeBlock.of("$T::fromValue", enumClass);
451-
}
452-
453-
private CodeBlock identityFunction() {
454-
return CodeBlock.of("$T.identity()", Function.class);
455-
}
456-
457425
private CodeBlock getterStatement(MemberModel model) {
458426
VariableModel modelVariable = model.getVariable();
459427
return CodeBlock.of("return $N;", modelVariable.getVariableName());

codegen/src/main/java/software/amazon/awssdk/codegen/poet/model/ListSetters.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ private ParameterSpec arrayOfModeledEnumAsParameter() {
235235
}
236236

237237
private ParameterSpec collectionOfModeledEnumAsParameter() {
238-
return ParameterSpec.builder(typeProvider.listWithEnumParameterType(memberModel()), fieldName())
238+
return ParameterSpec.builder(typeProvider.parameterType(memberModel(), true), fieldName())
239239
.build();
240240
}
241241
}

codegen/src/main/java/software/amazon/awssdk/codegen/poet/model/MapSetters.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public MethodSpec beanStyle() {
8383
}
8484

8585
private ParameterSpec mapWithEnumAsParameter() {
86-
return ParameterSpec.builder(typeProvider.mapWithEnumParameterType(memberModel().getMapModel()), fieldName())
86+
return ParameterSpec.builder(typeProvider.parameterType(memberModel(), true), fieldName())
8787
.build();
8888
}
8989
}

0 commit comments

Comments
 (0)