Skip to content

Commit c466277

Browse files
Merge pull request #615 from aws/staging/739d76ba-196f-4758-9c34-43c391f0cc8d
Pull request: release <- staging/739d76ba-196f-4758-9c34-43c391f0cc8d
2 parents 27d8bf3 + 9dc5394 commit c466277

File tree

254 files changed

+1732
-255
lines changed

Some content is hidden

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

254 files changed

+1732
-255
lines changed

.changes/2.8.5.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "2.8.5",
3+
"date": "2019-09-10",
4+
"entries": [
5+
{
6+
"type": "bugfix",
7+
"category": "AWS SDK for Java v2",
8+
"description": "Fix marshalling for models with xml attribute. See [#1182](https://github.com/aws/aws-sdk-java-v2/issues/1182)"
9+
},
10+
{
11+
"type": "feature",
12+
"category": "AWS Storage Gateway",
13+
"description": "The CloudWatchLogGroupARN parameter of the UpdateGatewayInformation API allows for configuring the gateway to use a CloudWatch log-group where Storage Gateway health events will be logged."
14+
}
15+
]
16+
}

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# __2.8.5__ __2019-09-10__
2+
## __AWS SDK for Java v2__
3+
- ### Bugfixes
4+
- Fix marshalling for models with xml attribute. See [#1182](https://github.com/aws/aws-sdk-java-v2/issues/1182)
5+
6+
## __AWS Storage Gateway__
7+
- ### Features
8+
- The CloudWatchLogGroupARN parameter of the UpdateGatewayInformation API allows for configuring the gateway to use a CloudWatch log-group where Storage Gateway health events will be logged.
9+
110
# __2.8.4__ __2019-09-09__
211
## __AWS App Mesh__
312
- ### Features

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ To automatically manage module versions (currently all modules have the same ver
4848
<dependency>
4949
<groupId>software.amazon.awssdk</groupId>
5050
<artifactId>bom</artifactId>
51-
<version>2.8.4</version>
51+
<version>2.8.5</version>
5252
<type>pom</type>
5353
<scope>import</scope>
5454
</dependency>
@@ -82,12 +82,12 @@ Alternatively you can add dependencies for the specific services you use only:
8282
<dependency>
8383
<groupId>software.amazon.awssdk</groupId>
8484
<artifactId>ec2</artifactId>
85-
<version>2.8.4</version>
85+
<version>2.8.5</version>
8686
</dependency>
8787
<dependency>
8888
<groupId>software.amazon.awssdk</groupId>
8989
<artifactId>s3</artifactId>
90-
<version>2.8.4</version>
90+
<version>2.8.5</version>
9191
</dependency>
9292
```
9393

@@ -99,7 +99,7 @@ You can import the whole SDK into your project (includes *ALL* services). Please
9999
<dependency>
100100
<groupId>software.amazon.awssdk</groupId>
101101
<artifactId>aws-sdk-java</artifactId>
102-
<version>2.8.4</version>
102+
<version>2.8.5</version>
103103
</dependency>
104104
```
105105

aws-sdk-java/pom.xml

Lines changed: 1 addition & 1 deletion
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.8.4</version>
7+
<version>2.8.5</version>
88
<relativePath>../pom.xml</relativePath>
99
</parent>
1010
<artifactId>aws-sdk-java</artifactId>

bom-internal/pom.xml

Lines changed: 1 addition & 1 deletion
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.8.4</version>
8+
<version>2.8.5</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

bom/pom.xml

Lines changed: 1 addition & 1 deletion
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.8.4</version>
7+
<version>2.8.5</version>
88
<relativePath>../pom.xml</relativePath>
99
</parent>
1010
<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.8.4</version>
24+
<version>2.8.5</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
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>software.amazon.awssdk</groupId>
99
<artifactId>aws-sdk-java-pom</artifactId>
10-
<version>2.8.4</version>
10+
<version>2.8.5</version>
1111
<relativePath>../pom.xml</relativePath>
1212
</parent>
1313
<artifactId>codegen-lite-maven-plugin</artifactId>

codegen-lite/pom.xml

Lines changed: 1 addition & 1 deletion
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.8.4</version>
9+
<version>2.8.5</version>
1010
</parent>
1111
<artifactId>codegen-lite</artifactId>
1212
<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.8.4</version>
25+
<version>2.8.5</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.8.4</version>
24+
<version>2.8.5</version>
2525
</parent>
2626
<artifactId>codegen</artifactId>
2727
<name>AWS Java SDK :: Code Generator</name>

codegen/src/main/java/software/amazon/awssdk/codegen/AddShapes.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ protected final ShapeModel generateShapeModel(String javaClassName, String shape
8282
shapeModel.setWrapper(shape.isWrapper());
8383
shapeModel.withIsEventStream(shape.isEventStream());
8484
shapeModel.withIsEvent(shape.isEvent());
85+
shapeModel.withXmlNamespace(shape.getXmlNamespace());
8586

8687
boolean hasHeaderMember = false;
8788
boolean hasStatusCodeMember = false;
@@ -184,6 +185,7 @@ private MemberModel generateMemberModel(String c2jMemberName, Member c2jMemberDe
184185
memberModel.setEventPayload(c2jMemberDefinition.isEventPayload());
185186
memberModel.setEventHeader(c2jMemberDefinition.isEventHeader());
186187
memberModel.setEndpointDiscoveryId(c2jMemberDefinition.isEndpointDiscoveryId());
188+
memberModel.setXmlAttribute(c2jMemberDefinition.isXmlAttribute());
187189

188190
// Pass the xmlNameSpace from the member reference
189191
if (c2jMemberDefinition.getXmlNamespace() != null) {

codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/MemberModel.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ public class MemberModel extends DocumentationModel {
8686

8787
private boolean sensitive;
8888

89+
private boolean xmlAttribute;
90+
8991
public String getName() {
9092
return name;
9193
}
@@ -544,6 +546,19 @@ public boolean isSensitive() {
544546
return sensitive;
545547
}
546548

549+
public boolean isXmlAttribute() {
550+
return xmlAttribute;
551+
}
552+
553+
public void setXmlAttribute(boolean xmlAttribute) {
554+
this.xmlAttribute = xmlAttribute;
555+
}
556+
557+
public MemberModel withXmlAttribtue(boolean xmlAttribtue) {
558+
this.xmlAttribute = xmlAttribtue;
559+
return this;
560+
}
561+
547562
@JsonIgnore
548563
public boolean hasBuilder() {
549564
return !(isSimple() || isList() || isMap());

codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/ShapeModel.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.Map;
2929
import java.util.stream.Collectors;
3030
import software.amazon.awssdk.codegen.model.intermediate.customization.ShapeCustomizationInfo;
31+
import software.amazon.awssdk.codegen.model.service.XmlNamespace;
3132
import software.amazon.awssdk.utils.StringUtils;
3233

3334
public class ShapeModel extends DocumentationModel implements HasDeprecation {
@@ -66,6 +67,8 @@ public class ShapeModel extends DocumentationModel implements HasDeprecation {
6667

6768
private boolean isEvent;
6869

70+
private XmlNamespace xmlNamespace;
71+
6972
public ShapeModel(@JsonProperty("c2jName") String c2jName) {
7073
this.c2jName = c2jName;
7174
}
@@ -558,4 +561,17 @@ public ShapeModel withIsEvent(boolean isEvent) {
558561
this.isEvent = isEvent;
559562
return this;
560563
}
564+
565+
public XmlNamespace getXmlNamespace() {
566+
return xmlNamespace;
567+
}
568+
569+
public ShapeModel withXmlNamespace(XmlNamespace xmlNamespace) {
570+
this.xmlNamespace = xmlNamespace;
571+
return this;
572+
}
573+
574+
public void setXmlNamespace(XmlNamespace xmlNamespace) {
575+
this.xmlNamespace = xmlNamespace;
576+
}
561577
}

codegen/src/main/java/software/amazon/awssdk/codegen/model/service/Member.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ public class Member {
5959

6060
private boolean sensitive;
6161

62+
private boolean xmlAttribute;
63+
6264
public String getShape() {
6365
return shape;
6466
}
@@ -202,4 +204,12 @@ public boolean isSensitive() {
202204
public void setSensitive(boolean sensitive) {
203205
this.sensitive = sensitive;
204206
}
207+
208+
public boolean isXmlAttribute() {
209+
return xmlAttribute;
210+
}
211+
212+
public void setXmlAttribute(boolean xmlAttribute) {
213+
this.xmlAttribute = xmlAttribute;
214+
}
205215
}

codegen/src/main/java/software/amazon/awssdk/codegen/model/service/Shape.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ public class Shape {
7373

7474
private boolean sensitive;
7575

76+
private XmlNamespace xmlNamespace;
77+
7678
public boolean isFault() {
7779
return fault;
7880
}
@@ -268,4 +270,13 @@ public boolean isSensitive() {
268270
public void setSensitive(boolean sensitive) {
269271
this.sensitive = sensitive;
270272
}
273+
274+
public XmlNamespace getXmlNamespace() {
275+
return xmlNamespace;
276+
}
277+
278+
public void setXmlNamespace(XmlNamespace xmlNamespace) {
279+
this.xmlNamespace = xmlNamespace;
280+
}
281+
271282
}

codegen/src/main/java/software/amazon/awssdk/codegen/model/service/XmlNamespace.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,23 @@
1717

1818
public class XmlNamespace {
1919

20+
private String prefix;
21+
2022
private String uri;
2123

24+
public String getPrefix() {
25+
return prefix;
26+
}
27+
28+
public void setPrefix(String prefix) {
29+
this.prefix = prefix;
30+
}
31+
2232
public String getUri() {
2333
return uri;
2434
}
2535

2636
public void setUri(String uri) {
2737
this.uri = uri;
2838
}
29-
30-
}
39+
}

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

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.Arrays;
2525
import java.util.Collections;
2626
import java.util.List;
27+
import java.util.Optional;
2728
import java.util.stream.Collectors;
2829
import javax.lang.model.element.Modifier;
2930
import software.amazon.awssdk.codegen.model.config.customization.CustomizationConfig;
@@ -32,6 +33,7 @@
3233
import software.amazon.awssdk.codegen.model.intermediate.Protocol;
3334
import software.amazon.awssdk.codegen.model.intermediate.ShapeModel;
3435
import software.amazon.awssdk.codegen.model.intermediate.ShapeType;
36+
import software.amazon.awssdk.codegen.model.service.XmlNamespace;
3537
import software.amazon.awssdk.codegen.naming.NamingStrategy;
3638
import software.amazon.awssdk.codegen.poet.PoetExtensions;
3739
import software.amazon.awssdk.core.SdkField;
@@ -44,6 +46,10 @@
4446
import software.amazon.awssdk.core.traits.MapTrait;
4547
import software.amazon.awssdk.core.traits.PayloadTrait;
4648
import software.amazon.awssdk.core.traits.TimestampFormatTrait;
49+
import software.amazon.awssdk.core.traits.XmlAttributeTrait;
50+
import software.amazon.awssdk.core.traits.XmlAttributesTrait;
51+
import software.amazon.awssdk.core.traits.XmlAttributesTrait.AttributeAccessors;
52+
import software.amazon.awssdk.utils.Pair;
4753

4854
/**
4955
* Provides Poet specs related to shape models.
@@ -169,6 +175,15 @@ private CodeBlock traits(MemberModel m) {
169175
if (m.getTimestampFormat() != null) {
170176
traits.add(createTimestampFormatTrait(m));
171177
}
178+
179+
if (m.getShape() != null && m.getShape().getXmlNamespace() != null) {
180+
traits.add(createXmlAttributesTrait(m));
181+
}
182+
183+
if (m.isXmlAttribute()) {
184+
traits.add(createXmlAttributeTrait());
185+
}
186+
172187
if (!traits.isEmpty()) {
173188
return CodeBlock.builder()
174189
.add(".traits(" + traits.stream().map(t -> "$L").collect(Collectors.joining(", ")) + ")",
@@ -278,6 +293,45 @@ private CodeBlock createListTrait(MemberModel m) {
278293
.build();
279294
}
280295

296+
private CodeBlock createXmlAttributeTrait() {
297+
return CodeBlock.builder()
298+
.add("$T.create()", ClassName.get(XmlAttributeTrait.class))
299+
.build();
300+
}
301+
302+
private CodeBlock createXmlAttributesTrait(MemberModel model) {
303+
ShapeModel shape = model.getShape();
304+
XmlNamespace xmlNamespace = shape.getXmlNamespace();
305+
String uri = xmlNamespace.getUri();
306+
String prefix = xmlNamespace.getPrefix();
307+
CodeBlock.Builder codeBlockBuilder = CodeBlock.builder()
308+
.add("$T.create(", ClassName.get(XmlAttributesTrait.class));
309+
310+
String namespacePrefix = "xmlns:" + prefix;
311+
codeBlockBuilder.add("$T.of($S, $T.builder().attributeGetter((ignore) -> $S).build())",
312+
Pair.class, namespacePrefix, AttributeAccessors.class, uri);
313+
314+
Optional<MemberModel> memberWithXmlAttribute = findMemberWithXmlAttribute(shape);
315+
memberWithXmlAttribute.ifPresent(m -> {
316+
String attributeLocation = m.getHttp().getMarshallLocationName();
317+
codeBlockBuilder
318+
.add(", $T.of($S, ", Pair.class, attributeLocation)
319+
.add("$T.builder()", AttributeAccessors.class)
320+
.add(".attributeGetter(t -> (($T)t).$L())\n",
321+
typeProvider.fieldType(model),
322+
m.getFluentGetterMethodName())
323+
.add(".build())");
324+
});
325+
326+
codeBlockBuilder.add(")");
327+
328+
return codeBlockBuilder.build();
329+
}
330+
331+
private static Optional<MemberModel> findMemberWithXmlAttribute(ShapeModel shapeModel) {
332+
return shapeModel.getMembers().stream().filter(MemberModel::isXmlAttribute).findAny();
333+
}
334+
281335
private String isFlattened(MemberModel m) {
282336
return m.getHttp().isFlattened() ? ".isFlattened(true)\n" : "";
283337
}

0 commit comments

Comments
 (0)