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, java.lang.String signingServiceName, software.amazon.awssdk.regions.Region signingRegion, AwsSdk2TransportOptions options)Create anOpenSearchTransportwith an asynchronous AWS HTTP client.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 client.AwsSdk2Transport(software.amazon.awssdk.http.SdkHttpClient syncHttpClient, java.lang.String host, java.lang.String signingServiceName, software.amazon.awssdk.regions.Region signingRegion, AwsSdk2TransportOptions options)Create anOpenSearchTransportwith a synchronous AWS HTTP client.AwsSdk2Transport(software.amazon.awssdk.http.SdkHttpClient syncHttpClient, java.lang.String host, software.amazon.awssdk.regions.Region signingRegion, AwsSdk2TransportOptions options)Create anOpenSearchTransportwith a synchronous AWS HTTP client.
-
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 compression.
-
-
Constructor Detail
-
AwsSdk2Transport
public AwsSdk2Transport(@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 an asynchronous AWS HTTP client.Note that asynchronous OpenSearch requests sent through this transport will be dispatched *synchronously* on the calling thread.
- Parameters:
asyncHttpClient- Asynchronous HTTP client to use for OpenSearch requests.host- The fully qualified domain name to connect to.signingRegion- 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 syncHttpClient, @Nonnull java.lang.String host, @Nonnull software.amazon.awssdk.regions.Region signingRegion, @CheckForNull AwsSdk2TransportOptions options)Create anOpenSearchTransportwith a synchronous AWS HTTP client.- Parameters:
syncHttpClient- Synchronous HTTP client to use for OpenSearch requests.host- The fully qualified domain name to connect to.signingRegion- 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.async.SdkAsyncHttpClient asyncHttpClient, @Nonnull java.lang.String host, @Nonnull java.lang.String signingServiceName, @Nonnull software.amazon.awssdk.regions.Region signingRegion, @CheckForNull AwsSdk2TransportOptions options)Create anOpenSearchTransportwith an asynchronous AWS HTTP client.Note that asynchronous OpenSearch requests sent through this transport will be dispatched *synchronously* on the calling thread.
- Parameters:
asyncHttpClient- Asynchronous HTTP client to use for OpenSearch requests.host- The fully qualified domain name to connect to.signingRegion- The AWS region for which requests will be signed. This should typically match the region in `host`.signingServiceName- The AWS signing service name, one of `es` (Amazon OpenSearch) or `aoss` (Amazon OpenSearch Serverless).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 syncHttpClient, @Nonnull java.lang.String host, @Nonnull java.lang.String signingServiceName, @Nonnull software.amazon.awssdk.regions.Region signingRegion, @CheckForNull AwsSdk2TransportOptions options)Create anOpenSearchTransportwith a synchronous AWS HTTP client.- Parameters:
syncHttpClient- Synchronous HTTP client to use for OpenSearch requests.host- The fully qualified domain name to connect to.signingRegion- The AWS region for which requests will be signed. This should typically match the region in `host`.signingServiceName- The AWS signing service name, one of `es` (Amazon OpenSearch) or `aoss` (Amazon OpenSearch Serverless).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
-
-