1 /* 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"). 5 * You may not use this file except in compliance with the License. 6 * A copy of the License is located at 7 * 8 * http://aws.amazon.com/apache2.0 9 * 10 * or in the "license" file accompanying this file. This file is distributed 11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 * express or implied. See the License for the specific language governing 13 * permissions and limitations under the License. 14 */ 15 16 package software.amazon.awssdk.http.auth.spi.signer; 17 18 import java.util.Optional; 19 import software.amazon.awssdk.annotations.Immutable; 20 import software.amazon.awssdk.annotations.SdkPublicApi; 21 import software.amazon.awssdk.annotations.ThreadSafe; 22 import software.amazon.awssdk.http.SdkHttpRequest; 23 24 /** 25 /** 26 * Base interface to a request that has been signed by {@link HttpSigner}, independent of payload type. See specific 27 * sub-interfaces {@link SignedRequest} for sync payload and {@link AsyncSignedRequest} for async payload. 28 * 29 * @param <PayloadT> The type of payload of the request. 30 */ 31 @SdkPublicApi 32 @Immutable 33 @ThreadSafe 34 public interface BaseSignedRequest<PayloadT> { 35 36 /** 37 * Returns the HTTP request object, without the request body payload. 38 */ request()39 SdkHttpRequest request(); 40 41 /** 42 * Returns the body payload of the request. A payload is optional. By default, the payload will be empty. 43 */ payload()44 Optional<PayloadT> payload(); 45 46 /** 47 * A builder for a {@link BaseSignedRequest}. 48 */ 49 interface Builder<B extends Builder<B, PayloadT>, PayloadT> { 50 51 /** 52 * Set the HTTP request object, without the request body payload. 53 */ request(SdkHttpRequest request)54 B request(SdkHttpRequest request); 55 56 /** 57 * Set the body payload of the request. A payload is optional. By default, the payload will be empty. 58 */ payload(PayloadT payload)59 B payload(PayloadT payload); 60 } 61 } 62