Skip to content

Commit e344027

Browse files
committed
Updating CRR support
1 parent 202f56a commit e344027

File tree

14 files changed

+398
-3830
lines changed

14 files changed

+398
-3830
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private ShapeModel generateInputShapeModel(Operation operation,
7979
shapeModel.setType(ShapeType.Request.getValue());
8080
shapeModel.setMarshaller(
8181
createInputShapeMarshaller(getServiceModel().getMetadata(), operation));
82-
shapeModel.setEndpointDiscovery(operation.getEndpointdiscovery());
82+
shapeModel.setEndpointDiscovery(operation.getEndpointDiscovery());
8383

8484
return shapeModel;
8585
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ public Map<String, OperationModel> constructOperations() {
158158
operationModel.setDocumentation(op.getDocumentation());
159159
operationModel.setIsAuthenticated(isAuthenticated(op));
160160
operationModel.setPaginated(isPaginated(op));
161-
operationModel.setEndpointOperation(op.isEndpointoperation());
162-
operationModel.setEndpointDiscovery(op.getEndpointdiscovery());
161+
operationModel.setEndpointOperation(op.isEndpointOperation());
162+
operationModel.setEndpointDiscovery(op.getEndpointDiscovery());
163163
operationModel.setEndpointTrait(op.getEndpoint());
164164

165165
Input input = op.getInput();

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ public class Operation {
3939

4040
private boolean requiresApiKey;
4141

42-
private EndpointDiscovery endpointdiscovery;
42+
@JsonProperty("endpointdiscovery")
43+
private EndpointDiscovery endpointDiscovery;
4344

44-
private boolean endpointoperation;
45+
@JsonProperty("endpointoperation")
46+
private boolean endpointOperation;
4547

4648
private EndpointTrait endpoint;
4749

@@ -143,20 +145,20 @@ public void setRequiresApiKey(boolean requiresApiKey) {
143145
this.requiresApiKey = requiresApiKey;
144146
}
145147

146-
public EndpointDiscovery getEndpointdiscovery() {
147-
return endpointdiscovery;
148+
public EndpointDiscovery getEndpointDiscovery() {
149+
return endpointDiscovery;
148150
}
149151

150-
public void setEndpointdiscovery(EndpointDiscovery endpointdiscovery) {
151-
this.endpointdiscovery = endpointdiscovery;
152+
public void setEndpointDiscovery(EndpointDiscovery endpointDiscovery) {
153+
this.endpointDiscovery = endpointDiscovery;
152154
}
153155

154-
public boolean isEndpointoperation() {
155-
return endpointoperation;
156+
public boolean isEndpointOperation() {
157+
return endpointOperation;
156158
}
157159

158-
public void setEndpointoperation(boolean endpointoperation) {
159-
this.endpointoperation = endpointoperation;
160+
public void setEndpointOperation(boolean endpointOperation) {
161+
this.endpointOperation = endpointOperation;
160162
}
161163

162164
public EndpointTrait getEndpoint() {

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,11 @@ protected MethodSpec.Builder operationBody(MethodSpec.Builder builder, Operation
193193
builder.addStatement("\n\nString key = clientConfiguration.option($T.CREDENTIALS_PROVIDER).resolveCredentials()" +
194194
".accessKeyId()", AwsClientOption.class);
195195
builder.addStatement("$T cachedEndpoint = $L.get(key, $L.endpointDiscoveryRequest(), " +
196-
"clientConfiguration.option(SdkClientOption.ENDPOINT))",
197-
URI.class, "endpointDiscoveryCache", opModel.getInputShape().getVariable().getVariableName());
198-
builder.addStatement("clientConfiguration.copy(o -> o.option($T.ENDPOINT, cachedEndpoint))", SdkClientOption.class);
196+
"clientConfiguration.option($T.ENDPOINT))",
197+
URI.class,
198+
"endpointDiscoveryCache",
199+
opModel.getInputShape().getVariable().getVariableName(),
200+
SdkClientOption.class);
199201
}
200202

201203
builder.addCode(protocolSpec.asyncExecutionHandler(model, opModel))

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,11 @@ private List<MethodSpec> operationMethodSpecs(OperationModel opModel) {
165165
method.addStatement("\n\nString key = clientConfiguration.option($T.CREDENTIALS_PROVIDER)." +
166166
"resolveCredentials().accessKeyId()", AwsClientOption.class);
167167
method.addStatement("$T cachedEndpoint = $L.get(key, $L.endpointDiscoveryRequest(), " +
168-
"clientConfiguration.option(SdkClientOption.ENDPOINT))",
169-
URI.class, "endpointDiscoveryCache", opModel.getInputShape().getVariable().getVariableName());
170-
method.addStatement("clientConfiguration.copy(o -> o.option($T.ENDPOINT, cachedEndpoint))", SdkClientOption.class);
168+
"clientConfiguration.option($T.ENDPOINT))",
169+
URI.class,
170+
"endpointDiscoveryCache",
171+
opModel.getInputShape().getVariable().getVariableName(),
172+
SdkClientOption.class);
171173
}
172174

173175
method.addCode(protocolSpec.executionHandler(opModel));

codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ public CodeBlock executionHandler(OperationModel opModel) {
167167
".withResponseHandler($N)\n" +
168168
".withErrorResponseHandler($N)\n" +
169169
hostPrefixExpression(opModel) +
170+
discoveredEndpoint(opModel) +
170171
".withInput($L)\n",
171172
ClientExecutionParams.class,
172173
requestType,

codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/ProtocolSpec.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,10 @@ default String hostPrefixExpression(OperationModel opModel) {
8585
? ".hostPrefixExpression(resolvedHostExpression)\n"
8686
: "";
8787
}
88+
89+
default String discoveredEndpoint(OperationModel opModel) {
90+
return opModel.getEndpointDiscovery() != null
91+
? ".discoveredEndpoint(cachedEndpoint)\n"
92+
: "";
93+
}
8894
}

codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/QueryProtocolSpec.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public CodeBlock executionHandler(OperationModel opModel) {
100100
".withResponseHandler($N)" +
101101
".withErrorResponseHandler($N)" +
102102
hostPrefixExpression(opModel) +
103+
discoveredEndpoint(opModel) +
103104
".withInput($L)",
104105
ClientExecutionParams.class,
105106
requestType,

0 commit comments

Comments
 (0)