Class AwsSdk2Transport
- java.lang.Object
-
- org.opensearch.client.transport.aws.AwsSdk2Transport
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,OpenSearchTransport,Transport
public class AwsSdk2Transport extends java.lang.Object implements OpenSearchTransport
Implementation of the OpenSearchTransport interface that sends signed requests using the AWS v2 SDK HTTP clients, to connect to an AWS OpenSearch service using IAM authentication
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.IntegerDEFAULT_REQUEST_COMPRESSION_SIZEBy default, requests that exceed this size will be automatically compressed.
-
Constructor Summary
Constructors Constructor Description AwsSdk2Transport(software.amazon.awssdk.http.async.SdkAsyncHttpClient asyncHttpClient, java.lang.String host, software.amazon.awssdk.regions.Region signingRegion, AwsSdk2TransportOptions options)Create anOpenSearchTransportwith an ASYNCHRONOUS AWS Http clientAwsSdk2Transport(software.amazon.awssdk.http.SdkHttpClient httpClient, java.lang.String host, software.amazon.awssdk.regions.Region signingRegion, AwsSdk2TransportOptions options)Create anOpenSearchTransportwith a SYNCHRONOUS AWS Http clientAwsSdk2Transport(software.amazon.awssdk.http.SdkHttpClient httpClient, software.amazon.awssdk.http.async.SdkAsyncHttpClient asyncHttpClient, java.lang.String host, software.amazon.awssdk.regions.Region signingRegion, AwsSdk2TransportOptions options)Create anOpenSearchTransportwith both synchronous and asynchronous AWS HTTP clients.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()JsonpMapperjsonpMapper()AwsSdk2TransportOptionsoptions()Default options used by this transport if none are provided inTransport.performRequest(Object, Endpoint, TransportOptions)orTransport.performRequestAsync(Object, Endpoint, TransportOptions);<RequestT,ResponseT,ErrorT>
ResponseTperformRequest(RequestT request, Endpoint<RequestT,ResponseT,ErrorT> endpoint, TransportOptions options)<RequestT,ResponseT,ErrorT>
java.util.concurrent.CompletableFuture<ResponseT>performRequestAsync(RequestT request, Endpoint<RequestT,ResponseT,ErrorT> endpoint, TransportOptions options)
-
-
-
Field Detail
-
DEFAULT_REQUEST_COMPRESSION_SIZE
public static final java.lang.Integer DEFAULT_REQUEST_COMPRESSION_SIZE
By default, requests that exceed this size will be automatically compressed.AwsSdk2TransportOptionscan be used to override this setting or disable compresson.
-
-
Constructor Detail
-
AwsSdk2Transport
public AwsSdk2Transport(@Nonnull software.amazon.awssdk.http.SdkHttpClient httpClient, @Nonnull java.lang.String host, @Nonnull software.amazon.awssdk.regions.Region signingRegion, @CheckForNull AwsSdk2TransportOptions options)Create anOpenSearchTransportwith a SYNCHRONOUS AWS Http clientNote that asynchronous OpenSearch requests sent through this transport will be dispatched *synchronously* on the calling thread.
- Parameters:
httpClient- HTTP client to use for OpenSearch requestshost- The fully qualified domain name to connect tosigningRegion- The AWS region for which requests will be signed. This should typically match the region in `host`.options- Options that apply to all requests. Can be null. Create withAwsSdk2TransportOptions.builder()and use these to specify non-default credentials, compression options, etc.
-
AwsSdk2Transport
public AwsSdk2Transport(@Nonnull software.amazon.awssdk.http.async.SdkAsyncHttpClient asyncHttpClient, @Nonnull java.lang.String host, @Nonnull software.amazon.awssdk.regions.Region signingRegion, @CheckForNull AwsSdk2TransportOptions options)Create anOpenSearchTransportwith an ASYNCHRONOUS AWS Http clientNote that synchronous OpenSearch requests sent through this transport will be dispatched using the asynchronous client, but the calling thread will block until they are complete.
- Parameters:
asyncHttpClient- HTTP client to use for OpenSearch requestshost- The target hostsigningRegion- The AWS region for which requests will be signed. This should typically match the region in `host`.options- Options that apply to all requests. Can be null. Create withAwsSdk2TransportOptions.builder()and use these to specify non-default credentials, compression options, etc.
-
AwsSdk2Transport
public AwsSdk2Transport(@CheckForNull software.amazon.awssdk.http.SdkHttpClient httpClient, @CheckForNull software.amazon.awssdk.http.async.SdkAsyncHttpClient asyncHttpClient, @Nonnull java.lang.String host, @Nonnull software.amazon.awssdk.regions.Region signingRegion, @CheckForNull AwsSdk2TransportOptions options)Create anOpenSearchTransportwith both synchronous and asynchronous AWS HTTP clients.The synchronous client will be used for synchronous OpenSearch requests, and the asynchronous client will be used for asynchronous HTTP requests.
- Parameters:
httpClient- HTTP client to use for OpenSearch requestsasyncHttpClient- HTTP client to use for synchronous OpenSearch requestshost- The fully qualified domain name to connect tosigningRegion- The AWS region for which requests will be signed. This should typically match the region in `host`.options- Options that apply to all requests. Can be null. Create withAwsSdk2TransportOptions.builder()and use these to specify non-default credentials, compression options, etc.
-
-
Method Detail
-
performRequest
public <RequestT,ResponseT,ErrorT> ResponseT performRequest(RequestT request, Endpoint<RequestT,ResponseT,ErrorT> endpoint, @Nullable TransportOptions options) throws java.io.IOException- Specified by:
performRequestin interfaceTransport- Throws:
java.io.IOException
-
performRequestAsync
public <RequestT,ResponseT,ErrorT> java.util.concurrent.CompletableFuture<ResponseT> performRequestAsync(RequestT request, Endpoint<RequestT,ResponseT,ErrorT> endpoint, @Nullable TransportOptions options)- Specified by:
performRequestAsyncin interfaceTransport
-
jsonpMapper
public JsonpMapper jsonpMapper()
- Specified by:
jsonpMapperin interfaceTransport
-
options
public AwsSdk2TransportOptions options()
Description copied from interface:TransportDefault options used by this transport if none are provided inTransport.performRequest(Object, Endpoint, TransportOptions)orTransport.performRequestAsync(Object, Endpoint, TransportOptions);
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
-