software.amazon.awssdk.services.securitylake.DefaultSecurityLakeAsyncClient Maven / Gradle / Ivy
Show all versions of securitylake Show documentation
/*
* 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.securitylake;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler;
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.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkPlugin;
import software.amazon.awssdk.core.SdkRequest;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.AsyncClientHandler;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.metrics.CoreMetric;
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.services.securitylake.internal.SecurityLakeServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.securitylake.model.AccessDeniedException;
import software.amazon.awssdk.services.securitylake.model.BadRequestException;
import software.amazon.awssdk.services.securitylake.model.ConflictException;
import software.amazon.awssdk.services.securitylake.model.CreateAwsLogSourceRequest;
import software.amazon.awssdk.services.securitylake.model.CreateAwsLogSourceResponse;
import software.amazon.awssdk.services.securitylake.model.CreateCustomLogSourceRequest;
import software.amazon.awssdk.services.securitylake.model.CreateCustomLogSourceResponse;
import software.amazon.awssdk.services.securitylake.model.CreateDataLakeExceptionSubscriptionRequest;
import software.amazon.awssdk.services.securitylake.model.CreateDataLakeExceptionSubscriptionResponse;
import software.amazon.awssdk.services.securitylake.model.CreateDataLakeOrganizationConfigurationRequest;
import software.amazon.awssdk.services.securitylake.model.CreateDataLakeOrganizationConfigurationResponse;
import software.amazon.awssdk.services.securitylake.model.CreateDataLakeRequest;
import software.amazon.awssdk.services.securitylake.model.CreateDataLakeResponse;
import software.amazon.awssdk.services.securitylake.model.CreateSubscriberNotificationRequest;
import software.amazon.awssdk.services.securitylake.model.CreateSubscriberNotificationResponse;
import software.amazon.awssdk.services.securitylake.model.CreateSubscriberRequest;
import software.amazon.awssdk.services.securitylake.model.CreateSubscriberResponse;
import software.amazon.awssdk.services.securitylake.model.DeleteAwsLogSourceRequest;
import software.amazon.awssdk.services.securitylake.model.DeleteAwsLogSourceResponse;
import software.amazon.awssdk.services.securitylake.model.DeleteCustomLogSourceRequest;
import software.amazon.awssdk.services.securitylake.model.DeleteCustomLogSourceResponse;
import software.amazon.awssdk.services.securitylake.model.DeleteDataLakeExceptionSubscriptionRequest;
import software.amazon.awssdk.services.securitylake.model.DeleteDataLakeExceptionSubscriptionResponse;
import software.amazon.awssdk.services.securitylake.model.DeleteDataLakeOrganizationConfigurationRequest;
import software.amazon.awssdk.services.securitylake.model.DeleteDataLakeOrganizationConfigurationResponse;
import software.amazon.awssdk.services.securitylake.model.DeleteDataLakeRequest;
import software.amazon.awssdk.services.securitylake.model.DeleteDataLakeResponse;
import software.amazon.awssdk.services.securitylake.model.DeleteSubscriberNotificationRequest;
import software.amazon.awssdk.services.securitylake.model.DeleteSubscriberNotificationResponse;
import software.amazon.awssdk.services.securitylake.model.DeleteSubscriberRequest;
import software.amazon.awssdk.services.securitylake.model.DeleteSubscriberResponse;
import software.amazon.awssdk.services.securitylake.model.DeregisterDataLakeDelegatedAdministratorRequest;
import software.amazon.awssdk.services.securitylake.model.DeregisterDataLakeDelegatedAdministratorResponse;
import software.amazon.awssdk.services.securitylake.model.GetDataLakeExceptionSubscriptionRequest;
import software.amazon.awssdk.services.securitylake.model.GetDataLakeExceptionSubscriptionResponse;
import software.amazon.awssdk.services.securitylake.model.GetDataLakeOrganizationConfigurationRequest;
import software.amazon.awssdk.services.securitylake.model.GetDataLakeOrganizationConfigurationResponse;
import software.amazon.awssdk.services.securitylake.model.GetDataLakeSourcesRequest;
import software.amazon.awssdk.services.securitylake.model.GetDataLakeSourcesResponse;
import software.amazon.awssdk.services.securitylake.model.GetSubscriberRequest;
import software.amazon.awssdk.services.securitylake.model.GetSubscriberResponse;
import software.amazon.awssdk.services.securitylake.model.InternalServerException;
import software.amazon.awssdk.services.securitylake.model.ListDataLakeExceptionsRequest;
import software.amazon.awssdk.services.securitylake.model.ListDataLakeExceptionsResponse;
import software.amazon.awssdk.services.securitylake.model.ListDataLakesRequest;
import software.amazon.awssdk.services.securitylake.model.ListDataLakesResponse;
import software.amazon.awssdk.services.securitylake.model.ListLogSourcesRequest;
import software.amazon.awssdk.services.securitylake.model.ListLogSourcesResponse;
import software.amazon.awssdk.services.securitylake.model.ListSubscribersRequest;
import software.amazon.awssdk.services.securitylake.model.ListSubscribersResponse;
import software.amazon.awssdk.services.securitylake.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.securitylake.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.securitylake.model.RegisterDataLakeDelegatedAdministratorRequest;
import software.amazon.awssdk.services.securitylake.model.RegisterDataLakeDelegatedAdministratorResponse;
import software.amazon.awssdk.services.securitylake.model.ResourceNotFoundException;
import software.amazon.awssdk.services.securitylake.model.SecurityLakeException;
import software.amazon.awssdk.services.securitylake.model.TagResourceRequest;
import software.amazon.awssdk.services.securitylake.model.TagResourceResponse;
import software.amazon.awssdk.services.securitylake.model.ThrottlingException;
import software.amazon.awssdk.services.securitylake.model.UntagResourceRequest;
import software.amazon.awssdk.services.securitylake.model.UntagResourceResponse;
import software.amazon.awssdk.services.securitylake.model.UpdateDataLakeExceptionSubscriptionRequest;
import software.amazon.awssdk.services.securitylake.model.UpdateDataLakeExceptionSubscriptionResponse;
import software.amazon.awssdk.services.securitylake.model.UpdateDataLakeRequest;
import software.amazon.awssdk.services.securitylake.model.UpdateDataLakeResponse;
import software.amazon.awssdk.services.securitylake.model.UpdateSubscriberNotificationRequest;
import software.amazon.awssdk.services.securitylake.model.UpdateSubscriberNotificationResponse;
import software.amazon.awssdk.services.securitylake.model.UpdateSubscriberRequest;
import software.amazon.awssdk.services.securitylake.model.UpdateSubscriberResponse;
import software.amazon.awssdk.services.securitylake.transform.CreateAwsLogSourceRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.CreateCustomLogSourceRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.CreateDataLakeExceptionSubscriptionRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.CreateDataLakeOrganizationConfigurationRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.CreateDataLakeRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.CreateSubscriberNotificationRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.CreateSubscriberRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.DeleteAwsLogSourceRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.DeleteCustomLogSourceRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.DeleteDataLakeExceptionSubscriptionRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.DeleteDataLakeOrganizationConfigurationRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.DeleteDataLakeRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.DeleteSubscriberNotificationRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.DeleteSubscriberRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.DeregisterDataLakeDelegatedAdministratorRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.GetDataLakeExceptionSubscriptionRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.GetDataLakeOrganizationConfigurationRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.GetDataLakeSourcesRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.GetSubscriberRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.ListDataLakeExceptionsRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.ListDataLakesRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.ListLogSourcesRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.ListSubscribersRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.RegisterDataLakeDelegatedAdministratorRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.UpdateDataLakeExceptionSubscriptionRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.UpdateDataLakeRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.UpdateSubscriberNotificationRequestMarshaller;
import software.amazon.awssdk.services.securitylake.transform.UpdateSubscriberRequestMarshaller;
import software.amazon.awssdk.utils.CompletableFutureUtils;
/**
* Internal implementation of {@link SecurityLakeAsyncClient}.
*
* @see SecurityLakeAsyncClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultSecurityLakeAsyncClient implements SecurityLakeAsyncClient {
private static final Logger log = LoggerFactory.getLogger(DefaultSecurityLakeAsyncClient.class);
private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
.serviceProtocol(AwsServiceProtocol.REST_JSON).build();
private final AsyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultSecurityLakeAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
/**
*
* Adds a natively supported Amazon Web Service as an Amazon Security Lake source. Enables source types for member
* accounts in required Amazon Web Services Regions, based on the parameters you specify. You can choose any source
* type in any Region for either accounts that are part of a trusted organization or standalone accounts. Once you
* add an Amazon Web Service as a source, Security Lake starts collecting logs and events from it.
*
*
* You can use this API only to enable natively supported Amazon Web Services as a source. Use
* CreateCustomLogSource
to enable data collection from a custom source.
*
*
* @param createAwsLogSourceRequest
* @return A Java Future containing the result of the CreateAwsLogSource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.CreateAwsLogSource
* @see AWS API Documentation
*/
@Override
public CompletableFuture createAwsLogSource(CreateAwsLogSourceRequest createAwsLogSourceRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createAwsLogSourceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createAwsLogSourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateAwsLogSource");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateAwsLogSourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateAwsLogSource").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateAwsLogSourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createAwsLogSourceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Adds a third-party custom source in Amazon Security Lake, from the Amazon Web Services Region where you want to
* create a custom source. Security Lake can collect logs and events from third-party custom sources. After creating
* the appropriate IAM role to invoke Glue crawler, use this API to add a custom source name in Security Lake. This
* operation creates a partition in the Amazon S3 bucket for Security Lake as the target location for log files from
* the custom source. In addition, this operation also creates an associated Glue table and an Glue crawler.
*
*
* @param createCustomLogSourceRequest
* @return A Java Future containing the result of the CreateCustomLogSource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.CreateCustomLogSource
* @see AWS API Documentation
*/
@Override
public CompletableFuture createCustomLogSource(
CreateCustomLogSourceRequest createCustomLogSourceRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createCustomLogSourceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createCustomLogSourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateCustomLogSource");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateCustomLogSourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateCustomLogSource").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateCustomLogSourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createCustomLogSourceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Initializes an Amazon Security Lake instance with the provided (or default) configuration. You can enable
* Security Lake in Amazon Web Services Regions with customized settings before enabling log collection in Regions.
* To specify particular Regions, configure these Regions using the configurations
parameter. If you
* have already enabled Security Lake in a Region when you call this command, the command will update the Region if
* you provide new configuration parameters. If you have not already enabled Security Lake in the Region when you
* call this API, it will set up the data lake in the Region with the specified configurations.
*
*
* When you enable Security Lake, it starts ingesting security data after the CreateAwsLogSource
call.
* This includes ingesting security data from sources, storing data, and making data accessible to subscribers.
* Security Lake also enables all the existing settings and resources that it stores or maintains for your Amazon
* Web Services account in the current Region, including security log and event data. For more information, see the
* Amazon Security
* Lake User Guide.
*
*
* @param createDataLakeRequest
* @return A Java Future containing the result of the CreateDataLake operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.CreateDataLake
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture createDataLake(CreateDataLakeRequest createDataLakeRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createDataLakeRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createDataLakeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateDataLake");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateDataLakeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateDataLake").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateDataLakeRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createDataLakeRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates the specified notification subscription in Amazon Security Lake for the organization you specify.
*
*
* @param createDataLakeExceptionSubscriptionRequest
* @return A Java Future containing the result of the CreateDataLakeExceptionSubscription operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.CreateDataLakeExceptionSubscription
* @see AWS API Documentation
*/
@Override
public CompletableFuture createDataLakeExceptionSubscription(
CreateDataLakeExceptionSubscriptionRequest createDataLakeExceptionSubscriptionRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createDataLakeExceptionSubscriptionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
createDataLakeExceptionSubscriptionRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateDataLakeExceptionSubscription");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, CreateDataLakeExceptionSubscriptionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateDataLakeExceptionSubscription").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateDataLakeExceptionSubscriptionRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createDataLakeExceptionSubscriptionRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Automatically enables Amazon Security Lake for new member accounts in your organization. Security Lake is not
* automatically enabled for any existing member accounts in your organization.
*
*
* @param createDataLakeOrganizationConfigurationRequest
* @return A Java Future containing the result of the CreateDataLakeOrganizationConfiguration operation returned by
* the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.CreateDataLakeOrganizationConfiguration
* @see AWS API Documentation
*/
@Override
public CompletableFuture createDataLakeOrganizationConfiguration(
CreateDataLakeOrganizationConfigurationRequest createDataLakeOrganizationConfigurationRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createDataLakeOrganizationConfigurationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
createDataLakeOrganizationConfigurationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateDataLakeOrganizationConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, CreateDataLakeOrganizationConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateDataLakeOrganizationConfiguration").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateDataLakeOrganizationConfigurationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createDataLakeOrganizationConfigurationRequest));
CompletableFuture whenCompleted = executeFuture
.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates a subscription permission for accounts that are already enabled in Amazon Security Lake. You can create a
* subscriber with access to data in the current Amazon Web Services Region.
*
*
* @param createSubscriberRequest
* @return A Java Future containing the result of the CreateSubscriber operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.CreateSubscriber
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture createSubscriber(CreateSubscriberRequest createSubscriberRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createSubscriberRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createSubscriberRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateSubscriber");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateSubscriberResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateSubscriber").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateSubscriberRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createSubscriberRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Notifies the subscriber when new data is written to the data lake for the sources that the subscriber consumes in
* Security Lake. You can create only one subscriber notification per subscriber.
*
*
* @param createSubscriberNotificationRequest
* @return A Java Future containing the result of the CreateSubscriberNotification operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.CreateSubscriberNotification
* @see AWS API Documentation
*/
@Override
public CompletableFuture createSubscriberNotification(
CreateSubscriberNotificationRequest createSubscriberNotificationRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createSubscriberNotificationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createSubscriberNotificationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateSubscriberNotification");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateSubscriberNotificationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateSubscriberNotification").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateSubscriberNotificationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createSubscriberNotificationRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Removes a natively supported Amazon Web Service as an Amazon Security Lake source. You can remove a source for
* one or more Regions. When you remove the source, Security Lake stops collecting data from that source in the
* specified Regions and accounts, and subscribers can no longer consume new data from the source. However,
* subscribers can still consume data that Security Lake collected from the source before removal.
*
*
* You can choose any source type in any Amazon Web Services Region for either accounts that are part of a trusted
* organization or standalone accounts.
*
*
* @param deleteAwsLogSourceRequest
* @return A Java Future containing the result of the DeleteAwsLogSource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.DeleteAwsLogSource
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteAwsLogSource(DeleteAwsLogSourceRequest deleteAwsLogSourceRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteAwsLogSourceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteAwsLogSourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteAwsLogSource");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteAwsLogSourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteAwsLogSource").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteAwsLogSourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteAwsLogSourceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Removes a custom log source from Amazon Security Lake, to stop sending data from the custom source to Security
* Lake.
*
*
* @param deleteCustomLogSourceRequest
* @return A Java Future containing the result of the DeleteCustomLogSource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.DeleteCustomLogSource
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteCustomLogSource(
DeleteCustomLogSourceRequest deleteCustomLogSourceRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteCustomLogSourceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteCustomLogSourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteCustomLogSource");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteCustomLogSourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteCustomLogSource").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteCustomLogSourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteCustomLogSourceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* When you disable Amazon Security Lake from your account, Security Lake is disabled in all Amazon Web Services
* Regions and it stops collecting data from your sources. Also, this API automatically takes steps to remove the
* account from Security Lake. However, Security Lake retains all of your existing settings and the resources that
* it created in your Amazon Web Services account in the current Amazon Web Services Region.
*
*
* The DeleteDataLake
operation does not delete the data that is stored in your Amazon S3 bucket, which
* is owned by your Amazon Web Services account. For more information, see the Amazon Security Lake
* User Guide.
*
*
* @param deleteDataLakeRequest
* @return A Java Future containing the result of the DeleteDataLake operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.DeleteDataLake
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture deleteDataLake(DeleteDataLakeRequest deleteDataLakeRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteDataLakeRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteDataLakeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteDataLake");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteDataLakeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteDataLake").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteDataLakeRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteDataLakeRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes the specified notification subscription in Amazon Security Lake for the organization you specify.
*
*
* @param deleteDataLakeExceptionSubscriptionRequest
* @return A Java Future containing the result of the DeleteDataLakeExceptionSubscription operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.DeleteDataLakeExceptionSubscription
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteDataLakeExceptionSubscription(
DeleteDataLakeExceptionSubscriptionRequest deleteDataLakeExceptionSubscriptionRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteDataLakeExceptionSubscriptionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
deleteDataLakeExceptionSubscriptionRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteDataLakeExceptionSubscription");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, DeleteDataLakeExceptionSubscriptionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteDataLakeExceptionSubscription").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteDataLakeExceptionSubscriptionRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteDataLakeExceptionSubscriptionRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Turns off automatic enablement of Amazon Security Lake for member accounts that are added to an organization in
* Organizations. Only the delegated Security Lake administrator for an organization can perform this operation. If
* the delegated Security Lake administrator performs this operation, new member accounts won't automatically
* contribute data to the data lake.
*
*
* @param deleteDataLakeOrganizationConfigurationRequest
* @return A Java Future containing the result of the DeleteDataLakeOrganizationConfiguration operation returned by
* the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.DeleteDataLakeOrganizationConfiguration
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteDataLakeOrganizationConfiguration(
DeleteDataLakeOrganizationConfigurationRequest deleteDataLakeOrganizationConfigurationRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteDataLakeOrganizationConfigurationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
deleteDataLakeOrganizationConfigurationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteDataLakeOrganizationConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, DeleteDataLakeOrganizationConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteDataLakeOrganizationConfiguration").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteDataLakeOrganizationConfigurationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteDataLakeOrganizationConfigurationRequest));
CompletableFuture whenCompleted = executeFuture
.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes the subscription permission and all notification settings for accounts that are already enabled in Amazon
* Security Lake. When you run DeleteSubscriber
, the subscriber will no longer consume data from
* Security Lake and the subscriber is removed. This operation deletes the subscriber and removes access to data in
* the current Amazon Web Services Region.
*
*
* @param deleteSubscriberRequest
* @return A Java Future containing the result of the DeleteSubscriber operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.DeleteSubscriber
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture deleteSubscriber(DeleteSubscriberRequest deleteSubscriberRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteSubscriberRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteSubscriberRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteSubscriber");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteSubscriberResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteSubscriber").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteSubscriberRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteSubscriberRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes the specified notification subscription in Amazon Security Lake for the organization you specify.
*
*
* @param deleteSubscriberNotificationRequest
* @return A Java Future containing the result of the DeleteSubscriberNotification operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.DeleteSubscriberNotification
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteSubscriberNotification(
DeleteSubscriberNotificationRequest deleteSubscriberNotificationRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteSubscriberNotificationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteSubscriberNotificationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteSubscriberNotification");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteSubscriberNotificationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteSubscriberNotification").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteSubscriberNotificationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteSubscriberNotificationRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes the Amazon Security Lake delegated administrator account for the organization. This API can only be
* called by the organization management account. The organization management account cannot be the delegated
* administrator account.
*
*
* @param deregisterDataLakeDelegatedAdministratorRequest
* @return A Java Future containing the result of the DeregisterDataLakeDelegatedAdministrator operation returned by
* the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.DeregisterDataLakeDelegatedAdministrator
* @see AWS API Documentation
*/
@Override
public CompletableFuture deregisterDataLakeDelegatedAdministrator(
DeregisterDataLakeDelegatedAdministratorRequest deregisterDataLakeDelegatedAdministratorRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(
deregisterDataLakeDelegatedAdministratorRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
deregisterDataLakeDelegatedAdministratorRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeregisterDataLakeDelegatedAdministrator");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, DeregisterDataLakeDelegatedAdministratorResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeregisterDataLakeDelegatedAdministrator").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeregisterDataLakeDelegatedAdministratorRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deregisterDataLakeDelegatedAdministratorRequest));
CompletableFuture whenCompleted = executeFuture
.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves the details of exception notifications for the account in Amazon Security Lake.
*
*
* @param getDataLakeExceptionSubscriptionRequest
* @return A Java Future containing the result of the GetDataLakeExceptionSubscription operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.GetDataLakeExceptionSubscription
* @see AWS API Documentation
*/
@Override
public CompletableFuture getDataLakeExceptionSubscription(
GetDataLakeExceptionSubscriptionRequest getDataLakeExceptionSubscriptionRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getDataLakeExceptionSubscriptionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
getDataLakeExceptionSubscriptionRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetDataLakeExceptionSubscription");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, GetDataLakeExceptionSubscriptionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetDataLakeExceptionSubscription").withProtocolMetadata(protocolMetadata)
.withMarshaller(new GetDataLakeExceptionSubscriptionRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(getDataLakeExceptionSubscriptionRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves the configuration that will be automatically set up for accounts added to the organization after the
* organization has onboarded to Amazon Security Lake. This API does not take input parameters.
*
*
* @param getDataLakeOrganizationConfigurationRequest
* @return A Java Future containing the result of the GetDataLakeOrganizationConfiguration operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.GetDataLakeOrganizationConfiguration
* @see AWS API Documentation
*/
@Override
public CompletableFuture getDataLakeOrganizationConfiguration(
GetDataLakeOrganizationConfigurationRequest getDataLakeOrganizationConfigurationRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getDataLakeOrganizationConfigurationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
getDataLakeOrganizationConfigurationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetDataLakeOrganizationConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, GetDataLakeOrganizationConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetDataLakeOrganizationConfiguration").withProtocolMetadata(protocolMetadata)
.withMarshaller(new GetDataLakeOrganizationConfigurationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(getDataLakeOrganizationConfigurationRequest));
CompletableFuture whenCompleted = executeFuture
.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves a snapshot of the current Region, including whether Amazon Security Lake is enabled for those accounts
* and which sources Security Lake is collecting data from.
*
*
* @param getDataLakeSourcesRequest
* @return A Java Future containing the result of the GetDataLakeSources operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.GetDataLakeSources
* @see AWS API Documentation
*/
@Override
public CompletableFuture getDataLakeSources(GetDataLakeSourcesRequest getDataLakeSourcesRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getDataLakeSourcesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getDataLakeSourcesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetDataLakeSources");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetDataLakeSourcesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetDataLakeSources").withProtocolMetadata(protocolMetadata)
.withMarshaller(new GetDataLakeSourcesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(getDataLakeSourcesRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves the subscription information for the specified subscription ID. You can get information about a
* specific subscriber.
*
*
* @param getSubscriberRequest
* @return A Java Future containing the result of the GetSubscriber operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.GetSubscriber
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture getSubscriber(GetSubscriberRequest getSubscriberRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getSubscriberRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getSubscriberRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetSubscriber");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetSubscriberResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetSubscriber").withProtocolMetadata(protocolMetadata)
.withMarshaller(new GetSubscriberRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(getSubscriberRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Lists the Amazon Security Lake exceptions that you can use to find the source of problems and fix them.
*
*
* @param listDataLakeExceptionsRequest
* @return A Java Future containing the result of the ListDataLakeExceptions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.ListDataLakeExceptions
* @see AWS API Documentation
*/
@Override
public CompletableFuture listDataLakeExceptions(
ListDataLakeExceptionsRequest listDataLakeExceptionsRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listDataLakeExceptionsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listDataLakeExceptionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListDataLakeExceptions");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListDataLakeExceptionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListDataLakeExceptions").withProtocolMetadata(protocolMetadata)
.withMarshaller(new ListDataLakeExceptionsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(listDataLakeExceptionsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves the Amazon Security Lake configuration object for the specified Amazon Web Services Regions. You can
* use this operation to determine whether Security Lake is enabled for a Region.
*
*
* @param listDataLakesRequest
* @return A Java Future containing the result of the ListDataLakes operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.ListDataLakes
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture listDataLakes(ListDataLakesRequest listDataLakesRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listDataLakesRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listDataLakesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListDataLakes");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListDataLakesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListDataLakes").withProtocolMetadata(protocolMetadata)
.withMarshaller(new ListDataLakesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(listDataLakesRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves the log sources in the current Amazon Web Services Region.
*
*
* @param listLogSourcesRequest
* @return A Java Future containing the result of the ListLogSources operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.ListLogSources
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture listLogSources(ListLogSourcesRequest listLogSourcesRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listLogSourcesRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listLogSourcesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListLogSources");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListLogSourcesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListLogSources").withProtocolMetadata(protocolMetadata)
.withMarshaller(new ListLogSourcesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(listLogSourcesRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* List all subscribers for the specific Amazon Security Lake account ID. You can retrieve a list of subscriptions
* associated with a specific organization or Amazon Web Services account.
*
*
* @param listSubscribersRequest
* @return A Java Future containing the result of the ListSubscribers operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.ListSubscribers
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture listSubscribers(ListSubscribersRequest listSubscribersRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listSubscribersRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listSubscribersRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListSubscribers");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListSubscribersResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListSubscribers").withProtocolMetadata(protocolMetadata)
.withMarshaller(new ListSubscribersRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(listSubscribersRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves the tags (keys and values) that are associated with an Amazon Security Lake resource: a subscriber, or
* the data lake configuration for your Amazon Web Services account in a particular Amazon Web Services Region.
*
*
* @param listTagsForResourceRequest
* @return A Java Future containing the result of the ListTagsForResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.ListTagsForResource
* @see AWS API Documentation
*/
@Override
public CompletableFuture listTagsForResource(
ListTagsForResourceRequest listTagsForResourceRequest) {
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, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListTagsForResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListTagsForResource").withProtocolMetadata(protocolMetadata)
.withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(listTagsForResourceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Designates the Amazon Security Lake delegated administrator account for the organization. This API can only be
* called by the organization management account. The organization management account cannot be the delegated
* administrator account.
*
*
* @param registerDataLakeDelegatedAdministratorRequest
* @return A Java Future containing the result of the RegisterDataLakeDelegatedAdministrator operation returned by
* the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.RegisterDataLakeDelegatedAdministrator
* @see AWS API Documentation
*/
@Override
public CompletableFuture registerDataLakeDelegatedAdministrator(
RegisterDataLakeDelegatedAdministratorRequest registerDataLakeDelegatedAdministratorRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(registerDataLakeDelegatedAdministratorRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
registerDataLakeDelegatedAdministratorRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RegisterDataLakeDelegatedAdministrator");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, RegisterDataLakeDelegatedAdministratorResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("RegisterDataLakeDelegatedAdministrator").withProtocolMetadata(protocolMetadata)
.withMarshaller(new RegisterDataLakeDelegatedAdministratorRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(registerDataLakeDelegatedAdministratorRequest));
CompletableFuture whenCompleted = executeFuture
.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Adds or updates one or more tags that are associated with an Amazon Security Lake resource: a subscriber, or the
* data lake configuration for your Amazon Web Services account in a particular Amazon Web Services Region. A
* tag is a label that you can define and associate with Amazon Web Services resources. Each tag consists of
* a required tag key and an associated tag value. A tag key is a general label that acts as a
* category for a more specific tag value. A tag value acts as a descriptor for a tag key. Tags can help you
* identify, categorize, and manage resources in different ways, such as by owner, environment, or other criteria.
* For more information, see Tagging Amazon Security
* Lake resources in the Amazon Security Lake User Guide.
*
*
* @param tagResourceRequest
* @return A Java Future containing the result of the TagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.TagResource
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture tagResource(TagResourceRequest tagResourceRequest) {
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, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
TagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("TagResource").withProtocolMetadata(protocolMetadata)
.withMarshaller(new TagResourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(tagResourceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Removes one or more tags (keys and values) from an Amazon Security Lake resource: a subscriber, or the data lake
* configuration for your Amazon Web Services account in a particular Amazon Web Services Region.
*
*
* @param untagResourceRequest
* @return A Java Future containing the result of the UntagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.UntagResource
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture untagResource(UntagResourceRequest untagResourceRequest) {
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, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UntagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UntagResource").withProtocolMetadata(protocolMetadata)
.withMarshaller(new UntagResourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(untagResourceRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Specifies where to store your security data and for how long. You can add a rollup Region to consolidate data
* from multiple Amazon Web Services Regions.
*
*
* @param updateDataLakeRequest
* @return A Java Future containing the result of the UpdateDataLake operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.UpdateDataLake
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture updateDataLake(UpdateDataLakeRequest updateDataLakeRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateDataLakeRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateDataLakeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateDataLake");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateDataLakeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateDataLake").withProtocolMetadata(protocolMetadata)
.withMarshaller(new UpdateDataLakeRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(updateDataLakeRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Updates the specified notification subscription in Amazon Security Lake for the organization you specify.
*
*
* @param updateDataLakeExceptionSubscriptionRequest
* @return A Java Future containing the result of the UpdateDataLakeExceptionSubscription operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.UpdateDataLakeExceptionSubscription
* @see AWS API Documentation
*/
@Override
public CompletableFuture updateDataLakeExceptionSubscription(
UpdateDataLakeExceptionSubscriptionRequest updateDataLakeExceptionSubscriptionRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateDataLakeExceptionSubscriptionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
updateDataLakeExceptionSubscriptionRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateDataLakeExceptionSubscription");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, UpdateDataLakeExceptionSubscriptionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateDataLakeExceptionSubscription").withProtocolMetadata(protocolMetadata)
.withMarshaller(new UpdateDataLakeExceptionSubscriptionRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(updateDataLakeExceptionSubscriptionRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Updates an existing subscription for the given Amazon Security Lake account ID. You can update a subscriber by
* changing the sources that the subscriber consumes data from.
*
*
* @param updateSubscriberRequest
* @return A Java Future containing the result of the UpdateSubscriber operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.UpdateSubscriber
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture updateSubscriber(UpdateSubscriberRequest updateSubscriberRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateSubscriberRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateSubscriberRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateSubscriber");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateSubscriberResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateSubscriber").withProtocolMetadata(protocolMetadata)
.withMarshaller(new UpdateSubscriberRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(updateSubscriberRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Updates an existing notification method for the subscription (SQS or HTTPs endpoint) or switches the notification
* subscription endpoint for a subscriber.
*
*
* @param updateSubscriberNotificationRequest
* @return A Java Future containing the result of the UpdateSubscriberNotification operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - BadRequestException The request is malformed or contains an error such as an invalid parameter value
* or a missing required parameter.
* - ResourceNotFoundException The resource could not be found.
* - InternalServerException Internal service exceptions are sometimes caused by transient issues. Before
* you start troubleshooting, perform the operation again.
* - AccessDeniedException You do not have sufficient access to perform this action. Access denied errors
* appear when Amazon Security Lake explicitly or implicitly denies an authorization request. An explicit
* denial occurs when a policy contains a Deny statement for the specific Amazon Web Services action. An
* implicit denial occurs when there is no applicable Deny statement and also no applicable Allow statement.
*
* - ConflictException Occurs when a conflict with a previous successful write is detected. This generally
* occurs when the previous write did not have time to propagate to the host serving the current request. A
* retry (with appropriate backoff logic) is the recommended response to this exception.
* - ThrottlingException The limit on the number of requests per second was exceeded.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - SecurityLakeException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample SecurityLakeAsyncClient.UpdateSubscriberNotification
* @see AWS API Documentation
*/
@Override
public CompletableFuture updateSubscriberNotification(
UpdateSubscriberNotificationRequest updateSubscriberNotificationRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateSubscriberNotificationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateSubscriberNotificationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "SecurityLake");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateSubscriberNotification");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateSubscriberNotificationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateSubscriberNotification").withProtocolMetadata(protocolMetadata)
.withMarshaller(new UpdateSubscriberNotificationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(updateSubscriberNotificationRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
@Override
public final SecurityLakeServiceClientConfiguration serviceClientConfiguration() {
return new SecurityLakeServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build();
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
private > T init(T builder) {
return builder
.clientConfiguration(clientConfiguration)
.defaultServiceExceptionSupplier(SecurityLakeException::builder)
.protocol(AwsJsonProtocol.REST_JSON)
.protocolVersion("1.1")
.registerModeledException(
ExceptionMetadata.builder().errorCode("ThrottlingException")
.exceptionBuilderSupplier(ThrottlingException::builder).httpStatusCode(429).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InternalServerException")
.exceptionBuilderSupplier(InternalServerException::builder).httpStatusCode(500).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("AccessDeniedException")
.exceptionBuilderSupplier(AccessDeniedException::builder).httpStatusCode(403).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ConflictException")
.exceptionBuilderSupplier(ConflictException::builder).httpStatusCode(409).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceNotFoundException")
.exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(404).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("BadRequestException")
.exceptionBuilderSupplier(BadRequestException::builder).httpStatusCode(400).build());
}
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 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();
}
SecurityLakeServiceClientConfigurationBuilder serviceConfigBuilder = new SecurityLakeServiceClientConfigurationBuilder(
configuration);
for (SdkPlugin plugin : plugins) {
plugin.configureClient(serviceConfigBuilder);
}
return configuration.build();
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
JsonOperationMetadata operationMetadata) {
return protocolFactory.createErrorResponseHandler(operationMetadata);
}
@Override
public void close() {
clientHandler.close();
}
}