Skip to content

Commit

Permalink
Annotate client interfaces with @threadsafe and @SdkPublicApi.
Browse files Browse the repository at this point in the history
  • Loading branch information
millems committed Apr 27, 2021
1 parent 69546d5 commit f5916fc
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import java.util.stream.Stream;
import javax.lang.model.element.Modifier;
import org.reactivestreams.Publisher;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
import software.amazon.awssdk.codegen.docs.ClientType;
import software.amazon.awssdk.codegen.docs.DocConfiguration;
Expand Down Expand Up @@ -76,6 +78,8 @@ public TypeSpec poetSpec() {
TypeSpec.Builder result = PoetUtils.createInterfaceBuilder(className);

result.addSuperinterface(SdkClient.class)
.addAnnotation(SdkPublicApi.class)
.addAnnotation(ThreadSafe.class)
.addField(FieldSpec.builder(String.class, "SERVICE_NAME")
.addModifiers(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL)
.initializer("$S", model.getMetadata().getSigningName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import java.util.List;
import java.util.function.Consumer;
import javax.lang.model.element.Modifier;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.codegen.docs.ClientType;
Expand Down Expand Up @@ -75,7 +77,10 @@ public SyncClientInterface(IntermediateModel model) {
public TypeSpec poetSpec() {
TypeSpec.Builder result = PoetUtils.createInterfaceBuilder(className);


result.addSuperinterface(SdkClient.class)
.addAnnotation(SdkPublicApi.class)
.addAnnotation(ThreadSafe.class)
.addField(FieldSpec.builder(String.class, "SERVICE_NAME")
.addModifiers(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL)
.initializer("$S", model.getMetadata().getSigningName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import java.util.function.Consumer;
import org.reactivestreams.Publisher;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.core.SdkClient;
import software.amazon.awssdk.core.async.AsyncRequestBody;
import software.amazon.awssdk.core.async.AsyncResponseTransformer;
Expand Down Expand Up @@ -44,6 +46,8 @@
* A service that is implemented using the query protocol
*/
@Generated("software.amazon.awssdk:codegen")
@SdkPublicApi
@ThreadSafe
public interface JsonAsyncClient extends SdkClient {
String SERVICE_NAME = "json-service";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.nio.file.Path;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.ResponseBytes;
import software.amazon.awssdk.core.ResponseInputStream;
Expand Down Expand Up @@ -40,6 +42,8 @@
* A service that is implemented using the query protocol
*/
@Generated("software.amazon.awssdk:codegen")
@SdkPublicApi
@ThreadSafe
public interface JsonClient extends SdkClient {
String SERVICE_NAME = "json-service";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
package software.amazon.awssdk.core;

import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.utils.SdkAutoCloseable;

/**
* All SDK service client interfaces should extend this interface.
*/
@SdkPublicApi
@ThreadSafe
public interface SdkClient extends SdkAutoCloseable {

/**
Expand Down

0 comments on commit f5916fc

Please sign in to comment.