public abstract class AmazonWebServiceClient extends Object
Responsible for basic client capabilities that are the same across all AWS SDK Java clients (ex: setting the client endpoint).
Constructor and Description |
---|
AmazonWebServiceClient(ClientConfiguration clientConfiguration)
Constructs a new AmazonWebServiceClient object using the specified
configuration.
|
Modifier and Type | Method and Description |
---|---|
void |
addRequestHandler(RequestHandler requestHandler)
Appends a request handler to the list of registered handlers that are run
as part of a request's lifecycle.
|
com.amazonaws.metrics.RequestMetricCollector |
getRequestMetricsCollector()
Returns the client specific
RequestMetricCollector ; or null if
there is none. |
int |
getTimeOffset()
Returns the optional value for time offset for this client.
|
void |
removeRequestHandler(RequestHandler requestHandler)
Removes a request handler from the list of registered handlers that are run
as part of a request's lifecycle.
|
void |
setConfiguration(ClientConfiguration clientConfiguration) |
void |
setEndpoint(String endpoint)
Overrides the default endpoint for this client.
|
void |
setRegion(Region region)
An alternative to
setEndpoint(String) , sets the
regional endpoint for this client's service calls. |
void |
setTimeOffset(int timeOffset)
Sets the optional value for time offset for this client.
|
void |
shutdown()
Shuts down this client object, releasing any resources that might be held
open.
|
AmazonWebServiceClient |
withTimeOffset(int timeOffset)
Sets the optional value for time offset for this client.
|
public AmazonWebServiceClient(ClientConfiguration clientConfiguration)
clientConfiguration
- The client configuration for this client.public void setEndpoint(String endpoint) throws IllegalArgumentException
This method is not threadsafe. Endpoints should be configured when the client is created and before any service requests are made. Changing it afterwards creates inevitable race conditions for any service requests in transit.
Callers can pass in just the endpoint (ex: "ec2.amazonaws.com") or a full
URL, including the protocol (ex: "https://ec2.amazonaws.com"). If the
protocol is not specified here, the default protocol from this client's
ClientConfiguration
will be used, which by default is HTTPS.
For more information on using AWS regions with the AWS SDK for Java, and a complete list of all available endpoints for all AWS services, see: http://developer.amazonwebservices.com/connect/entry.jspa?externalID=3912
endpoint
- The endpoint (ex: "ec2.amazonaws.com") or a full URL,
including the protocol (ex: "https://ec2.amazonaws.com") of
the region specific AWS endpoint this client will communicate
with.IllegalArgumentException
- If any problems are detected with the specified endpoint.public void setRegion(Region region) throws IllegalArgumentException
setEndpoint(String)
, sets the
regional endpoint for this client's service calls. Callers can use this
method to control which AWS region they want to work with.
This method is not threadsafe. A region should be configured when the client is created and before any service requests are made. Changing it afterwards creates inevitable race conditions for any service requests in transit or retrying.
By default, all service endpoints in all regions use the https protocol.
To use http instead, specify it in the ClientConfiguration
supplied at construction.
region
- The region this client will communicate with. See
Region.getRegion(com.amazonaws.regions.Regions)
for
accessing a given region.IllegalArgumentException
- If the given region is null, or if this service isn't
available in the given region. See
Region.isServiceSupported(String)
Region.getRegion(com.amazonaws.regions.Regions)
,
Region.createClient(Class, com.amazonaws.auth.AWSCredentialsProvider, ClientConfiguration)
public void setConfiguration(ClientConfiguration clientConfiguration)
public void shutdown()
public void addRequestHandler(RequestHandler requestHandler)
requestHandler
- The new handler to add to the current list of request
handlers.public void removeRequestHandler(RequestHandler requestHandler)
requestHandler
- The handler to remove from the current list of request
handlers.public void setTimeOffset(int timeOffset)
timeOffset
- The optional value for time offset (in seconds) for this client.public AmazonWebServiceClient withTimeOffset(int timeOffset)
timeOffset
- The optional value for time offset (in seconds) for this client.public int getTimeOffset()
public com.amazonaws.metrics.RequestMetricCollector getRequestMetricsCollector()
RequestMetricCollector
; or null if
there is none.Copyright © 2013 Amazon Web Services, Inc. All Rights Reserved.