Skip to content

Commit 8b86bd4

Browse files
committed
Fix HttpSign* interfaces with correct types
1 parent ee0000e commit 8b86bd4

File tree

9 files changed

+35
-28
lines changed

9 files changed

+35
-28
lines changed

core/http-auth-aws-crt/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<artifactId>http-auth-aws-crt</artifactId>
2929
<name>AWS Java SDK :: HTTP Auth AWS CRT</name>
3030
<description>
31-
The AWS SDK for Java - HTTP Auth AWS module contains interfaces and implementations for http authentication
31+
The AWS SDK for Java - HTTP Auth AWS module contains interfaces and implementations for HTTP authentication
3232
specific to the AWS CRT.
3333
</description>
3434
<url>https://aws.amazon.com/sdkforjava</url>

core/http-auth-aws/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<artifactId>http-auth-aws</artifactId>
2929
<name>AWS Java SDK :: HTTP Auth AWS</name>
3030
<description>
31-
The AWS SDK for Java - HTTP Auth AWS module contains interfaces and implementations for http authentication
31+
The AWS SDK for Java - HTTP Auth AWS module contains interfaces and implementations for generic generic HTTP authentication
3232
specific to AWS.
3333
</description>
3434
<url>https://aws.amazon.com/sdkforjava</url>

core/http-auth-event-stream/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<artifactId>http-auth-event-stream</artifactId>
2929
<name>AWS Java SDK :: HTTP Auth Event Stream</name>
3030
<description>
31-
The AWS SDK for Java - HTTP Auth module contains interfaces and implementations for http authentication
31+
The AWS SDK for Java - HTTP Auth module contains interfaces and implementations for generic HTTP authentication
3232
specific to the event streams.
3333
</description>
3434
<url>https://aws.amazon.com/sdkforjava</url>

core/http-auth-spi/src/main/java/software/amazon/awssdk/http/auth/spi/HttpSignRequest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public interface HttpSignRequest<PayloadT> {
3636
/**
3737
* Get a new builder for creating a {@link HttpSignRequest}.
3838
*/
39-
static <T> Builder<T> builder(Class<T> payloadType) {
40-
return new DefaultHttpSignRequest.BuilderImpl(payloadType);
39+
static <PayloadT> Builder<PayloadT> builder(Class<PayloadT> payloadType) {
40+
return new DefaultHttpSignRequest.BuilderImpl<>(payloadType);
4141
}
4242

4343
/**
@@ -63,21 +63,22 @@ static <T> Builder<T> builder(Class<T> payloadType) {
6363
/**
6464
* A builder for a {@link HttpSignRequest}.
6565
*/
66-
interface Builder<PayloadT> extends SdkBuilder<Builder<PayloadT>, HttpSignRequest> {
66+
interface Builder<PayloadT> extends SdkBuilder<Builder<PayloadT>,
67+
HttpSignRequest<PayloadT>> {
6768

6869
/**
6970
* Set the HTTP request object, without the request body payload.
7071
*/
71-
Builder request(SdkHttpRequest request);
72+
Builder<PayloadT> request(SdkHttpRequest request);
7273

7374
/**
7475
* Set the body payload of the request. A payload is optional. By default, the payload will be empty.
7576
*/
76-
Builder payload(PayloadT payload);
77+
Builder<PayloadT> payload(PayloadT payload);
7778

7879
/**
7980
* Set a property that the {@link HttpSigner} can use during signing.
8081
*/
81-
<T> Builder putProperty(SignerProperty<T> key, T value);
82+
<T> Builder<PayloadT> putProperty(SignerProperty<T> key, T value);
8283
}
8384
}

core/http-auth-spi/src/main/java/software/amazon/awssdk/http/auth/spi/HttpSigner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ public interface HttpSigner {
3333
* @param request The request to sign, with sync payload
3434
* @return A signed version of the input request
3535
*/
36-
SignedHttpRequest<ContentStreamProvider> sign(HttpSignRequest<? extends ContentStreamProvider> request);
36+
SignedHttpRequest<? extends ContentStreamProvider> sign(HttpSignRequest<? extends ContentStreamProvider> request);
3737

3838
/**
3939
* Method that takes in a request and returns a signed version of the request.
4040
*
4141
* @param request The request to sign, with async payload
4242
* @return A signed version of the input request
4343
*/
44-
SignedHttpRequest<Publisher<ByteBuffer>> signAsync(HttpSignRequest<? extends Publisher<? extends ByteBuffer>> request);
44+
SignedHttpRequest<? extends Publisher<? extends ByteBuffer>> signAsync(HttpSignRequest<? extends Publisher<? extends ByteBuffer>> request);
4545
}

core/http-auth-spi/src/main/java/software/amazon/awssdk/http/auth/spi/SignedHttpRequest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public interface SignedHttpRequest<PayloadT> {
3636
/**
3737
* Get a new builder for creating a {@link SignedHttpRequest}.
3838
*/
39-
static <T> Builder<T> builder(Class<T> payloadType) {
40-
return new DefaultSignedHttpRequest.BuilderImpl(payloadType);
39+
static <PayloadT> Builder<PayloadT> builder(Class<PayloadT> payloadType) {
40+
return new DefaultSignedHttpRequest.BuilderImpl<>(payloadType);
4141
}
4242

4343
/**
@@ -58,16 +58,17 @@ static <T> Builder<T> builder(Class<T> payloadType) {
5858
/**
5959
* A builder for a {@link SignedHttpRequest}.
6060
*/
61-
interface Builder<PayloadT> extends SdkBuilder<Builder<PayloadT>, SignedHttpRequest> {
61+
interface Builder<PayloadT> extends SdkBuilder<Builder<PayloadT>,
62+
SignedHttpRequest<PayloadT>> {
6263

6364
/**
6465
* Set the HTTP request object, without the request body payload.
6566
*/
66-
Builder request(SdkHttpRequest request);
67+
Builder<PayloadT> request(SdkHttpRequest request);
6768

6869
/**
6970
* Set the body payload of the request. A payload is optional. By default, the payload will be empty.
7071
*/
71-
Builder payload(PayloadT payload);
72+
Builder<PayloadT> payload(PayloadT payload);
7273
}
7374
}

core/http-auth-spi/src/main/java/software/amazon/awssdk/http/auth/spi/internal/DefaultHttpSignRequest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public SdkHttpRequest request() {
5151
}
5252

5353
@Override
54-
public Optional payload() {
54+
public Optional<PayloadT> payload() {
5555
return payload == null ? Optional.empty() : Optional.of(payload);
5656
}
5757

@@ -81,26 +81,26 @@ public BuilderImpl(Class<PayloadT> payloadType) {
8181
}
8282

8383
@Override
84-
public Builder request(SdkHttpRequest request) {
84+
public Builder<PayloadT> request(SdkHttpRequest request) {
8585
this.request = request;
8686
return this;
8787
}
8888

8989
@Override
90-
public Builder payload(PayloadT payload) {
90+
public Builder<PayloadT> payload(PayloadT payload) {
9191
this.payload = payload;
9292
return this;
9393
}
9494

9595
@Override
96-
public <T> Builder putProperty(SignerProperty<T> key, T value) {
96+
public <T> Builder<PayloadT> putProperty(SignerProperty<T> key, T value) {
9797
this.properties.put(key, value);
9898
return this;
9999
}
100100

101101
@Override
102-
public HttpSignRequest build() {
103-
return new DefaultHttpSignRequest(this);
102+
public HttpSignRequest<PayloadT> build() {
103+
return new DefaultHttpSignRequest<>(this);
104104
}
105105
}
106106
}

core/http-auth-spi/src/main/java/software/amazon/awssdk/http/auth/spi/internal/DefaultSignedHttpRequest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public SdkHttpRequest request() {
4646
}
4747

4848
@Override
49-
public Optional payload() {
49+
public Optional<PayloadT> payload() {
5050
return payload == null ? Optional.empty() : Optional.of(payload);
5151
}
5252

@@ -69,20 +69,20 @@ public BuilderImpl(Class<PayloadT> payloadType) {
6969
}
7070

7171
@Override
72-
public Builder request(SdkHttpRequest request) {
72+
public Builder<PayloadT> request(SdkHttpRequest request) {
7373
this.request = request;
7474
return this;
7575
}
7676

7777
@Override
78-
public Builder payload(PayloadT payload) {
78+
public Builder<PayloadT> payload(PayloadT payload) {
7979
this.payload = payload;
8080
return this;
8181
}
8282

8383
@Override
84-
public SignedHttpRequest build() {
85-
return new DefaultSignedHttpRequest(this);
84+
public SignedHttpRequest<PayloadT> build() {
85+
return new DefaultSignedHttpRequest<>(this);
8686
}
8787
}
8888
}

core/http-auth/pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<artifactId>http-auth</artifactId>
2929
<name>AWS Java SDK :: HTTP Auth</name>
3030
<description>
31-
The AWS SDK for Java - HTTP Auth module contains interfaces and implementations for http authentication
31+
The AWS SDK for Java - HTTP Auth module contains interfaces and implementations for generic HTTP authentication
3232
</description>
3333
<url>https://aws.amazon.com/sdkforjava</url>
3434

@@ -43,6 +43,11 @@
4343
<artifactId>http-auth-spi</artifactId>
4444
<version>${awsjavasdk.version}</version>
4545
</dependency>
46+
<dependency>
47+
<groupId>software.amazon.awssdk</groupId>
48+
<artifactId>identity-spi</artifactId>
49+
<version>${awsjavasdk.version}</version>
50+
</dependency>
4651
</dependencies>
4752

4853
<build>

0 commit comments

Comments
 (0)