Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import javax.lang.model.element.Modifier;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.awscore.eventstream.EventStreamAsyncResponseTransformer;
import software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionPojoSupplier;
import software.amazon.awssdk.awscore.eventstream.RestEventStreamAsyncResponseTransformer;
Expand Down Expand Up @@ -250,8 +249,6 @@ public CodeBlock asyncExecutionHandler(IntermediateModel intermediateModel, Oper
String whenComplete = whenCompleteBody(opModel, customerResponseHandler);
if (!whenComplete.isEmpty()) {
String whenCompletedFutureName = "whenCompleted";
builder.addStatement("$T requestOverrideConfig = $L.overrideConfiguration().orElse(null)",
AwsRequestOverrideConfiguration.class, opModel.getInput().getVariableName());
builder.addStatement("$T<$T> $N = $N$L", CompletableFuture.class, executeFutureValueType,
whenCompletedFutureName, "executeFuture", whenComplete);
builder.addStatement("executeFuture = $T.forwardExceptionTo($N, executeFuture)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import javax.lang.model.element.Modifier;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel;
import software.amazon.awssdk.codegen.model.intermediate.OperationModel;
Expand Down Expand Up @@ -148,9 +147,6 @@ public CodeBlock asyncExecutionHandler(IntermediateModel intermediateModel, Oper
opModel.getInput().getVariableName(),
opModel.hasStreamingOutput() ? ", asyncResponseTransformer" : "");

builder.addStatement("$T requestOverrideConfig = $L.overrideConfiguration().orElse(null)",
AwsRequestOverrideConfiguration.class, opModel.getInput().getVariableName());

String whenCompleteFutureName = "whenCompleteFuture";
builder.addStatement("$T $N = null", ParameterizedTypeName.get(ClassName.get(CompletableFuture.class),
executeFutureValueType), whenCompleteFutureName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.codegen.model.config.customization.S3ArnableFieldConfig;
import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel;
import software.amazon.awssdk.codegen.model.intermediate.OperationModel;
Expand Down Expand Up @@ -178,9 +177,6 @@ public CodeBlock asyncExecutionHandler(IntermediateModel intermediateModel, Oper
s3ArnableFields(opModel, model).ifPresent(builder::add);
builder.add(".withInput($L) $L);", opModel.getInput().getVariableName(), opModel.hasStreamingOutput() ?
", asyncResponseTransformer" : "");
builder.addStatement("$T requestOverrideConfig = $L.overrideConfiguration().orElse(null)",
AwsRequestOverrideConfiguration.class, opModel.getInput().getVariableName());

String whenCompleteFutureName = "whenCompleteFuture";
builder.addStatement("$T $N = null", ParameterizedTypeName.get(ClassName.get(CompletableFuture.class),
executeFutureValueType), whenCompleteFutureName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ public CompletableFuture<APostOperationResponse> aPostOperation(APostOperationRe
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).hostPrefixExpression(resolvedHostExpression)
.withInput(aPostOperationRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = aPostOperationRequest.overrideConfiguration().orElse(null);
CompletableFuture<APostOperationResponse> whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
Expand Down Expand Up @@ -249,8 +248,6 @@ public CompletableFuture<APostOperationWithOutputResponse> aPostOperationWithOut
.withMarshaller(new APostOperationWithOutputRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(aPostOperationWithOutputRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = aPostOperationWithOutputRequest.overrideConfiguration()
.orElse(null);
CompletableFuture<APostOperationWithOutputResponse> whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
Expand Down Expand Up @@ -335,8 +332,6 @@ public CompletableFuture<Void> eventStreamOperation(EventStreamOperationRequest
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationRequest),
restAsyncResponseTransformer);
AwsRequestOverrideConfiguration requestOverrideConfig = eventStreamOperationRequest.overrideConfiguration().orElse(
null);
CompletableFuture<Void> whenCompleted = executeFuture.whenComplete((r, e) -> {
if (e != null) {
try {
Expand Down Expand Up @@ -412,8 +407,6 @@ public CompletableFuture<EventStreamOperationWithOnlyInputResponse> eventStreamO
.withAsyncRequestBody(AsyncRequestBody.fromPublisher(adapted)).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector)
.withInput(eventStreamOperationWithOnlyInputRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = eventStreamOperationWithOnlyInputRequest
.overrideConfiguration().orElse(null);
CompletableFuture<EventStreamOperationWithOnlyInputResponse> whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
Expand Down Expand Up @@ -494,8 +487,6 @@ public CompletableFuture<Void> eventStreamOperationWithOnlyOutput(
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector)
.withInput(eventStreamOperationWithOnlyOutputRequest), restAsyncResponseTransformer);
AwsRequestOverrideConfiguration requestOverrideConfig = eventStreamOperationWithOnlyOutputRequest
.overrideConfiguration().orElse(null);
CompletableFuture<Void> whenCompleted = executeFuture.whenComplete((r, e) -> {
if (e != null) {
try {
Expand Down Expand Up @@ -564,8 +555,6 @@ public CompletableFuture<GetWithoutRequiredMembersResponse> getWithoutRequiredMe
.withMarshaller(new GetWithoutRequiredMembersRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getWithoutRequiredMembersRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = getWithoutRequiredMembersRequest.overrideConfiguration()
.orElse(null);
CompletableFuture<GetWithoutRequiredMembersResponse> whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
Expand Down Expand Up @@ -625,8 +614,6 @@ public CompletableFuture<OperationWithChecksumRequiredResponse> operationWithChe
.withMetricCollector(apiCallMetricCollector)
.putExecutionAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED,
HttpChecksumRequired.create()).withInput(operationWithChecksumRequiredRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = operationWithChecksumRequiredRequest.overrideConfiguration()
.orElse(null);
CompletableFuture<OperationWithChecksumRequiredResponse> whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
Expand Down Expand Up @@ -683,8 +670,6 @@ public CompletableFuture<PaginatedOperationWithResultKeyResponse> paginatedOpera
.withMarshaller(new PaginatedOperationWithResultKeyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(paginatedOperationWithResultKeyRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = paginatedOperationWithResultKeyRequest
.overrideConfiguration().orElse(null);
CompletableFuture<PaginatedOperationWithResultKeyResponse> whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
Expand Down Expand Up @@ -718,7 +703,7 @@ public CompletableFuture<PaginatedOperationWithResultKeyResponse> paginatedOpera
* The following are few ways to use the response class:
* </p>
* 1) Using the subscribe helper method
*
*
* <pre>
* {@code
* software.amazon.awssdk.services.json.paginators.PaginatedOperationWithResultKeyPublisher publisher = client.paginatedOperationWithResultKeyPaginator(request);
Expand All @@ -728,19 +713,19 @@ public CompletableFuture<PaginatedOperationWithResultKeyResponse> paginatedOpera
* </pre>
*
* 2) Using a custom subscriber
*
*
* <pre>
* {@code
* software.amazon.awssdk.services.json.paginators.PaginatedOperationWithResultKeyPublisher publisher = client.paginatedOperationWithResultKeyPaginator(request);
* publisher.subscribe(new Subscriber<software.amazon.awssdk.services.json.model.PaginatedOperationWithResultKeyResponse>() {
*
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
*
*
* public void onNext(software.amazon.awssdk.services.json.model.PaginatedOperationWithResultKeyResponse response) { //... };
* });}
* </pre>
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
* <p>
* <b>Please notice that the configuration of MaxResults won't limit the number of results you get with the
Expand Down Expand Up @@ -818,8 +803,6 @@ public CompletableFuture<PaginatedOperationWithoutResultKeyResponse> paginatedOp
.withMarshaller(new PaginatedOperationWithoutResultKeyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(paginatedOperationWithoutResultKeyRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = paginatedOperationWithoutResultKeyRequest
.overrideConfiguration().orElse(null);
CompletableFuture<PaginatedOperationWithoutResultKeyResponse> whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
Expand Down Expand Up @@ -853,7 +836,7 @@ public CompletableFuture<PaginatedOperationWithoutResultKeyResponse> paginatedOp
* The following are few ways to use the response class:
* </p>
* 1) Using the subscribe helper method
*
*
* <pre>
* {@code
* software.amazon.awssdk.services.json.paginators.PaginatedOperationWithoutResultKeyPublisher publisher = client.paginatedOperationWithoutResultKeyPaginator(request);
Expand All @@ -863,19 +846,19 @@ public CompletableFuture<PaginatedOperationWithoutResultKeyResponse> paginatedOp
* </pre>
*
* 2) Using a custom subscriber
*
*
* <pre>
* {@code
* software.amazon.awssdk.services.json.paginators.PaginatedOperationWithoutResultKeyPublisher publisher = client.paginatedOperationWithoutResultKeyPaginator(request);
* publisher.subscribe(new Subscriber<software.amazon.awssdk.services.json.model.PaginatedOperationWithoutResultKeyResponse>() {
*
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
*
*
* public void onNext(software.amazon.awssdk.services.json.model.PaginatedOperationWithoutResultKeyResponse response) { //... };
* });}
* </pre>
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
* <p>
* <b>Please notice that the configuration of MaxResults won't limit the number of results you get with the
Expand Down Expand Up @@ -964,8 +947,6 @@ public CompletableFuture<StreamingInputOperationResponse> streamingInputOperatio
.asyncRequestBody(requestBody).build()).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector)
.withAsyncRequestBody(requestBody).withInput(streamingInputOperationRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = streamingInputOperationRequest.overrideConfiguration()
.orElse(null);
CompletableFuture<StreamingInputOperationResponse> whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
Expand Down Expand Up @@ -1040,8 +1021,6 @@ public <ReturnT> CompletableFuture<ReturnT> streamingInputOutputOperation(
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody)
.withInput(streamingInputOutputOperationRequest), asyncResponseTransformer);
AwsRequestOverrideConfiguration requestOverrideConfig = streamingInputOutputOperationRequest.overrideConfiguration()
.orElse(null);
CompletableFuture<ReturnT> whenCompleted = executeFuture.whenComplete((r, e) -> {
if (e != null) {
runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring",
Expand Down Expand Up @@ -1110,8 +1089,6 @@ public <ReturnT> CompletableFuture<ReturnT> streamingOutputOperation(
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(streamingOutputOperationRequest),
asyncResponseTransformer);
AwsRequestOverrideConfiguration requestOverrideConfig = streamingOutputOperationRequest.overrideConfiguration()
.orElse(null);
CompletableFuture<ReturnT> whenCompleted = executeFuture.whenComplete((r, e) -> {
if (e != null) {
runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring",
Expand Down Expand Up @@ -1194,4 +1171,3 @@ private HttpResponseHandler<AwsServiceException> createErrorResponseHandler(Base
return protocolFactory.createErrorResponseHandler(operationMetadata);
}
}

Loading