
software.amazon.awssdk.services.wafv2.model.WebACLSummary 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.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
*
* 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.
*
*
*
* High-level information about a WebACL, returned by operations like create and list. This provides information
* like the ID, that you can use to retrieve and manage a WebACL
, and the ARN, that you provide to
* operations like AssociateWebACL.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class WebACLSummary implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(WebACLSummary::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(WebACLSummary::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(WebACLSummary::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField LOCK_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(WebACLSummary::lockToken)).setter(setter(Builder::lockToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LockToken").build()).build();
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(WebACLSummary::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ARN").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, ID_FIELD,
DESCRIPTION_FIELD, LOCK_TOKEN_FIELD, ARN_FIELD));
private static final long serialVersionUID = 1L;
private final String name;
private final String id;
private final String description;
private final String lockToken;
private final String arn;
private WebACLSummary(BuilderImpl builder) {
this.name = builder.name;
this.id = builder.id;
this.description = builder.description;
this.lockToken = builder.lockToken;
this.arn = builder.arn;
}
/**
*
* The name of the Web ACL. You cannot change the name of a Web ACL after you create it.
*
*
* @return The name of the Web ACL. You cannot change the name of a Web ACL after you create it.
*/
public String name() {
return name;
}
/**
*
* The unique identifier for the Web ACL. This ID is returned in the responses to create and list commands. You
* provide it to operations like update and delete.
*
*
* @return The unique identifier for the Web ACL. This ID is returned in the responses to create and list commands.
* You provide it to operations like update and delete.
*/
public String id() {
return id;
}
/**
*
* A description of the Web ACL that helps with identification. You cannot change the description of a Web ACL after
* you create it.
*
*
* @return A description of the Web ACL that helps with identification. You cannot change the description of a Web
* ACL after you create it.
*/
public String description() {
return description;
}
/**
*
* A token used for optimistic locking. AWS WAF returns a token to your get and list requests, to mark the state of
* the entity at the time of the request. To make changes to the entity associated with the token, you provide the
* token to operations like update and delete. AWS WAF uses the token to ensure that no changes have been made to
* the entity since you last retrieved it. If a change has been made, the update fails with a
* WAFOptimisticLockException
. If this happens, perform another get, and use the new token returned by
* that operation.
*
*
* @return A token used for optimistic locking. AWS WAF returns a token to your get and list requests, to mark the
* state of the entity at the time of the request. To make changes to the entity associated with the token,
* you provide the token to operations like update and delete. AWS WAF uses the token to ensure that no
* changes have been made to the entity since you last retrieved it. If a change has been made, the update
* fails with a WAFOptimisticLockException
. If this happens, perform another get, and use the
* new token returned by that operation.
*/
public String lockToken() {
return lockToken;
}
/**
*
* The Amazon Resource Name (ARN) of the entity.
*
*
* @return The Amazon Resource Name (ARN) of the entity.
*/
public String arn() {
return arn;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(id());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(lockToken());
hashCode = 31 * hashCode + Objects.hashCode(arn());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof WebACLSummary)) {
return false;
}
WebACLSummary other = (WebACLSummary) obj;
return Objects.equals(name(), other.name()) && Objects.equals(id(), other.id())
&& Objects.equals(description(), other.description()) && Objects.equals(lockToken(), other.lockToken())
&& Objects.equals(arn(), other.arn());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public String toString() {
return ToString.builder("WebACLSummary").add("Name", name()).add("Id", id()).add("Description", description())
.add("LockToken", lockToken()).add("ARN", arn()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "LockToken":
return Optional.ofNullable(clazz.cast(lockToken()));
case "ARN":
return Optional.ofNullable(clazz.cast(arn()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function