
software.amazon.awssdk.services.opensearchserverless.DefaultOpenSearchServerlessClient Maven / Gradle / Ivy
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.opensearchserverless;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.awscore.internal.AwsProtocolMetadata;
import software.amazon.awssdk.awscore.internal.AwsServiceProtocol;
import software.amazon.awssdk.awscore.retry.AwsRetryStrategy;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkPlugin;
import software.amazon.awssdk.core.SdkRequest;
import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.client.handler.SyncClientHandler;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.metrics.CoreMetric;
import software.amazon.awssdk.core.retry.RetryMode;
import software.amazon.awssdk.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.opensearchserverless.internal.OpenSearchServerlessServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.opensearchserverless.model.BatchGetCollectionRequest;
import software.amazon.awssdk.services.opensearchserverless.model.BatchGetCollectionResponse;
import software.amazon.awssdk.services.opensearchserverless.model.BatchGetEffectiveLifecyclePolicyRequest;
import software.amazon.awssdk.services.opensearchserverless.model.BatchGetEffectiveLifecyclePolicyResponse;
import software.amazon.awssdk.services.opensearchserverless.model.BatchGetLifecyclePolicyRequest;
import software.amazon.awssdk.services.opensearchserverless.model.BatchGetLifecyclePolicyResponse;
import software.amazon.awssdk.services.opensearchserverless.model.BatchGetVpcEndpointRequest;
import software.amazon.awssdk.services.opensearchserverless.model.BatchGetVpcEndpointResponse;
import software.amazon.awssdk.services.opensearchserverless.model.ConflictException;
import software.amazon.awssdk.services.opensearchserverless.model.CreateAccessPolicyRequest;
import software.amazon.awssdk.services.opensearchserverless.model.CreateAccessPolicyResponse;
import software.amazon.awssdk.services.opensearchserverless.model.CreateCollectionRequest;
import software.amazon.awssdk.services.opensearchserverless.model.CreateCollectionResponse;
import software.amazon.awssdk.services.opensearchserverless.model.CreateLifecyclePolicyRequest;
import software.amazon.awssdk.services.opensearchserverless.model.CreateLifecyclePolicyResponse;
import software.amazon.awssdk.services.opensearchserverless.model.CreateSecurityConfigRequest;
import software.amazon.awssdk.services.opensearchserverless.model.CreateSecurityConfigResponse;
import software.amazon.awssdk.services.opensearchserverless.model.CreateSecurityPolicyRequest;
import software.amazon.awssdk.services.opensearchserverless.model.CreateSecurityPolicyResponse;
import software.amazon.awssdk.services.opensearchserverless.model.CreateVpcEndpointRequest;
import software.amazon.awssdk.services.opensearchserverless.model.CreateVpcEndpointResponse;
import software.amazon.awssdk.services.opensearchserverless.model.DeleteAccessPolicyRequest;
import software.amazon.awssdk.services.opensearchserverless.model.DeleteAccessPolicyResponse;
import software.amazon.awssdk.services.opensearchserverless.model.DeleteCollectionRequest;
import software.amazon.awssdk.services.opensearchserverless.model.DeleteCollectionResponse;
import software.amazon.awssdk.services.opensearchserverless.model.DeleteLifecyclePolicyRequest;
import software.amazon.awssdk.services.opensearchserverless.model.DeleteLifecyclePolicyResponse;
import software.amazon.awssdk.services.opensearchserverless.model.DeleteSecurityConfigRequest;
import software.amazon.awssdk.services.opensearchserverless.model.DeleteSecurityConfigResponse;
import software.amazon.awssdk.services.opensearchserverless.model.DeleteSecurityPolicyRequest;
import software.amazon.awssdk.services.opensearchserverless.model.DeleteSecurityPolicyResponse;
import software.amazon.awssdk.services.opensearchserverless.model.DeleteVpcEndpointRequest;
import software.amazon.awssdk.services.opensearchserverless.model.DeleteVpcEndpointResponse;
import software.amazon.awssdk.services.opensearchserverless.model.GetAccessPolicyRequest;
import software.amazon.awssdk.services.opensearchserverless.model.GetAccessPolicyResponse;
import software.amazon.awssdk.services.opensearchserverless.model.GetAccountSettingsRequest;
import software.amazon.awssdk.services.opensearchserverless.model.GetAccountSettingsResponse;
import software.amazon.awssdk.services.opensearchserverless.model.GetPoliciesStatsRequest;
import software.amazon.awssdk.services.opensearchserverless.model.GetPoliciesStatsResponse;
import software.amazon.awssdk.services.opensearchserverless.model.GetSecurityConfigRequest;
import software.amazon.awssdk.services.opensearchserverless.model.GetSecurityConfigResponse;
import software.amazon.awssdk.services.opensearchserverless.model.GetSecurityPolicyRequest;
import software.amazon.awssdk.services.opensearchserverless.model.GetSecurityPolicyResponse;
import software.amazon.awssdk.services.opensearchserverless.model.InternalServerException;
import software.amazon.awssdk.services.opensearchserverless.model.ListAccessPoliciesRequest;
import software.amazon.awssdk.services.opensearchserverless.model.ListAccessPoliciesResponse;
import software.amazon.awssdk.services.opensearchserverless.model.ListCollectionsRequest;
import software.amazon.awssdk.services.opensearchserverless.model.ListCollectionsResponse;
import software.amazon.awssdk.services.opensearchserverless.model.ListLifecyclePoliciesRequest;
import software.amazon.awssdk.services.opensearchserverless.model.ListLifecyclePoliciesResponse;
import software.amazon.awssdk.services.opensearchserverless.model.ListSecurityConfigsRequest;
import software.amazon.awssdk.services.opensearchserverless.model.ListSecurityConfigsResponse;
import software.amazon.awssdk.services.opensearchserverless.model.ListSecurityPoliciesRequest;
import software.amazon.awssdk.services.opensearchserverless.model.ListSecurityPoliciesResponse;
import software.amazon.awssdk.services.opensearchserverless.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.opensearchserverless.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.opensearchserverless.model.ListVpcEndpointsRequest;
import software.amazon.awssdk.services.opensearchserverless.model.ListVpcEndpointsResponse;
import software.amazon.awssdk.services.opensearchserverless.model.OcuLimitExceededException;
import software.amazon.awssdk.services.opensearchserverless.model.OpenSearchServerlessException;
import software.amazon.awssdk.services.opensearchserverless.model.ResourceNotFoundException;
import software.amazon.awssdk.services.opensearchserverless.model.ServiceQuotaExceededException;
import software.amazon.awssdk.services.opensearchserverless.model.TagResourceRequest;
import software.amazon.awssdk.services.opensearchserverless.model.TagResourceResponse;
import software.amazon.awssdk.services.opensearchserverless.model.UntagResourceRequest;
import software.amazon.awssdk.services.opensearchserverless.model.UntagResourceResponse;
import software.amazon.awssdk.services.opensearchserverless.model.UpdateAccessPolicyRequest;
import software.amazon.awssdk.services.opensearchserverless.model.UpdateAccessPolicyResponse;
import software.amazon.awssdk.services.opensearchserverless.model.UpdateAccountSettingsRequest;
import software.amazon.awssdk.services.opensearchserverless.model.UpdateAccountSettingsResponse;
import software.amazon.awssdk.services.opensearchserverless.model.UpdateCollectionRequest;
import software.amazon.awssdk.services.opensearchserverless.model.UpdateCollectionResponse;
import software.amazon.awssdk.services.opensearchserverless.model.UpdateLifecyclePolicyRequest;
import software.amazon.awssdk.services.opensearchserverless.model.UpdateLifecyclePolicyResponse;
import software.amazon.awssdk.services.opensearchserverless.model.UpdateSecurityConfigRequest;
import software.amazon.awssdk.services.opensearchserverless.model.UpdateSecurityConfigResponse;
import software.amazon.awssdk.services.opensearchserverless.model.UpdateSecurityPolicyRequest;
import software.amazon.awssdk.services.opensearchserverless.model.UpdateSecurityPolicyResponse;
import software.amazon.awssdk.services.opensearchserverless.model.UpdateVpcEndpointRequest;
import software.amazon.awssdk.services.opensearchserverless.model.UpdateVpcEndpointResponse;
import software.amazon.awssdk.services.opensearchserverless.model.ValidationException;
import software.amazon.awssdk.services.opensearchserverless.transform.BatchGetCollectionRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.BatchGetEffectiveLifecyclePolicyRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.BatchGetLifecyclePolicyRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.BatchGetVpcEndpointRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.CreateAccessPolicyRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.CreateCollectionRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.CreateLifecyclePolicyRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.CreateSecurityConfigRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.CreateSecurityPolicyRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.CreateVpcEndpointRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.DeleteAccessPolicyRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.DeleteCollectionRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.DeleteLifecyclePolicyRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.DeleteSecurityConfigRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.DeleteSecurityPolicyRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.DeleteVpcEndpointRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.GetAccessPolicyRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.GetAccountSettingsRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.GetPoliciesStatsRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.GetSecurityConfigRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.GetSecurityPolicyRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.ListAccessPoliciesRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.ListCollectionsRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.ListLifecyclePoliciesRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.ListSecurityConfigsRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.ListSecurityPoliciesRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.ListVpcEndpointsRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.UpdateAccessPolicyRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.UpdateAccountSettingsRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.UpdateCollectionRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.UpdateLifecyclePolicyRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.UpdateSecurityConfigRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.UpdateSecurityPolicyRequestMarshaller;
import software.amazon.awssdk.services.opensearchserverless.transform.UpdateVpcEndpointRequestMarshaller;
import software.amazon.awssdk.utils.Logger;
/**
* Internal implementation of {@link OpenSearchServerlessClient}.
*
* @see OpenSearchServerlessClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultOpenSearchServerlessClient implements OpenSearchServerlessClient {
private static final Logger log = Logger.loggerFor(DefaultOpenSearchServerlessClient.class);
private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
.serviceProtocol(AwsServiceProtocol.AWS_JSON).build();
private final SyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultOpenSearchServerlessClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
/**
*
* Returns attributes for one or more collections, including the collection endpoint and the OpenSearch Dashboards
* endpoint. For more information, see Creating and
* managing Amazon OpenSearch Serverless collections.
*
*
* @param batchGetCollectionRequest
* @return Result of the BatchGetCollection operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.BatchGetCollection
* @see AWS API Documentation
*/
@Override
public BatchGetCollectionResponse batchGetCollection(BatchGetCollectionRequest batchGetCollectionRequest)
throws InternalServerException, ValidationException, AwsServiceException, SdkClientException,
OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, BatchGetCollectionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(batchGetCollectionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, batchGetCollectionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BatchGetCollection");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("BatchGetCollection").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(batchGetCollectionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new BatchGetCollectionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a list of successful and failed retrievals for the OpenSearch Serverless indexes. For more information,
* see Viewing data lifecycle policies.
*
*
* @param batchGetEffectiveLifecyclePolicyRequest
* @return Result of the BatchGetEffectiveLifecyclePolicy operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.BatchGetEffectiveLifecyclePolicy
* @see AWS API Documentation
*/
@Override
public BatchGetEffectiveLifecyclePolicyResponse batchGetEffectiveLifecyclePolicy(
BatchGetEffectiveLifecyclePolicyRequest batchGetEffectiveLifecyclePolicyRequest) throws InternalServerException,
ValidationException, AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, BatchGetEffectiveLifecyclePolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(batchGetEffectiveLifecyclePolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
batchGetEffectiveLifecyclePolicyRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BatchGetEffectiveLifecyclePolicy");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("BatchGetEffectiveLifecyclePolicy").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(batchGetEffectiveLifecyclePolicyRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new BatchGetEffectiveLifecyclePolicyRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns one or more configured OpenSearch Serverless lifecycle policies. For more information, see Viewing data lifecycle policies.
*
*
* @param batchGetLifecyclePolicyRequest
* @return Result of the BatchGetLifecyclePolicy operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.BatchGetLifecyclePolicy
* @see AWS API Documentation
*/
@Override
public BatchGetLifecyclePolicyResponse batchGetLifecyclePolicy(BatchGetLifecyclePolicyRequest batchGetLifecyclePolicyRequest)
throws InternalServerException, ValidationException, AwsServiceException, SdkClientException,
OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, BatchGetLifecyclePolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(batchGetLifecyclePolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, batchGetLifecyclePolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BatchGetLifecyclePolicy");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("BatchGetLifecyclePolicy").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(batchGetLifecyclePolicyRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new BatchGetLifecyclePolicyRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns attributes for one or more VPC endpoints associated with the current account. For more information, see
* Access Amazon
* OpenSearch Serverless using an interface endpoint.
*
*
* @param batchGetVpcEndpointRequest
* @return Result of the BatchGetVpcEndpoint operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.BatchGetVpcEndpoint
* @see AWS API Documentation
*/
@Override
public BatchGetVpcEndpointResponse batchGetVpcEndpoint(BatchGetVpcEndpointRequest batchGetVpcEndpointRequest)
throws InternalServerException, ValidationException, AwsServiceException, SdkClientException,
OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, BatchGetVpcEndpointResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(batchGetVpcEndpointRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, batchGetVpcEndpointRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BatchGetVpcEndpoint");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("BatchGetVpcEndpoint").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(batchGetVpcEndpointRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new BatchGetVpcEndpointRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a data access policy for OpenSearch Serverless. Access policies limit access to collections and the
* resources within them, and allow a user to access that data irrespective of the access mechanism or network
* source. For more information, see Data
* access control for Amazon OpenSearch Serverless.
*
*
* @param createAccessPolicyRequest
* @return Result of the CreateAccessPolicy operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws ServiceQuotaExceededException
* Thrown when you attempt to create more resources than the service allows based on service quotas.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.CreateAccessPolicy
* @see AWS API Documentation
*/
@Override
public CreateAccessPolicyResponse createAccessPolicy(CreateAccessPolicyRequest createAccessPolicyRequest)
throws InternalServerException, ConflictException, ValidationException, ServiceQuotaExceededException,
AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateAccessPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createAccessPolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createAccessPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateAccessPolicy");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateAccessPolicy").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createAccessPolicyRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateAccessPolicyRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a new OpenSearch Serverless collection. For more information, see Creating and
* managing Amazon OpenSearch Serverless collections.
*
*
* @param createCollectionRequest
* @return Result of the CreateCollection operation returned by the service.
* @throws OcuLimitExceededException
* Thrown when the collection you're attempting to create results in a number of search or indexing OCUs
* that exceeds the account limit.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws ServiceQuotaExceededException
* Thrown when you attempt to create more resources than the service allows based on service quotas.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.CreateCollection
* @see AWS API Documentation
*/
@Override
public CreateCollectionResponse createCollection(CreateCollectionRequest createCollectionRequest)
throws OcuLimitExceededException, InternalServerException, ConflictException, ValidationException,
ServiceQuotaExceededException, AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateCollectionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createCollectionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createCollectionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateCollection");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateCollection").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createCollectionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateCollectionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a lifecyle policy to be applied to OpenSearch Serverless indexes. Lifecycle policies define the number of
* days or hours to retain the data on an OpenSearch Serverless index. For more information, see Creating data lifecycle policies.
*
*
* @param createLifecyclePolicyRequest
* @return Result of the CreateLifecyclePolicy operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws ServiceQuotaExceededException
* Thrown when you attempt to create more resources than the service allows based on service quotas.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.CreateLifecyclePolicy
* @see AWS API Documentation
*/
@Override
public CreateLifecyclePolicyResponse createLifecyclePolicy(CreateLifecyclePolicyRequest createLifecyclePolicyRequest)
throws InternalServerException, ConflictException, ValidationException, ServiceQuotaExceededException,
AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateLifecyclePolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createLifecyclePolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createLifecyclePolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateLifecyclePolicy");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateLifecyclePolicy").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createLifecyclePolicyRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateLifecyclePolicyRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Specifies a security configuration for OpenSearch Serverless. For more information, see SAML
* authentication for Amazon OpenSearch Serverless.
*
*
* @param createSecurityConfigRequest
* @return Result of the CreateSecurityConfig operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws ServiceQuotaExceededException
* Thrown when you attempt to create more resources than the service allows based on service quotas.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.CreateSecurityConfig
* @see AWS API Documentation
*/
@Override
public CreateSecurityConfigResponse createSecurityConfig(CreateSecurityConfigRequest createSecurityConfigRequest)
throws InternalServerException, ConflictException, ValidationException, ServiceQuotaExceededException,
AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateSecurityConfigResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createSecurityConfigRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createSecurityConfigRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateSecurityConfig");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateSecurityConfig").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createSecurityConfigRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateSecurityConfigRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a security policy to be used by one or more OpenSearch Serverless collections. Security policies provide
* access to a collection and its OpenSearch Dashboards endpoint from public networks or specific VPC endpoints.
* They also allow you to secure a collection with a KMS encryption key. For more information, see Network
* access for Amazon OpenSearch Serverless and Encryption
* at rest for Amazon OpenSearch Serverless.
*
*
* @param createSecurityPolicyRequest
* @return Result of the CreateSecurityPolicy operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws ServiceQuotaExceededException
* Thrown when you attempt to create more resources than the service allows based on service quotas.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.CreateSecurityPolicy
* @see AWS API Documentation
*/
@Override
public CreateSecurityPolicyResponse createSecurityPolicy(CreateSecurityPolicyRequest createSecurityPolicyRequest)
throws InternalServerException, ConflictException, ValidationException, ServiceQuotaExceededException,
AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateSecurityPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createSecurityPolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createSecurityPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateSecurityPolicy");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateSecurityPolicy").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createSecurityPolicyRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateSecurityPolicyRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates an OpenSearch Serverless-managed interface VPC endpoint. For more information, see Access Amazon
* OpenSearch Serverless using an interface endpoint.
*
*
* @param createVpcEndpointRequest
* @return Result of the CreateVpcEndpoint operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws ServiceQuotaExceededException
* Thrown when you attempt to create more resources than the service allows based on service quotas.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.CreateVpcEndpoint
* @see AWS API Documentation
*/
@Override
public CreateVpcEndpointResponse createVpcEndpoint(CreateVpcEndpointRequest createVpcEndpointRequest)
throws InternalServerException, ConflictException, ValidationException, ServiceQuotaExceededException,
AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateVpcEndpointResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createVpcEndpointRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createVpcEndpointRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateVpcEndpoint");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateVpcEndpoint").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createVpcEndpointRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateVpcEndpointRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes an OpenSearch Serverless access policy. For more information, see Data
* access control for Amazon OpenSearch Serverless.
*
*
* @param deleteAccessPolicyRequest
* @return Result of the DeleteAccessPolicy operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ResourceNotFoundException
* Thrown when accessing or deleting a resource that does not exist.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.DeleteAccessPolicy
* @see AWS API Documentation
*/
@Override
public DeleteAccessPolicyResponse deleteAccessPolicy(DeleteAccessPolicyRequest deleteAccessPolicyRequest)
throws InternalServerException, ResourceNotFoundException, ConflictException, ValidationException,
AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteAccessPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteAccessPolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteAccessPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteAccessPolicy");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteAccessPolicy").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deleteAccessPolicyRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteAccessPolicyRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes an OpenSearch Serverless collection. For more information, see Creating and
* managing Amazon OpenSearch Serverless collections.
*
*
* @param deleteCollectionRequest
* @return Result of the DeleteCollection operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ResourceNotFoundException
* Thrown when accessing or deleting a resource that does not exist.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.DeleteCollection
* @see AWS API Documentation
*/
@Override
public DeleteCollectionResponse deleteCollection(DeleteCollectionRequest deleteCollectionRequest)
throws InternalServerException, ResourceNotFoundException, ConflictException, ValidationException,
AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteCollectionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteCollectionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteCollectionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteCollection");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteCollection").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deleteCollectionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteCollectionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes an OpenSearch Serverless lifecycle policy. For more information, see Deleting data lifecycle policies.
*
*
* @param deleteLifecyclePolicyRequest
* @return Result of the DeleteLifecyclePolicy operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ResourceNotFoundException
* Thrown when accessing or deleting a resource that does not exist.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.DeleteLifecyclePolicy
* @see AWS API Documentation
*/
@Override
public DeleteLifecyclePolicyResponse deleteLifecyclePolicy(DeleteLifecyclePolicyRequest deleteLifecyclePolicyRequest)
throws InternalServerException, ResourceNotFoundException, ConflictException, ValidationException,
AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteLifecyclePolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteLifecyclePolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteLifecyclePolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteLifecyclePolicy");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteLifecyclePolicy").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deleteLifecyclePolicyRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteLifecyclePolicyRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes a security configuration for OpenSearch Serverless. For more information, see SAML
* authentication for Amazon OpenSearch Serverless.
*
*
* @param deleteSecurityConfigRequest
* @return Result of the DeleteSecurityConfig operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ResourceNotFoundException
* Thrown when accessing or deleting a resource that does not exist.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.DeleteSecurityConfig
* @see AWS API Documentation
*/
@Override
public DeleteSecurityConfigResponse deleteSecurityConfig(DeleteSecurityConfigRequest deleteSecurityConfigRequest)
throws InternalServerException, ResourceNotFoundException, ConflictException, ValidationException,
AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteSecurityConfigResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteSecurityConfigRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteSecurityConfigRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteSecurityConfig");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteSecurityConfig").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deleteSecurityConfigRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteSecurityConfigRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes an OpenSearch Serverless security policy.
*
*
* @param deleteSecurityPolicyRequest
* @return Result of the DeleteSecurityPolicy operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ResourceNotFoundException
* Thrown when accessing or deleting a resource that does not exist.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.DeleteSecurityPolicy
* @see AWS API Documentation
*/
@Override
public DeleteSecurityPolicyResponse deleteSecurityPolicy(DeleteSecurityPolicyRequest deleteSecurityPolicyRequest)
throws InternalServerException, ResourceNotFoundException, ConflictException, ValidationException,
AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteSecurityPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteSecurityPolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteSecurityPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteSecurityPolicy");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteSecurityPolicy").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deleteSecurityPolicyRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteSecurityPolicyRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes an OpenSearch Serverless-managed interface endpoint. For more information, see Access Amazon
* OpenSearch Serverless using an interface endpoint.
*
*
* @param deleteVpcEndpointRequest
* @return Result of the DeleteVpcEndpoint operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ResourceNotFoundException
* Thrown when accessing or deleting a resource that does not exist.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.DeleteVpcEndpoint
* @see AWS API Documentation
*/
@Override
public DeleteVpcEndpointResponse deleteVpcEndpoint(DeleteVpcEndpointRequest deleteVpcEndpointRequest)
throws InternalServerException, ResourceNotFoundException, ConflictException, ValidationException,
AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteVpcEndpointResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteVpcEndpointRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteVpcEndpointRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteVpcEndpoint");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteVpcEndpoint").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deleteVpcEndpointRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteVpcEndpointRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns an OpenSearch Serverless access policy. For more information, see Data
* access control for Amazon OpenSearch Serverless.
*
*
* @param getAccessPolicyRequest
* @return Result of the GetAccessPolicy operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ResourceNotFoundException
* Thrown when accessing or deleting a resource that does not exist.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.GetAccessPolicy
* @see AWS API Documentation
*/
@Override
public GetAccessPolicyResponse getAccessPolicy(GetAccessPolicyRequest getAccessPolicyRequest) throws InternalServerException,
ResourceNotFoundException, ValidationException, AwsServiceException, SdkClientException,
OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetAccessPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getAccessPolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getAccessPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetAccessPolicy");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetAccessPolicy").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getAccessPolicyRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetAccessPolicyRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns account-level settings related to OpenSearch Serverless.
*
*
* @param getAccountSettingsRequest
* @return Result of the GetAccountSettings operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.GetAccountSettings
* @see AWS API Documentation
*/
@Override
public GetAccountSettingsResponse getAccountSettings(GetAccountSettingsRequest getAccountSettingsRequest)
throws InternalServerException, ValidationException, AwsServiceException, SdkClientException,
OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetAccountSettingsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getAccountSettingsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getAccountSettingsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetAccountSettings");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetAccountSettings").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getAccountSettingsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetAccountSettingsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns statistical information about your OpenSearch Serverless access policies, security configurations, and
* security policies.
*
*
* @param getPoliciesStatsRequest
* @return Result of the GetPoliciesStats operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.GetPoliciesStats
* @see AWS API Documentation
*/
@Override
public GetPoliciesStatsResponse getPoliciesStats(GetPoliciesStatsRequest getPoliciesStatsRequest)
throws InternalServerException, AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetPoliciesStatsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getPoliciesStatsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getPoliciesStatsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetPoliciesStats");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetPoliciesStats").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getPoliciesStatsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetPoliciesStatsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns information about an OpenSearch Serverless security configuration. For more information, see SAML
* authentication for Amazon OpenSearch Serverless.
*
*
* @param getSecurityConfigRequest
* @return Result of the GetSecurityConfig operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ResourceNotFoundException
* Thrown when accessing or deleting a resource that does not exist.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.GetSecurityConfig
* @see AWS API Documentation
*/
@Override
public GetSecurityConfigResponse getSecurityConfig(GetSecurityConfigRequest getSecurityConfigRequest)
throws InternalServerException, ResourceNotFoundException, ValidationException, AwsServiceException,
SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetSecurityConfigResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getSecurityConfigRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getSecurityConfigRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetSecurityConfig");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetSecurityConfig").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getSecurityConfigRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetSecurityConfigRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns information about a configured OpenSearch Serverless security policy. For more information, see Network
* access for Amazon OpenSearch Serverless and Encryption
* at rest for Amazon OpenSearch Serverless.
*
*
* @param getSecurityPolicyRequest
* @return Result of the GetSecurityPolicy operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ResourceNotFoundException
* Thrown when accessing or deleting a resource that does not exist.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.GetSecurityPolicy
* @see AWS API Documentation
*/
@Override
public GetSecurityPolicyResponse getSecurityPolicy(GetSecurityPolicyRequest getSecurityPolicyRequest)
throws InternalServerException, ResourceNotFoundException, ValidationException, AwsServiceException,
SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetSecurityPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getSecurityPolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getSecurityPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetSecurityPolicy");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetSecurityPolicy").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getSecurityPolicyRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetSecurityPolicyRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns information about a list of OpenSearch Serverless access policies.
*
*
* @param listAccessPoliciesRequest
* @return Result of the ListAccessPolicies operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.ListAccessPolicies
* @see AWS API Documentation
*/
@Override
public ListAccessPoliciesResponse listAccessPolicies(ListAccessPoliciesRequest listAccessPoliciesRequest)
throws InternalServerException, ValidationException, AwsServiceException, SdkClientException,
OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListAccessPoliciesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listAccessPoliciesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listAccessPoliciesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListAccessPolicies");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListAccessPolicies").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listAccessPoliciesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListAccessPoliciesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists all OpenSearch Serverless collections. For more information, see Creating and
* managing Amazon OpenSearch Serverless collections.
*
*
*
* Make sure to include an empty request body {} if you don't include any collection filters in the request.
*
*
*
* @param listCollectionsRequest
* @return Result of the ListCollections operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.ListCollections
* @see AWS API Documentation
*/
@Override
public ListCollectionsResponse listCollections(ListCollectionsRequest listCollectionsRequest) throws InternalServerException,
ValidationException, AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListCollectionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listCollectionsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listCollectionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListCollections");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListCollections").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listCollectionsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListCollectionsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a list of OpenSearch Serverless lifecycle policies. For more information, see Viewing data lifecycle policies.
*
*
* @param listLifecyclePoliciesRequest
* @return Result of the ListLifecyclePolicies operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.ListLifecyclePolicies
* @see AWS API Documentation
*/
@Override
public ListLifecyclePoliciesResponse listLifecyclePolicies(ListLifecyclePoliciesRequest listLifecyclePoliciesRequest)
throws InternalServerException, ValidationException, AwsServiceException, SdkClientException,
OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListLifecyclePoliciesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listLifecyclePoliciesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listLifecyclePoliciesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListLifecyclePolicies");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListLifecyclePolicies").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listLifecyclePoliciesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListLifecyclePoliciesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns information about configured OpenSearch Serverless security configurations. For more information, see SAML
* authentication for Amazon OpenSearch Serverless.
*
*
* @param listSecurityConfigsRequest
* @return Result of the ListSecurityConfigs operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.ListSecurityConfigs
* @see AWS API Documentation
*/
@Override
public ListSecurityConfigsResponse listSecurityConfigs(ListSecurityConfigsRequest listSecurityConfigsRequest)
throws InternalServerException, ValidationException, AwsServiceException, SdkClientException,
OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListSecurityConfigsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listSecurityConfigsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listSecurityConfigsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListSecurityConfigs");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListSecurityConfigs").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listSecurityConfigsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListSecurityConfigsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns information about configured OpenSearch Serverless security policies.
*
*
* @param listSecurityPoliciesRequest
* @return Result of the ListSecurityPolicies operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.ListSecurityPolicies
* @see AWS API Documentation
*/
@Override
public ListSecurityPoliciesResponse listSecurityPolicies(ListSecurityPoliciesRequest listSecurityPoliciesRequest)
throws InternalServerException, ValidationException, AwsServiceException, SdkClientException,
OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListSecurityPoliciesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listSecurityPoliciesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listSecurityPoliciesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListSecurityPolicies");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListSecurityPolicies").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listSecurityPoliciesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListSecurityPoliciesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns the tags for an OpenSearch Serverless resource. For more information, see Tagging Amazon
* OpenSearch Serverless collections.
*
*
* @param listTagsForResourceRequest
* @return Result of the ListTagsForResource operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ResourceNotFoundException
* Thrown when accessing or deleting a resource that does not exist.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.ListTagsForResource
* @see AWS API Documentation
*/
@Override
public ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest)
throws InternalServerException, ResourceNotFoundException, ValidationException, AwsServiceException,
SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListTagsForResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTagsForResourceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListTagsForResource").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listTagsForResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns the OpenSearch Serverless-managed interface VPC endpoints associated with the current account. For more
* information, see Access Amazon
* OpenSearch Serverless using an interface endpoint.
*
*
* @param listVpcEndpointsRequest
* @return Result of the ListVpcEndpoints operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.ListVpcEndpoints
* @see AWS API Documentation
*/
@Override
public ListVpcEndpointsResponse listVpcEndpoints(ListVpcEndpointsRequest listVpcEndpointsRequest)
throws InternalServerException, ValidationException, AwsServiceException, SdkClientException,
OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListVpcEndpointsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listVpcEndpointsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listVpcEndpointsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListVpcEndpoints");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListVpcEndpoints").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listVpcEndpointsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListVpcEndpointsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Associates tags with an OpenSearch Serverless resource. For more information, see Tagging Amazon
* OpenSearch Serverless collections.
*
*
* @param tagResourceRequest
* @return Result of the TagResource operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ResourceNotFoundException
* Thrown when accessing or deleting a resource that does not exist.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws ServiceQuotaExceededException
* Thrown when you attempt to create more resources than the service allows based on service quotas.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.TagResource
* @see AWS API Documentation
*/
@Override
public TagResourceResponse tagResource(TagResourceRequest tagResourceRequest) throws InternalServerException,
ResourceNotFoundException, ConflictException, ValidationException, ServiceQuotaExceededException,
AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
TagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(tagResourceRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("TagResource").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(tagResourceRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new TagResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Removes a tag or set of tags from an OpenSearch Serverless resource. For more information, see Tagging Amazon
* OpenSearch Serverless collections.
*
*
* @param untagResourceRequest
* @return Result of the UntagResource operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ResourceNotFoundException
* Thrown when accessing or deleting a resource that does not exist.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.UntagResource
* @see AWS API Documentation
*/
@Override
public UntagResourceResponse untagResource(UntagResourceRequest untagResourceRequest) throws InternalServerException,
ResourceNotFoundException, ConflictException, ValidationException, AwsServiceException, SdkClientException,
OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UntagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(untagResourceRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UntagResource").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(untagResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UntagResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates an OpenSearch Serverless access policy. For more information, see Data
* access control for Amazon OpenSearch Serverless.
*
*
* @param updateAccessPolicyRequest
* @return Result of the UpdateAccessPolicy operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ResourceNotFoundException
* Thrown when accessing or deleting a resource that does not exist.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.UpdateAccessPolicy
* @see AWS API Documentation
*/
@Override
public UpdateAccessPolicyResponse updateAccessPolicy(UpdateAccessPolicyRequest updateAccessPolicyRequest)
throws InternalServerException, ResourceNotFoundException, ConflictException, ValidationException,
AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateAccessPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateAccessPolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateAccessPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateAccessPolicy");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateAccessPolicy").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateAccessPolicyRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateAccessPolicyRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Update the OpenSearch Serverless settings for the current Amazon Web Services account. For more information, see
* Managing
* capacity limits for Amazon OpenSearch Serverless.
*
*
* @param updateAccountSettingsRequest
* @return Result of the UpdateAccountSettings operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.UpdateAccountSettings
* @see AWS API Documentation
*/
@Override
public UpdateAccountSettingsResponse updateAccountSettings(UpdateAccountSettingsRequest updateAccountSettingsRequest)
throws InternalServerException, ValidationException, AwsServiceException, SdkClientException,
OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateAccountSettingsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateAccountSettingsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateAccountSettingsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateAccountSettings");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateAccountSettings").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateAccountSettingsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateAccountSettingsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates an OpenSearch Serverless collection.
*
*
* @param updateCollectionRequest
* @return Result of the UpdateCollection operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.UpdateCollection
* @see AWS API Documentation
*/
@Override
public UpdateCollectionResponse updateCollection(UpdateCollectionRequest updateCollectionRequest)
throws InternalServerException, ConflictException, ValidationException, AwsServiceException, SdkClientException,
OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateCollectionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateCollectionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateCollectionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateCollection");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateCollection").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateCollectionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateCollectionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates an OpenSearch Serverless access policy. For more information, see Updating data lifecycle policies.
*
*
* @param updateLifecyclePolicyRequest
* @return Result of the UpdateLifecyclePolicy operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ResourceNotFoundException
* Thrown when accessing or deleting a resource that does not exist.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws ServiceQuotaExceededException
* Thrown when you attempt to create more resources than the service allows based on service quotas.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.UpdateLifecyclePolicy
* @see AWS API Documentation
*/
@Override
public UpdateLifecyclePolicyResponse updateLifecyclePolicy(UpdateLifecyclePolicyRequest updateLifecyclePolicyRequest)
throws InternalServerException, ResourceNotFoundException, ConflictException, ValidationException,
ServiceQuotaExceededException, AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateLifecyclePolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateLifecyclePolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateLifecyclePolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateLifecyclePolicy");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateLifecyclePolicy").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateLifecyclePolicyRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateLifecyclePolicyRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates a security configuration for OpenSearch Serverless. For more information, see SAML
* authentication for Amazon OpenSearch Serverless.
*
*
* @param updateSecurityConfigRequest
* @return Result of the UpdateSecurityConfig operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ResourceNotFoundException
* Thrown when accessing or deleting a resource that does not exist.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.UpdateSecurityConfig
* @see AWS API Documentation
*/
@Override
public UpdateSecurityConfigResponse updateSecurityConfig(UpdateSecurityConfigRequest updateSecurityConfigRequest)
throws InternalServerException, ResourceNotFoundException, ConflictException, ValidationException,
AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateSecurityConfigResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateSecurityConfigRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateSecurityConfigRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateSecurityConfig");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateSecurityConfig").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateSecurityConfigRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateSecurityConfigRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates an OpenSearch Serverless security policy. For more information, see Network
* access for Amazon OpenSearch Serverless and Encryption
* at rest for Amazon OpenSearch Serverless.
*
*
* @param updateSecurityPolicyRequest
* @return Result of the UpdateSecurityPolicy operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ResourceNotFoundException
* Thrown when accessing or deleting a resource that does not exist.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws ServiceQuotaExceededException
* Thrown when you attempt to create more resources than the service allows based on service quotas.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.UpdateSecurityPolicy
* @see AWS API Documentation
*/
@Override
public UpdateSecurityPolicyResponse updateSecurityPolicy(UpdateSecurityPolicyRequest updateSecurityPolicyRequest)
throws InternalServerException, ResourceNotFoundException, ConflictException, ValidationException,
ServiceQuotaExceededException, AwsServiceException, SdkClientException, OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateSecurityPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateSecurityPolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateSecurityPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateSecurityPolicy");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateSecurityPolicy").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateSecurityPolicyRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateSecurityPolicyRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates an OpenSearch Serverless-managed interface endpoint. For more information, see Access Amazon
* OpenSearch Serverless using an interface endpoint.
*
*
* @param updateVpcEndpointRequest
* @return Result of the UpdateVpcEndpoint operation returned by the service.
* @throws InternalServerException
* Thrown when an error internal to the service occurs while processing a request.
* @throws ConflictException
* When creating a resource, thrown when a resource with the same name already exists or is being created.
* When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.
* @throws ValidationException
* Thrown when the HTTP request contains invalid input or is missing required input.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws OpenSearchServerlessException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample OpenSearchServerlessClient.UpdateVpcEndpoint
* @see AWS API Documentation
*/
@Override
public UpdateVpcEndpointResponse updateVpcEndpoint(UpdateVpcEndpointRequest updateVpcEndpointRequest)
throws InternalServerException, ConflictException, ValidationException, AwsServiceException, SdkClientException,
OpenSearchServerlessException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateVpcEndpointResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateVpcEndpointRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateVpcEndpointRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "OpenSearchServerless");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateVpcEndpoint");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateVpcEndpoint").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateVpcEndpointRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateVpcEndpointRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
}
if (publishers == null || publishers.isEmpty()) {
publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS);
}
if (publishers == null) {
publishers = Collections.emptyList();
}
return publishers;
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
JsonOperationMetadata operationMetadata) {
return protocolFactory.createErrorResponseHandler(operationMetadata);
}
private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) {
ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder();
RetryMode retryMode = builder.retryMode();
if (retryMode != null) {
configuration.option(SdkClientOption.RETRY_STRATEGY, AwsRetryStrategy.forRetryMode(retryMode));
} else {
Consumer> configurator = builder.retryStrategyConfigurator();
if (configurator != null) {
RetryStrategy.Builder, ?> defaultBuilder = AwsRetryStrategy.defaultRetryStrategy().toBuilder();
configurator.accept(defaultBuilder);
configuration.option(SdkClientOption.RETRY_STRATEGY, defaultBuilder.build());
} else {
RetryStrategy retryStrategy = builder.retryStrategy();
if (retryStrategy != null) {
configuration.option(SdkClientOption.RETRY_STRATEGY, retryStrategy);
}
}
}
configuration.option(SdkClientOption.CONFIGURED_RETRY_MODE, null);
configuration.option(SdkClientOption.CONFIGURED_RETRY_STRATEGY, null);
configuration.option(SdkClientOption.CONFIGURED_RETRY_CONFIGURATOR, null);
}
private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, SdkClientConfiguration clientConfiguration) {
List plugins = request.overrideConfiguration().map(c -> c.plugins()).orElse(Collections.emptyList());
SdkClientConfiguration.Builder configuration = clientConfiguration.toBuilder();
if (plugins.isEmpty()) {
return configuration.build();
}
OpenSearchServerlessServiceClientConfigurationBuilder serviceConfigBuilder = new OpenSearchServerlessServiceClientConfigurationBuilder(
configuration);
for (SdkPlugin plugin : plugins) {
plugin.configureClient(serviceConfigBuilder);
}
updateRetryStrategyClientConfiguration(configuration);
return configuration.build();
}
private > T init(T builder) {
return builder
.clientConfiguration(clientConfiguration)
.defaultServiceExceptionSupplier(OpenSearchServerlessException::builder)
.protocol(AwsJsonProtocol.AWS_JSON)
.protocolVersion("1.0")
.registerModeledException(
ExceptionMetadata.builder().errorCode("ServiceQuotaExceededException")
.exceptionBuilderSupplier(ServiceQuotaExceededException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InternalServerException")
.exceptionBuilderSupplier(InternalServerException::builder).httpStatusCode(500).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ConflictException")
.exceptionBuilderSupplier(ConflictException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceNotFoundException")
.exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ValidationException")
.exceptionBuilderSupplier(ValidationException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("OcuLimitExceededException")
.exceptionBuilderSupplier(OcuLimitExceededException::builder).httpStatusCode(400).build());
}
@Override
public final OpenSearchServerlessServiceClientConfiguration serviceClientConfiguration() {
return new OpenSearchServerlessServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build();
}
@Override
public void close() {
clientHandler.close();
}
}