
software.amazon.awssdk.services.wafv2.DefaultWafv2AsyncClient Maven / Gradle / Ivy
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.wafv2;
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.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
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.wafv2.model.AssociateWebAclRequest;
import software.amazon.awssdk.services.wafv2.model.AssociateWebAclResponse;
import software.amazon.awssdk.services.wafv2.model.CheckCapacityRequest;
import software.amazon.awssdk.services.wafv2.model.CheckCapacityResponse;
import software.amazon.awssdk.services.wafv2.model.CreateIpSetRequest;
import software.amazon.awssdk.services.wafv2.model.CreateIpSetResponse;
import software.amazon.awssdk.services.wafv2.model.CreateRegexPatternSetRequest;
import software.amazon.awssdk.services.wafv2.model.CreateRegexPatternSetResponse;
import software.amazon.awssdk.services.wafv2.model.CreateRuleGroupRequest;
import software.amazon.awssdk.services.wafv2.model.CreateRuleGroupResponse;
import software.amazon.awssdk.services.wafv2.model.CreateWebAclRequest;
import software.amazon.awssdk.services.wafv2.model.CreateWebAclResponse;
import software.amazon.awssdk.services.wafv2.model.DeleteFirewallManagerRuleGroupsRequest;
import software.amazon.awssdk.services.wafv2.model.DeleteFirewallManagerRuleGroupsResponse;
import software.amazon.awssdk.services.wafv2.model.DeleteIpSetRequest;
import software.amazon.awssdk.services.wafv2.model.DeleteIpSetResponse;
import software.amazon.awssdk.services.wafv2.model.DeleteLoggingConfigurationRequest;
import software.amazon.awssdk.services.wafv2.model.DeleteLoggingConfigurationResponse;
import software.amazon.awssdk.services.wafv2.model.DeletePermissionPolicyRequest;
import software.amazon.awssdk.services.wafv2.model.DeletePermissionPolicyResponse;
import software.amazon.awssdk.services.wafv2.model.DeleteRegexPatternSetRequest;
import software.amazon.awssdk.services.wafv2.model.DeleteRegexPatternSetResponse;
import software.amazon.awssdk.services.wafv2.model.DeleteRuleGroupRequest;
import software.amazon.awssdk.services.wafv2.model.DeleteRuleGroupResponse;
import software.amazon.awssdk.services.wafv2.model.DeleteWebAclRequest;
import software.amazon.awssdk.services.wafv2.model.DeleteWebAclResponse;
import software.amazon.awssdk.services.wafv2.model.DescribeManagedRuleGroupRequest;
import software.amazon.awssdk.services.wafv2.model.DescribeManagedRuleGroupResponse;
import software.amazon.awssdk.services.wafv2.model.DisassociateWebAclRequest;
import software.amazon.awssdk.services.wafv2.model.DisassociateWebAclResponse;
import software.amazon.awssdk.services.wafv2.model.GetIpSetRequest;
import software.amazon.awssdk.services.wafv2.model.GetIpSetResponse;
import software.amazon.awssdk.services.wafv2.model.GetLoggingConfigurationRequest;
import software.amazon.awssdk.services.wafv2.model.GetLoggingConfigurationResponse;
import software.amazon.awssdk.services.wafv2.model.GetPermissionPolicyRequest;
import software.amazon.awssdk.services.wafv2.model.GetPermissionPolicyResponse;
import software.amazon.awssdk.services.wafv2.model.GetRateBasedStatementManagedKeysRequest;
import software.amazon.awssdk.services.wafv2.model.GetRateBasedStatementManagedKeysResponse;
import software.amazon.awssdk.services.wafv2.model.GetRegexPatternSetRequest;
import software.amazon.awssdk.services.wafv2.model.GetRegexPatternSetResponse;
import software.amazon.awssdk.services.wafv2.model.GetRuleGroupRequest;
import software.amazon.awssdk.services.wafv2.model.GetRuleGroupResponse;
import software.amazon.awssdk.services.wafv2.model.GetSampledRequestsRequest;
import software.amazon.awssdk.services.wafv2.model.GetSampledRequestsResponse;
import software.amazon.awssdk.services.wafv2.model.GetWebAclForResourceRequest;
import software.amazon.awssdk.services.wafv2.model.GetWebAclForResourceResponse;
import software.amazon.awssdk.services.wafv2.model.GetWebAclRequest;
import software.amazon.awssdk.services.wafv2.model.GetWebAclResponse;
import software.amazon.awssdk.services.wafv2.model.ListAvailableManagedRuleGroupsRequest;
import software.amazon.awssdk.services.wafv2.model.ListAvailableManagedRuleGroupsResponse;
import software.amazon.awssdk.services.wafv2.model.ListIpSetsRequest;
import software.amazon.awssdk.services.wafv2.model.ListIpSetsResponse;
import software.amazon.awssdk.services.wafv2.model.ListLoggingConfigurationsRequest;
import software.amazon.awssdk.services.wafv2.model.ListLoggingConfigurationsResponse;
import software.amazon.awssdk.services.wafv2.model.ListRegexPatternSetsRequest;
import software.amazon.awssdk.services.wafv2.model.ListRegexPatternSetsResponse;
import software.amazon.awssdk.services.wafv2.model.ListResourcesForWebAclRequest;
import software.amazon.awssdk.services.wafv2.model.ListResourcesForWebAclResponse;
import software.amazon.awssdk.services.wafv2.model.ListRuleGroupsRequest;
import software.amazon.awssdk.services.wafv2.model.ListRuleGroupsResponse;
import software.amazon.awssdk.services.wafv2.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.wafv2.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.wafv2.model.ListWebAcLsRequest;
import software.amazon.awssdk.services.wafv2.model.ListWebAcLsResponse;
import software.amazon.awssdk.services.wafv2.model.PutLoggingConfigurationRequest;
import software.amazon.awssdk.services.wafv2.model.PutLoggingConfigurationResponse;
import software.amazon.awssdk.services.wafv2.model.PutPermissionPolicyRequest;
import software.amazon.awssdk.services.wafv2.model.PutPermissionPolicyResponse;
import software.amazon.awssdk.services.wafv2.model.TagResourceRequest;
import software.amazon.awssdk.services.wafv2.model.TagResourceResponse;
import software.amazon.awssdk.services.wafv2.model.UntagResourceRequest;
import software.amazon.awssdk.services.wafv2.model.UntagResourceResponse;
import software.amazon.awssdk.services.wafv2.model.UpdateIpSetRequest;
import software.amazon.awssdk.services.wafv2.model.UpdateIpSetResponse;
import software.amazon.awssdk.services.wafv2.model.UpdateRegexPatternSetRequest;
import software.amazon.awssdk.services.wafv2.model.UpdateRegexPatternSetResponse;
import software.amazon.awssdk.services.wafv2.model.UpdateRuleGroupRequest;
import software.amazon.awssdk.services.wafv2.model.UpdateRuleGroupResponse;
import software.amazon.awssdk.services.wafv2.model.UpdateWebAclRequest;
import software.amazon.awssdk.services.wafv2.model.UpdateWebAclResponse;
import software.amazon.awssdk.services.wafv2.model.WafAssociatedItemException;
import software.amazon.awssdk.services.wafv2.model.WafDuplicateItemException;
import software.amazon.awssdk.services.wafv2.model.WafInternalErrorException;
import software.amazon.awssdk.services.wafv2.model.WafInvalidOperationException;
import software.amazon.awssdk.services.wafv2.model.WafInvalidParameterException;
import software.amazon.awssdk.services.wafv2.model.WafInvalidPermissionPolicyException;
import software.amazon.awssdk.services.wafv2.model.WafInvalidResourceException;
import software.amazon.awssdk.services.wafv2.model.WafLimitsExceededException;
import software.amazon.awssdk.services.wafv2.model.WafNonexistentItemException;
import software.amazon.awssdk.services.wafv2.model.WafOptimisticLockException;
import software.amazon.awssdk.services.wafv2.model.WafServiceLinkedRoleErrorException;
import software.amazon.awssdk.services.wafv2.model.WafSubscriptionNotFoundException;
import software.amazon.awssdk.services.wafv2.model.WafTagOperationException;
import software.amazon.awssdk.services.wafv2.model.WafTagOperationInternalErrorException;
import software.amazon.awssdk.services.wafv2.model.WafUnavailableEntityException;
import software.amazon.awssdk.services.wafv2.model.Wafv2Exception;
import software.amazon.awssdk.services.wafv2.transform.AssociateWebAclRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.CheckCapacityRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.CreateIpSetRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.CreateRegexPatternSetRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.CreateRuleGroupRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.CreateWebAclRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.DeleteFirewallManagerRuleGroupsRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.DeleteIpSetRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.DeleteLoggingConfigurationRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.DeletePermissionPolicyRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.DeleteRegexPatternSetRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.DeleteRuleGroupRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.DeleteWebAclRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.DescribeManagedRuleGroupRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.DisassociateWebAclRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.GetIpSetRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.GetLoggingConfigurationRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.GetPermissionPolicyRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.GetRateBasedStatementManagedKeysRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.GetRegexPatternSetRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.GetRuleGroupRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.GetSampledRequestsRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.GetWebAclForResourceRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.GetWebAclRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.ListAvailableManagedRuleGroupsRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.ListIpSetsRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.ListLoggingConfigurationsRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.ListRegexPatternSetsRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.ListResourcesForWebAclRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.ListRuleGroupsRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.ListWebAcLsRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.PutLoggingConfigurationRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.PutPermissionPolicyRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.UpdateIpSetRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.UpdateRegexPatternSetRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.UpdateRuleGroupRequestMarshaller;
import software.amazon.awssdk.services.wafv2.transform.UpdateWebAclRequestMarshaller;
import software.amazon.awssdk.utils.CompletableFutureUtils;
/**
* Internal implementation of {@link Wafv2AsyncClient}.
*
* @see Wafv2AsyncClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultWafv2AsyncClient implements Wafv2AsyncClient {
private static final Logger log = LoggerFactory.getLogger(DefaultWafv2AsyncClient.class);
private final AsyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultWafv2AsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration;
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Associates a Web ACL with a regional application resource, to protect the resource. A regional application can be
* an Application Load Balancer (ALB), an API Gateway REST API, or an AppSync GraphQL API.
*
*
* For AWS CloudFront, don't use this call. Instead, use your CloudFront distribution configuration. To associate a
* Web ACL, in the CloudFront call UpdateDistribution
, set the web ACL ID to the Amazon Resource Name
* (ARN) of the Web ACL. For information, see UpdateDistribution.
*
*
* @param associateWebAclRequest
* @return A Java Future containing the result of the AssociateWebACL operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafUnavailableEntityException AWS WAF couldn’t retrieve the resource that you requested. Retry your
* request.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.AssociateWebACL
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture associateWebACL(AssociateWebAclRequest associateWebAclRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, associateWebAclRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AssociateWebACL");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AssociateWebAclResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AssociateWebACL")
.withMarshaller(new AssociateWebAclRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(associateWebAclRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = associateWebAclRequest.overrideConfiguration().orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Returns the web ACL capacity unit (WCU) requirements for a specified scope and set of rules. You can use this to
* check the capacity requirements for the rules you want to use in a RuleGroup or WebACL.
*
*
* AWS WAF uses WCUs to calculate and control the operating resources that are used to run your rules, rule groups,
* and web ACLs. AWS WAF calculates capacity differently for each rule type, to reflect the relative cost of each
* rule. Simple rules that cost little to run use fewer WCUs than more complex rules that use more processing power.
* Rule group capacity is fixed at creation, which helps users plan their web ACL WCU usage when they use a rule
* group. The WCU limit for web ACLs is 1,500.
*
*
* @param checkCapacityRequest
* @return A Java Future containing the result of the CheckCapacity operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafLimitsExceededException AWS WAF couldn’t perform the operation because you exceeded your resource
* limit. For example, the maximum number of
WebACL
objects that you can create for an AWS
* account. For more information, see Limits in the AWS WAF
* Developer Guide.
* - WafInvalidResourceException AWS WAF couldn’t perform the operation because the resource that you
* requested isn’t valid. Check the resource, and try again.
* - WafUnavailableEntityException AWS WAF couldn’t retrieve the resource that you requested. Retry your
* request.
* - WafSubscriptionNotFoundException
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.CheckCapacity
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture checkCapacity(CheckCapacityRequest checkCapacityRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, checkCapacityRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CheckCapacity");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CheckCapacityResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CheckCapacity")
.withMarshaller(new CheckCapacityRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(checkCapacityRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = checkCapacityRequest.overrideConfiguration().orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Creates an IPSet, which you use to identify web requests that originate from specific IP addresses or
* ranges of IP addresses. For example, if you're receiving a lot of requests from a ranges of IP addresses, you can
* configure AWS WAF to block them using an IPSet that lists those IP addresses.
*
*
* @param createIpSetRequest
* @return A Java Future containing the result of the CreateIPSet operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafDuplicateItemException AWS WAF couldn’t perform the operation because the resource that you tried
* to save is a duplicate of an existing one.
* - WafOptimisticLockException AWS WAF couldn’t save your changes because you tried to update or delete a
* resource that has changed since you last retrieved it. Get the resource again, make any changes you need
* to make to the new copy, and retry your operation.
* - WafLimitsExceededException AWS WAF couldn’t perform the operation because you exceeded your resource
* limit. For example, the maximum number of
WebACL
objects that you can create for an AWS
* account. For more information, see Limits in the AWS WAF
* Developer Guide.
* - WafTagOperationException An error occurred during the tagging operation. Retry your request.
* - WafTagOperationInternalErrorException AWS WAF couldn’t perform your tagging operation because of an
* internal error. Retry your request.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.CreateIPSet
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createIPSet(CreateIpSetRequest createIpSetRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createIpSetRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateIPSet");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateIpSetResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateIPSet").withMarshaller(new CreateIpSetRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createIpSetRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = createIpSetRequest.overrideConfiguration().orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Creates a RegexPatternSet, which you reference in a RegexPatternSetReferenceStatement, to have AWS
* WAF inspect a web request component for the specified patterns.
*
*
* @param createRegexPatternSetRequest
* @return A Java Future containing the result of the CreateRegexPatternSet operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafDuplicateItemException AWS WAF couldn’t perform the operation because the resource that you tried
* to save is a duplicate of an existing one.
* - WafOptimisticLockException AWS WAF couldn’t save your changes because you tried to update or delete a
* resource that has changed since you last retrieved it. Get the resource again, make any changes you need
* to make to the new copy, and retry your operation.
* - WafLimitsExceededException AWS WAF couldn’t perform the operation because you exceeded your resource
* limit. For example, the maximum number of
WebACL
objects that you can create for an AWS
* account. For more information, see Limits in the AWS WAF
* Developer Guide.
* - WafTagOperationException An error occurred during the tagging operation. Retry your request.
* - WafTagOperationInternalErrorException AWS WAF couldn’t perform your tagging operation because of an
* internal error. Retry your request.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.CreateRegexPatternSet
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture createRegexPatternSet(
CreateRegexPatternSetRequest createRegexPatternSetRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createRegexPatternSetRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateRegexPatternSet");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateRegexPatternSetResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateRegexPatternSet")
.withMarshaller(new CreateRegexPatternSetRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createRegexPatternSetRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = createRegexPatternSetRequest.overrideConfiguration().orElse(
null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Creates a RuleGroup per the specifications provided.
*
*
* A rule group defines a collection of rules to inspect and control web requests that you can use in a
* WebACL. When you create a rule group, you define an immutable capacity limit. If you update a rule group,
* you must stay within the capacity. This allows others to reuse the rule group with confidence in its capacity
* requirements.
*
*
* @param createRuleGroupRequest
* @return A Java Future containing the result of the CreateRuleGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafDuplicateItemException AWS WAF couldn’t perform the operation because the resource that you tried
* to save is a duplicate of an existing one.
* - WafOptimisticLockException AWS WAF couldn’t save your changes because you tried to update or delete a
* resource that has changed since you last retrieved it. Get the resource again, make any changes you need
* to make to the new copy, and retry your operation.
* - WafLimitsExceededException AWS WAF couldn’t perform the operation because you exceeded your resource
* limit. For example, the maximum number of
WebACL
objects that you can create for an AWS
* account. For more information, see Limits in the AWS WAF
* Developer Guide.
* - WafUnavailableEntityException AWS WAF couldn’t retrieve the resource that you requested. Retry your
* request.
* - WafTagOperationException An error occurred during the tagging operation. Retry your request.
* - WafTagOperationInternalErrorException AWS WAF couldn’t perform your tagging operation because of an
* internal error. Retry your request.
* - WafSubscriptionNotFoundException
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.CreateRuleGroup
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createRuleGroup(CreateRuleGroupRequest createRuleGroupRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createRuleGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateRuleGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateRuleGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateRuleGroup")
.withMarshaller(new CreateRuleGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createRuleGroupRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = createRuleGroupRequest.overrideConfiguration().orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Creates a WebACL per the specifications provided.
*
*
* A Web ACL defines a collection of rules to use to inspect and control web requests. Each rule has an action
* defined (allow, block, or count) for requests that match the statement of the rule. In the Web ACL, you assign a
* default action to take (allow, block) for any request that does not match any of the rules. The rules in a Web
* ACL can be a combination of the types Rule, RuleGroup, and managed rule group. You can associate a
* Web ACL with one or more AWS resources to protect. The resources can be Amazon CloudFront, an Amazon API Gateway
* REST API, an Application Load Balancer, or an AWS AppSync GraphQL API.
*
*
* @param createWebAclRequest
* @return A Java Future containing the result of the CreateWebACL operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafDuplicateItemException AWS WAF couldn’t perform the operation because the resource that you tried
* to save is a duplicate of an existing one.
* - WafOptimisticLockException AWS WAF couldn’t save your changes because you tried to update or delete a
* resource that has changed since you last retrieved it. Get the resource again, make any changes you need
* to make to the new copy, and retry your operation.
* - WafLimitsExceededException AWS WAF couldn’t perform the operation because you exceeded your resource
* limit. For example, the maximum number of
WebACL
objects that you can create for an AWS
* account. For more information, see Limits in the AWS WAF
* Developer Guide.
* - WafInvalidResourceException AWS WAF couldn’t perform the operation because the resource that you
* requested isn’t valid. Check the resource, and try again.
* - WafUnavailableEntityException AWS WAF couldn’t retrieve the resource that you requested. Retry your
* request.
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafTagOperationException An error occurred during the tagging operation. Retry your request.
* - WafTagOperationInternalErrorException AWS WAF couldn’t perform your tagging operation because of an
* internal error. Retry your request.
* - WafSubscriptionNotFoundException
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.CreateWebACL
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createWebACL(CreateWebAclRequest createWebAclRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createWebAclRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateWebACL");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateWebAclResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateWebACL").withMarshaller(new CreateWebAclRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createWebAclRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = createWebAclRequest.overrideConfiguration().orElse(null);
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 all rule groups that are managed by AWS Firewall Manager for the specified web ACL.
*
*
* You can only use this if ManagedByFirewallManager
is false in the specified WebACL.
*
*
* @param deleteFirewallManagerRuleGroupsRequest
* @return A Java Future containing the result of the DeleteFirewallManagerRuleGroups operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafOptimisticLockException AWS WAF couldn’t save your changes because you tried to update or delete a
* resource that has changed since you last retrieved it. Get the resource again, make any changes you need
* to make to the new copy, and retry your operation.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.DeleteFirewallManagerRuleGroups
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteFirewallManagerRuleGroups(
DeleteFirewallManagerRuleGroupsRequest deleteFirewallManagerRuleGroupsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
deleteFirewallManagerRuleGroupsRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteFirewallManagerRuleGroups");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteFirewallManagerRuleGroupsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteFirewallManagerRuleGroups")
.withMarshaller(new DeleteFirewallManagerRuleGroupsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteFirewallManagerRuleGroupsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = deleteFirewallManagerRuleGroupsRequest
.overrideConfiguration().orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Deletes the specified IPSet.
*
*
* @param deleteIpSetRequest
* @return A Java Future containing the result of the DeleteIPSet operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafOptimisticLockException AWS WAF couldn’t save your changes because you tried to update or delete a
* resource that has changed since you last retrieved it. Get the resource again, make any changes you need
* to make to the new copy, and retry your operation.
* - WafAssociatedItemException AWS WAF couldn’t perform the operation because your resource is being used
* by another resource or it’s associated with another resource.
* - WafTagOperationException An error occurred during the tagging operation. Retry your request.
* - WafTagOperationInternalErrorException AWS WAF couldn’t perform your tagging operation because of an
* internal error. Retry your request.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.DeleteIPSet
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteIPSet(DeleteIpSetRequest deleteIpSetRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteIpSetRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteIPSet");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteIpSetResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteIPSet").withMarshaller(new DeleteIpSetRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteIpSetRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = deleteIpSetRequest.overrideConfiguration().orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Deletes the LoggingConfiguration from the specified web ACL.
*
*
* @param deleteLoggingConfigurationRequest
* @return A Java Future containing the result of the DeleteLoggingConfiguration operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafOptimisticLockException AWS WAF couldn’t save your changes because you tried to update or delete a
* resource that has changed since you last retrieved it. Get the resource again, make any changes you need
* to make to the new copy, and retry your operation.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.DeleteLoggingConfiguration
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteLoggingConfiguration(
DeleteLoggingConfigurationRequest deleteLoggingConfigurationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteLoggingConfigurationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteLoggingConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteLoggingConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteLoggingConfiguration")
.withMarshaller(new DeleteLoggingConfigurationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteLoggingConfigurationRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = deleteLoggingConfigurationRequest.overrideConfiguration()
.orElse(null);
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);
}
}
/**
*
* Permanently deletes an IAM policy from the specified rule group.
*
*
* You must be the owner of the rule group to perform this operation.
*
*
* @param deletePermissionPolicyRequest
* @return A Java Future containing the result of the DeletePermissionPolicy operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.DeletePermissionPolicy
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture deletePermissionPolicy(
DeletePermissionPolicyRequest deletePermissionPolicyRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deletePermissionPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeletePermissionPolicy");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeletePermissionPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeletePermissionPolicy")
.withMarshaller(new DeletePermissionPolicyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deletePermissionPolicyRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = deletePermissionPolicyRequest.overrideConfiguration().orElse(
null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Deletes the specified RegexPatternSet.
*
*
* @param deleteRegexPatternSetRequest
* @return A Java Future containing the result of the DeleteRegexPatternSet operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafOptimisticLockException AWS WAF couldn’t save your changes because you tried to update or delete a
* resource that has changed since you last retrieved it. Get the resource again, make any changes you need
* to make to the new copy, and retry your operation.
* - WafAssociatedItemException AWS WAF couldn’t perform the operation because your resource is being used
* by another resource or it’s associated with another resource.
* - WafTagOperationException An error occurred during the tagging operation. Retry your request.
* - WafTagOperationInternalErrorException AWS WAF couldn’t perform your tagging operation because of an
* internal error. Retry your request.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.DeleteRegexPatternSet
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture deleteRegexPatternSet(
DeleteRegexPatternSetRequest deleteRegexPatternSetRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteRegexPatternSetRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteRegexPatternSet");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteRegexPatternSetResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteRegexPatternSet")
.withMarshaller(new DeleteRegexPatternSetRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteRegexPatternSetRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = deleteRegexPatternSetRequest.overrideConfiguration().orElse(
null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Deletes the specified RuleGroup.
*
*
* @param deleteRuleGroupRequest
* @return A Java Future containing the result of the DeleteRuleGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafOptimisticLockException AWS WAF couldn’t save your changes because you tried to update or delete a
* resource that has changed since you last retrieved it. Get the resource again, make any changes you need
* to make to the new copy, and retry your operation.
* - WafAssociatedItemException AWS WAF couldn’t perform the operation because your resource is being used
* by another resource or it’s associated with another resource.
* - WafTagOperationException An error occurred during the tagging operation. Retry your request.
* - WafTagOperationInternalErrorException AWS WAF couldn’t perform your tagging operation because of an
* internal error. Retry your request.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.DeleteRuleGroup
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteRuleGroup(DeleteRuleGroupRequest deleteRuleGroupRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteRuleGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteRuleGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteRuleGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteRuleGroup")
.withMarshaller(new DeleteRuleGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteRuleGroupRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = deleteRuleGroupRequest.overrideConfiguration().orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Deletes the specified WebACL.
*
*
* You can only use this if ManagedByFirewallManager
is false in the specified WebACL.
*
*
* @param deleteWebAclRequest
* @return A Java Future containing the result of the DeleteWebACL operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafOptimisticLockException AWS WAF couldn’t save your changes because you tried to update or delete a
* resource that has changed since you last retrieved it. Get the resource again, make any changes you need
* to make to the new copy, and retry your operation.
* - WafAssociatedItemException AWS WAF couldn’t perform the operation because your resource is being used
* by another resource or it’s associated with another resource.
* - WafTagOperationException An error occurred during the tagging operation. Retry your request.
* - WafTagOperationInternalErrorException AWS WAF couldn’t perform your tagging operation because of an
* internal error. Retry your request.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.DeleteWebACL
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteWebACL(DeleteWebAclRequest deleteWebAclRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteWebAclRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteWebACL");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteWebAclResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteWebACL").withMarshaller(new DeleteWebAclRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteWebAclRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = deleteWebAclRequest.overrideConfiguration().orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Provides high-level information for a managed rule group, including descriptions of the rules.
*
*
* @param describeManagedRuleGroupRequest
* @return A Java Future containing the result of the DescribeManagedRuleGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafInvalidResourceException AWS WAF couldn’t perform the operation because the resource that you
* requested isn’t valid. Check the resource, and try again.
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.DescribeManagedRuleGroup
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture describeManagedRuleGroup(
DescribeManagedRuleGroupRequest describeManagedRuleGroupRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeManagedRuleGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeManagedRuleGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeManagedRuleGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeManagedRuleGroup")
.withMarshaller(new DescribeManagedRuleGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeManagedRuleGroupRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = describeManagedRuleGroupRequest.overrideConfiguration()
.orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Disassociates a Web ACL from a regional application resource. A regional application can be an Application Load
* Balancer (ALB), an API Gateway REST API, or an AppSync GraphQL API.
*
*
* For AWS CloudFront, don't use this call. Instead, use your CloudFront distribution configuration. To disassociate
* a Web ACL, provide an empty web ACL ID in the CloudFront call UpdateDistribution
. For information,
* see
* UpdateDistribution.
*
*
* @param disassociateWebAclRequest
* @return A Java Future containing the result of the DisassociateWebACL operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.DisassociateWebACL
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture disassociateWebACL(DisassociateWebAclRequest disassociateWebAclRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, disassociateWebAclRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisassociateWebACL");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DisassociateWebAclResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DisassociateWebACL")
.withMarshaller(new DisassociateWebAclRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(disassociateWebAclRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = disassociateWebAclRequest.overrideConfiguration()
.orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Retrieves the specified IPSet.
*
*
* @param getIpSetRequest
* @return A Java Future containing the result of the GetIPSet operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.GetIPSet
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getIPSet(GetIpSetRequest getIpSetRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getIpSetRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetIPSet");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetIpSetResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("GetIPSet")
.withMarshaller(new GetIpSetRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector)
.withInput(getIpSetRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = getIpSetRequest.overrideConfiguration().orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Returns the LoggingConfiguration for the specified web ACL.
*
*
* @param getLoggingConfigurationRequest
* @return A Java Future containing the result of the GetLoggingConfiguration operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.GetLoggingConfiguration
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture getLoggingConfiguration(
GetLoggingConfigurationRequest getLoggingConfigurationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getLoggingConfigurationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetLoggingConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetLoggingConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetLoggingConfiguration")
.withMarshaller(new GetLoggingConfigurationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getLoggingConfigurationRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = getLoggingConfigurationRequest.overrideConfiguration()
.orElse(null);
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);
}
}
/**
*
* Returns the IAM policy that is attached to the specified rule group.
*
*
* You must be the owner of the rule group to perform this operation.
*
*
* @param getPermissionPolicyRequest
* @return A Java Future containing the result of the GetPermissionPolicy operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.GetPermissionPolicy
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getPermissionPolicy(
GetPermissionPolicyRequest getPermissionPolicyRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getPermissionPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetPermissionPolicy");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetPermissionPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetPermissionPolicy")
.withMarshaller(new GetPermissionPolicyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getPermissionPolicyRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = getPermissionPolicyRequest.overrideConfiguration().orElse(
null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Retrieves the keys that are currently blocked by a rate-based rule. The maximum number of managed keys that can
* be blocked for a single rate-based rule is 10,000. If more than 10,000 addresses exceed the rate limit, those
* with the highest rates are blocked.
*
*
* @param getRateBasedStatementManagedKeysRequest
* @return A Java Future containing the result of the GetRateBasedStatementManagedKeys operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.GetRateBasedStatementManagedKeys
* @see AWS API Documentation
*/
@Override
public CompletableFuture getRateBasedStatementManagedKeys(
GetRateBasedStatementManagedKeysRequest getRateBasedStatementManagedKeysRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
getRateBasedStatementManagedKeysRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetRateBasedStatementManagedKeys");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, GetRateBasedStatementManagedKeysResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetRateBasedStatementManagedKeys")
.withMarshaller(new GetRateBasedStatementManagedKeysRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getRateBasedStatementManagedKeysRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = getRateBasedStatementManagedKeysRequest
.overrideConfiguration().orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Retrieves the specified RegexPatternSet.
*
*
* @param getRegexPatternSetRequest
* @return A Java Future containing the result of the GetRegexPatternSet operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.GetRegexPatternSet
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getRegexPatternSet(GetRegexPatternSetRequest getRegexPatternSetRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getRegexPatternSetRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetRegexPatternSet");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetRegexPatternSetResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetRegexPatternSet")
.withMarshaller(new GetRegexPatternSetRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getRegexPatternSetRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = getRegexPatternSetRequest.overrideConfiguration()
.orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Retrieves the specified RuleGroup.
*
*
* @param getRuleGroupRequest
* @return A Java Future containing the result of the GetRuleGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.GetRuleGroup
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getRuleGroup(GetRuleGroupRequest getRuleGroupRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getRuleGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetRuleGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetRuleGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetRuleGroup").withMarshaller(new GetRuleGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getRuleGroupRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = getRuleGroupRequest.overrideConfiguration().orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Gets detailed information about a specified number of requests--a sample--that AWS WAF randomly selects from
* among the first 5,000 requests that your AWS resource received during a time range that you choose. You can
* specify a sample size of up to 500 requests, and you can specify any time range in the previous three hours.
*
*
* GetSampledRequests
returns a time range, which is usually the time range that you specified.
* However, if your resource (such as a CloudFront distribution) received 5,000 requests before the specified time
* range elapsed, GetSampledRequests
returns an updated time range. This new time range indicates the
* actual period during which AWS WAF selected the requests in the sample.
*
*
* @param getSampledRequestsRequest
* @return A Java Future containing the result of the GetSampledRequests operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.GetSampledRequests
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getSampledRequests(GetSampledRequestsRequest getSampledRequestsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getSampledRequestsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetSampledRequests");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetSampledRequestsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetSampledRequests")
.withMarshaller(new GetSampledRequestsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getSampledRequestsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = getSampledRequestsRequest.overrideConfiguration()
.orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Retrieves the specified WebACL.
*
*
* @param getWebAclRequest
* @return A Java Future containing the result of the GetWebACL operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.GetWebACL
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getWebACL(GetWebAclRequest getWebAclRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getWebAclRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetWebACL");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetWebAclResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("GetWebACL")
.withMarshaller(new GetWebAclRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector)
.withInput(getWebAclRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = getWebAclRequest.overrideConfiguration().orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Retrieves the WebACL for the specified resource.
*
*
* @param getWebAclForResourceRequest
* @return A Java Future containing the result of the GetWebACLForResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafUnavailableEntityException AWS WAF couldn’t retrieve the resource that you requested. Retry your
* request.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.GetWebACLForResource
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getWebACLForResource(
GetWebAclForResourceRequest getWebAclForResourceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getWebAclForResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetWebACLForResource");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetWebAclForResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetWebACLForResource")
.withMarshaller(new GetWebAclForResourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getWebAclForResourceRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = getWebAclForResourceRequest.overrideConfiguration().orElse(
null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Retrieves an array of managed rule groups that are available for you to use. This list includes all AWS Managed
* Rules rule groups and the AWS Marketplace managed rule groups that you're subscribed to.
*
*
* @param listAvailableManagedRuleGroupsRequest
* @return A Java Future containing the result of the ListAvailableManagedRuleGroups operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.ListAvailableManagedRuleGroups
* @see AWS API Documentation
*/
@Override
public CompletableFuture listAvailableManagedRuleGroups(
ListAvailableManagedRuleGroupsRequest listAvailableManagedRuleGroupsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
listAvailableManagedRuleGroupsRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListAvailableManagedRuleGroups");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListAvailableManagedRuleGroupsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListAvailableManagedRuleGroups")
.withMarshaller(new ListAvailableManagedRuleGroupsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listAvailableManagedRuleGroupsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = listAvailableManagedRuleGroupsRequest.overrideConfiguration()
.orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Retrieves an array of IPSetSummary objects for the IP sets that you manage.
*
*
* @param listIpSetsRequest
* @return A Java Future containing the result of the ListIPSets operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.ListIPSets
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture listIPSets(ListIpSetsRequest listIpSetsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listIpSetsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListIPSets");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListIpSetsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams().withOperationName("ListIPSets")
.withMarshaller(new ListIpSetsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listIpSetsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = listIpSetsRequest.overrideConfiguration().orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Retrieves an array of your LoggingConfiguration objects.
*
*
* @param listLoggingConfigurationsRequest
* @return A Java Future containing the result of the ListLoggingConfigurations operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.ListLoggingConfigurations
* @see AWS API Documentation
*/
@Override
public CompletableFuture listLoggingConfigurations(
ListLoggingConfigurationsRequest listLoggingConfigurationsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listLoggingConfigurationsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListLoggingConfigurations");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListLoggingConfigurationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListLoggingConfigurations")
.withMarshaller(new ListLoggingConfigurationsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listLoggingConfigurationsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = listLoggingConfigurationsRequest.overrideConfiguration()
.orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Retrieves an array of RegexPatternSetSummary objects for the regex pattern sets that you manage.
*
*
* @param listRegexPatternSetsRequest
* @return A Java Future containing the result of the ListRegexPatternSets operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.ListRegexPatternSets
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture listRegexPatternSets(
ListRegexPatternSetsRequest listRegexPatternSetsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listRegexPatternSetsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListRegexPatternSets");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListRegexPatternSetsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListRegexPatternSets")
.withMarshaller(new ListRegexPatternSetsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listRegexPatternSetsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = listRegexPatternSetsRequest.overrideConfiguration().orElse(
null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Retrieves an array of the Amazon Resource Names (ARNs) for the regional resources that are associated with the
* specified web ACL. If you want the list of AWS CloudFront resources, use the AWS CloudFront call
* ListDistributionsByWebACLId
.
*
*
* @param listResourcesForWebAclRequest
* @return A Java Future containing the result of the ListResourcesForWebACL operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.ListResourcesForWebACL
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture listResourcesForWebACL(
ListResourcesForWebAclRequest listResourcesForWebAclRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listResourcesForWebAclRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListResourcesForWebACL");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListResourcesForWebAclResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListResourcesForWebACL")
.withMarshaller(new ListResourcesForWebAclRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listResourcesForWebAclRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = listResourcesForWebAclRequest.overrideConfiguration().orElse(
null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Retrieves an array of RuleGroupSummary objects for the rule groups that you manage.
*
*
* @param listRuleGroupsRequest
* @return A Java Future containing the result of the ListRuleGroups operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.ListRuleGroups
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture listRuleGroups(ListRuleGroupsRequest listRuleGroupsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listRuleGroupsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListRuleGroups");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListRuleGroupsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListRuleGroups")
.withMarshaller(new ListRuleGroupsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listRuleGroupsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = listRuleGroupsRequest.overrideConfiguration().orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Retrieves the TagInfoForResource for the specified resource. Tags are key:value pairs that you can use to
* categorize and manage your resources, for purposes like billing. For example, you might set the tag key to
* "customer" and the value to the customer name or ID. You can specify one or more tags to add to each AWS
* resource, up to 50 tags for a resource.
*
*
* You can tag the AWS resources that you manage through AWS WAF: web ACLs, rule groups, IP sets, and regex pattern
* sets. You can't manage or view tags through the AWS WAF console.
*
*
* @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.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafTagOperationException An error occurred during the tagging operation. Retry your request.
* - WafTagOperationInternalErrorException AWS WAF couldn’t perform your tagging operation because of an
* internal error. Retry your request.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.ListTagsForResource
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture listTagsForResource(
ListTagsForResourceRequest listTagsForResourceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
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")
.withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listTagsForResourceRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = listTagsForResourceRequest.overrideConfiguration().orElse(
null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Retrieves an array of WebACLSummary objects for the web ACLs that you manage.
*
*
* @param listWebAcLsRequest
* @return A Java Future containing the result of the ListWebACLs operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.ListWebACLs
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture listWebACLs(ListWebAcLsRequest listWebAcLsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listWebAcLsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListWebACLs");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListWebAcLsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListWebACLs").withMarshaller(new ListWebAcLsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listWebAcLsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = listWebAcLsRequest.overrideConfiguration().orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Enables the specified LoggingConfiguration, to start logging from a web ACL, according to the
* configuration provided.
*
*
* You can access information about all traffic that AWS WAF inspects using the following steps:
*
*
* -
*
* Create an Amazon Kinesis Data Firehose.
*
*
* Create the data firehose with a PUT source and in the Region that you are operating. If you are capturing logs
* for Amazon CloudFront, always create the firehose in US East (N. Virginia).
*
*
* Give the data firehose a name that starts with the prefix aws-waf-logs-
. For example,
* aws-waf-logs-us-east-2-analytics
.
*
*
*
* Do not create the data firehose using a Kinesis stream
as your source.
*
*
* -
*
* Associate that firehose to your web ACL using a PutLoggingConfiguration
request.
*
*
*
*
* When you successfully enable logging using a PutLoggingConfiguration
request, AWS WAF will create a
* service linked role with the necessary permissions to write logs to the Amazon Kinesis Data Firehose. For more
* information, see Logging Web ACL
* Traffic Information in the AWS WAF Developer Guide.
*
*
* @param putLoggingConfigurationRequest
* @return A Java Future containing the result of the PutLoggingConfiguration operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafOptimisticLockException AWS WAF couldn’t save your changes because you tried to update or delete a
* resource that has changed since you last retrieved it. Get the resource again, make any changes you need
* to make to the new copy, and retry your operation.
* - WafServiceLinkedRoleErrorException AWS WAF is not able to access the service linked role. This can be
* caused by a previous
PutLoggingConfiguration
request, which can lock the service linked role
* for about 20 seconds. Please try your request again. The service linked role can also be locked by a
* previous DeleteServiceLinkedRole
request, which can lock the role for 15 minutes or more. If
* you recently made a call to DeleteServiceLinkedRole
, wait at least 15 minutes and try the
* request again. If you receive this same exception again, you will have to wait additional time until the
* role is unlocked.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafInvalidOperationException The operation isn't valid.
* - WafLimitsExceededException AWS WAF couldn’t perform the operation because you exceeded your resource
* limit. For example, the maximum number of
WebACL
objects that you can create for an AWS
* account. For more information, see Limits in the AWS WAF
* Developer Guide.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.PutLoggingConfiguration
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture putLoggingConfiguration(
PutLoggingConfigurationRequest putLoggingConfigurationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, putLoggingConfigurationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutLoggingConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, PutLoggingConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("PutLoggingConfiguration")
.withMarshaller(new PutLoggingConfigurationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(putLoggingConfigurationRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = putLoggingConfigurationRequest.overrideConfiguration()
.orElse(null);
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);
}
}
/**
*
* Attaches an IAM policy to the specified resource. Use this to share a rule group across accounts.
*
*
* You must be the owner of the rule group to perform this operation.
*
*
* This action is subject to the following restrictions:
*
*
* -
*
* You can attach only one policy with each PutPermissionPolicy
request.
*
*
* -
*
* The ARN in the request must be a valid WAF RuleGroup ARN and the rule group must exist in the same region.
*
*
* -
*
* The user making the request must be the owner of the rule group.
*
*
*
*
* @param putPermissionPolicyRequest
* @return A Java Future containing the result of the PutPermissionPolicy operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafInvalidPermissionPolicyException The operation failed because the specified policy isn't in the
* proper format.
*
* The policy specifications must conform to the following:
*
*
* -
*
* The policy must be composed using IAM Policy version 2012-10-17 or version 2015-01-01.
*
*
* -
*
* The policy must include specifications for Effect
, Action
, and
* Principal
.
*
*
* -
*
* Effect
must specify Allow
.
*
*
* -
*
* Action
must specify wafv2:CreateWebACL
, wafv2:UpdateWebACL
, and
* wafv2:PutFirewallManagerRuleGroups
. AWS WAF rejects any extra actions or wildcard actions in
* the policy.
*
*
* -
*
* The policy must not include a Resource
parameter.
*
*
*
*
* For more information, see IAM Policies.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.PutPermissionPolicy
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture putPermissionPolicy(
PutPermissionPolicyRequest putPermissionPolicyRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, putPermissionPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutPermissionPolicy");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, PutPermissionPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("PutPermissionPolicy")
.withMarshaller(new PutPermissionPolicyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(putPermissionPolicyRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = putPermissionPolicyRequest.overrideConfiguration().orElse(
null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Associates tags with the specified AWS resource. Tags are key:value pairs that you can use to categorize and
* manage your resources, for purposes like billing. For example, you might set the tag key to "customer" and the
* value to the customer name or ID. You can specify one or more tags to add to each AWS resource, up to 50 tags for
* a resource.
*
*
* You can tag the AWS resources that you manage through AWS WAF: web ACLs, rule groups, IP sets, and regex pattern
* sets. You can't manage or view tags through the AWS WAF console.
*
*
* @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.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a WebACL
with a DefaultAction
that isn't among the types
* available at DefaultAction.
*
*
* -
*
* Your request references an ARN that is malformed, or corresponds to a resource with which a Web ACL
* cannot be associated.
*
*
* - WafLimitsExceededException AWS WAF couldn’t perform the operation because you exceeded your resource
* limit. For example, the maximum number of
WebACL
objects that you can create for an AWS
* account. For more information, see Limits in the AWS WAF
* Developer Guide.
* - WafNonexistentItemException AWS WAF couldn’t perform the operation because your resource doesn’t
* exist.
* - WafTagOperationException An error occurred during the tagging operation. Retry your request.
* - WafTagOperationInternalErrorException AWS WAF couldn’t perform your tagging operation because of an
* internal error. Retry your request.
* - WafInvalidOperationException The operation isn't valid.
* - 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.
* - Wafv2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Wafv2AsyncClient.TagResource
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture tagResource(TagResourceRequest tagResourceRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "WAFV2");
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").withMarshaller(new TagResourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(tagResourceRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = tagResourceRequest.overrideConfiguration().orElse(null);
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);
}
}
/**
*
*
* This is the latest version of AWS WAF, named AWS WAFV2, released in November, 2019. For information,
* including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.
*
*
*
* Disassociates tags from an AWS resource. Tags are key:value pairs that you can associate with AWS resources. For
* example, the tag key might be "customer" and the tag value might be "companyA." You can specify one or more tags
* to add to each container. You can add up to 50 tags to each AWS resource.
*
*
* @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.
*
* - WafInternalErrorException Your request is valid, but AWS WAF couldn’t perform the operation because
* of a system problem. Retry your request.
* - WafInvalidParameterException The operation failed because AWS WAF didn't recognize a parameter in the
* request. For example:
*
* -
*
* You specified an invalid parameter name or value.
*
*
* -
*
* Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.
*
*
* -
*
* You tried to update a