Package com.amazonaws
Interface Request<T>
-
- Type Parameters:
T
- The type of original, user facing request represented by this request.
- All Superinterfaces:
SignableRequest<T>
- All Known Implementing Classes:
DefaultRequest
public interface Request<T> extends SignableRequest<T>
Represents a request being sent to an Amazon Web Service, including the parameters being sent as part of the request, the endpoint to which the request should be sent, etc.This class is only intended for use inside the AWS client libraries and request handlers. Users of the AWS SDK for Java should not implement this interface.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <X> void
addHandlerContext(HandlerContextKey<X> key, X value)
Adds a context to the request object that is visible to allRequestHandler2
.void
addParameters(String name, List<String> values)
Adds the specified request parameter and list of values to this request.AWSRequestMetrics
getAWSRequestMetrics()
Returns the request metrics.<X> X
getHandlerContext(HandlerContextKey<X> key)
Return the context for the given key if present; else return null.AmazonWebServiceRequest
getOriginalRequest()
Returns the original, user facing request object which this internal request object is representing.String
getServiceName()
void
setAWSRequestMetrics(AWSRequestMetrics metrics)
Bind the request metrics to the request.void
setEndpoint(URI endpoint)
Sets the service endpoint (ex: "https://ec2.amazonaws.com") to which this request should be sent.void
setHeaders(Map<String,String> headers)
Sets all headers, clearing any existing ones.void
setHttpMethod(HttpMethodName httpMethod)
Sets the HTTP method (GET, POST, etc) to use when sending this request.void
setParameters(Map<String,List<String>> parameters)
Sets all parameters, clearing any existing values.void
setResourcePath(String path)
Sets the path to the resource being requested.void
setTimeOffset(int timeOffset)
Sets the optional value for time offset for this request.Request<T>
withParameter(String name, String value)
Adds the specified request parameter to this request, and returns the updated request object.Request<T>
withTimeOffset(int timeOffset)
Sets the optional value for time offset for this request.-
Methods inherited from interface com.amazonaws.SignableRequest
addHeader, addParameter, getContent, getContentUnwrapped, getEndpoint, getHeaders, getHttpMethod, getOriginalRequestObject, getParameters, getReadLimitInfo, getResourcePath, getTimeOffset, setContent
-
-
-
-
Method Detail
-
setHeaders
void setHeaders(Map<String,String> headers)
Sets all headers, clearing any existing ones.
-
setResourcePath
void setResourcePath(String path)
Sets the path to the resource being requested.- Parameters:
path
- The path to the resource being requested.
-
withParameter
Request<T> withParameter(String name, String value)
Adds the specified request parameter to this request, and returns the updated request object.- Parameters:
name
- The name of the request parameter.value
- The value of the request parameter.- Returns:
- The updated request object.
-
setParameters
void setParameters(Map<String,List<String>> parameters)
Sets all parameters, clearing any existing values. Note that List values within the parameters Map must use an implementation that supports null values.
-
addParameters
void addParameters(String name, List<String> values)
Adds the specified request parameter and list of values to this request.- Parameters:
name
- The name of the request parameter.values
- The value of the request parameter.
-
setEndpoint
void setEndpoint(URI endpoint)
Sets the service endpoint (ex: "https://ec2.amazonaws.com") to which this request should be sent.- Parameters:
endpoint
- The service endpoint to which this request should be sent.
-
setHttpMethod
void setHttpMethod(HttpMethodName httpMethod)
Sets the HTTP method (GET, POST, etc) to use when sending this request.- Parameters:
httpMethod
- The HTTP method to use when sending this request.
-
getServiceName
String getServiceName()
- Returns:
- The name of the Amazon service this request is for. This is used
as the service name set in request metrics and service
exceptions. This is NOT the same as the service name returned by
AmazonWebServiceClient.getServiceName()
which is used for signing purpose.
-
getOriginalRequest
AmazonWebServiceRequest getOriginalRequest()
Returns the original, user facing request object which this internal request object is representing.
-
setTimeOffset
void setTimeOffset(int timeOffset)
Sets the optional value for time offset for this request. This will be used by the signer to adjust for potential clock skew. Value is in seconds, positive values imply the current clock is "fast", negative values imply clock is slow.- Parameters:
timeOffset
- The optional value for time offset (in seconds) for this request.
-
withTimeOffset
Request<T> withTimeOffset(int timeOffset)
Sets the optional value for time offset for this request. This will be used by the signer to adjust for potential clock skew. Value is in seconds, positive values imply the current clock is "fast", negative values imply clock is slow.- Returns:
- The updated request object.
-
getAWSRequestMetrics
AWSRequestMetrics getAWSRequestMetrics()
Returns the request metrics.
-
setAWSRequestMetrics
void setAWSRequestMetrics(AWSRequestMetrics metrics)
Bind the request metrics to the request. Note metrics can be captured before the request is created.- Throws:
IllegalStateException
- if the binding has already occurred
-
addHandlerContext
<X> void addHandlerContext(HandlerContextKey<X> key, X value)
Adds a context to the request object that is visible to allRequestHandler2
. Note that, context added here will available only for the scope of the request execution and will not be marshalled over the wire.- Parameters:
key
- the key for the property being set in the request.value
- the value for the property being set in the request.
-
getHandlerContext
<X> X getHandlerContext(HandlerContextKey<X> key)
Return the context for the given key if present; else return null.- Parameters:
key
- the key for the context- Returns:
- the context if present else null.
-
-