
software.amazon.awssdk.services.databrew.model.EntityDetectorConfiguration Maven / Gradle / Ivy
Show all versions of databrew Show documentation
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.databrew.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Configuration of entity detection for a profile job. When undefined, entity detection is disabled.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class EntityDetectorConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField> ENTITY_TYPES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("EntityTypes")
.getter(getter(EntityDetectorConfiguration::entityTypes))
.setter(setter(Builder::entityTypes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EntityTypes").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> ALLOWED_STATISTICS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("AllowedStatistics")
.getter(getter(EntityDetectorConfiguration::allowedStatistics))
.setter(setter(Builder::allowedStatistics))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AllowedStatistics").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AllowedStatistics::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ENTITY_TYPES_FIELD,
ALLOWED_STATISTICS_FIELD));
private static final long serialVersionUID = 1L;
private final List entityTypes;
private final List allowedStatistics;
private EntityDetectorConfiguration(BuilderImpl builder) {
this.entityTypes = builder.entityTypes;
this.allowedStatistics = builder.allowedStatistics;
}
/**
* For responses, this returns true if the service returned a value for the EntityTypes property. This DOES NOT
* check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasEntityTypes() {
return entityTypes != null && !(entityTypes instanceof SdkAutoConstructList);
}
/**
*
* Entity types to detect. Can be any of the following:
*
*
* -
*
* USA_SSN
*
*
* -
*
* EMAIL
*
*
* -
*
* USA_ITIN
*
*
* -
*
* USA_PASSPORT_NUMBER
*
*
* -
*
* PHONE_NUMBER
*
*
* -
*
* USA_DRIVING_LICENSE
*
*
* -
*
* BANK_ACCOUNT
*
*
* -
*
* CREDIT_CARD
*
*
* -
*
* IP_ADDRESS
*
*
* -
*
* MAC_ADDRESS
*
*
* -
*
* USA_DEA_NUMBER
*
*
* -
*
* USA_HCPCS_CODE
*
*
* -
*
* USA_NATIONAL_PROVIDER_IDENTIFIER
*
*
* -
*
* USA_NATIONAL_DRUG_CODE
*
*
* -
*
* USA_HEALTH_INSURANCE_CLAIM_NUMBER
*
*
* -
*
* USA_MEDICARE_BENEFICIARY_IDENTIFIER
*
*
* -
*
* USA_CPT_CODE
*
*
* -
*
* PERSON_NAME
*
*
* -
*
* DATE
*
*
*
*
* The Entity type group USA_ALL is also supported, and includes all of the above entity types except PERSON_NAME
* and DATE.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasEntityTypes} method.
*
*
* @return Entity types to detect. Can be any of the following:
*
* -
*
* USA_SSN
*
*
* -
*
* EMAIL
*
*
* -
*
* USA_ITIN
*
*
* -
*
* USA_PASSPORT_NUMBER
*
*
* -
*
* PHONE_NUMBER
*
*
* -
*
* USA_DRIVING_LICENSE
*
*
* -
*
* BANK_ACCOUNT
*
*
* -
*
* CREDIT_CARD
*
*
* -
*
* IP_ADDRESS
*
*
* -
*
* MAC_ADDRESS
*
*
* -
*
* USA_DEA_NUMBER
*
*
* -
*
* USA_HCPCS_CODE
*
*
* -
*
* USA_NATIONAL_PROVIDER_IDENTIFIER
*
*
* -
*
* USA_NATIONAL_DRUG_CODE
*
*
* -
*
* USA_HEALTH_INSURANCE_CLAIM_NUMBER
*
*
* -
*
* USA_MEDICARE_BENEFICIARY_IDENTIFIER
*
*
* -
*
* USA_CPT_CODE
*
*
* -
*
* PERSON_NAME
*
*
* -
*
* DATE
*
*
*
*
* The Entity type group USA_ALL is also supported, and includes all of the above entity types except
* PERSON_NAME and DATE.
*/
public final List entityTypes() {
return entityTypes;
}
/**
* For responses, this returns true if the service returned a value for the AllowedStatistics property. This DOES
* NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasAllowedStatistics() {
return allowedStatistics != null && !(allowedStatistics instanceof SdkAutoConstructList);
}
/**
*
* Configuration of statistics that are allowed to be run on columns that contain detected entities. When undefined,
* no statistics will be computed on columns that contain detected entities.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasAllowedStatistics} method.
*
*
* @return Configuration of statistics that are allowed to be run on columns that contain detected entities. When
* undefined, no statistics will be computed on columns that contain detected entities.
*/
public final List allowedStatistics() {
return allowedStatistics;
}
@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 final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(hasEntityTypes() ? entityTypes() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasAllowedStatistics() ? allowedStatistics() : null);
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof EntityDetectorConfiguration)) {
return false;
}
EntityDetectorConfiguration other = (EntityDetectorConfiguration) obj;
return hasEntityTypes() == other.hasEntityTypes() && Objects.equals(entityTypes(), other.entityTypes())
&& hasAllowedStatistics() == other.hasAllowedStatistics()
&& Objects.equals(allowedStatistics(), other.allowedStatistics());
}
/**
* 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 final String toString() {
return ToString.builder("EntityDetectorConfiguration").add("EntityTypes", hasEntityTypes() ? entityTypes() : null)
.add("AllowedStatistics", hasAllowedStatistics() ? allowedStatistics() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "EntityTypes":
return Optional.ofNullable(clazz.cast(entityTypes()));
case "AllowedStatistics":
return Optional.ofNullable(clazz.cast(allowedStatistics()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* -
*
* USA_SSN
*
*
* -
*
* EMAIL
*
*
* -
*
* USA_ITIN
*
*
* -
*
* USA_PASSPORT_NUMBER
*
*
* -
*
* PHONE_NUMBER
*
*
* -
*
* USA_DRIVING_LICENSE
*
*
* -
*
* BANK_ACCOUNT
*
*
* -
*
* CREDIT_CARD
*
*
* -
*
* IP_ADDRESS
*
*
* -
*
* MAC_ADDRESS
*
*
* -
*
* USA_DEA_NUMBER
*
*
* -
*
* USA_HCPCS_CODE
*
*
* -
*
* USA_NATIONAL_PROVIDER_IDENTIFIER
*
*
* -
*
* USA_NATIONAL_DRUG_CODE
*
*
* -
*
* USA_HEALTH_INSURANCE_CLAIM_NUMBER
*
*
* -
*
* USA_MEDICARE_BENEFICIARY_IDENTIFIER
*
*
* -
*
* USA_CPT_CODE
*
*
* -
*
* PERSON_NAME
*
*
* -
*
* DATE
*
*
*
*
* The Entity type group USA_ALL is also supported, and includes all of the above entity types except
* PERSON_NAME and DATE.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder entityTypes(Collection entityTypes);
/**
*
* Entity types to detect. Can be any of the following:
*
*
* -
*
* USA_SSN
*
*
* -
*
* EMAIL
*
*
* -
*
* USA_ITIN
*
*
* -
*
* USA_PASSPORT_NUMBER
*
*
* -
*
* PHONE_NUMBER
*
*
* -
*
* USA_DRIVING_LICENSE
*
*
* -
*
* BANK_ACCOUNT
*
*
* -
*
* CREDIT_CARD
*
*
* -
*
* IP_ADDRESS
*
*
* -
*
* MAC_ADDRESS
*
*
* -
*
* USA_DEA_NUMBER
*
*
* -
*
* USA_HCPCS_CODE
*
*
* -
*
* USA_NATIONAL_PROVIDER_IDENTIFIER
*
*
* -
*
* USA_NATIONAL_DRUG_CODE
*
*
* -
*
* USA_HEALTH_INSURANCE_CLAIM_NUMBER
*
*
* -
*
* USA_MEDICARE_BENEFICIARY_IDENTIFIER
*
*
* -
*
* USA_CPT_CODE
*
*
* -
*
* PERSON_NAME
*
*
* -
*
* DATE
*
*
*
*
* The Entity type group USA_ALL is also supported, and includes all of the above entity types except
* PERSON_NAME and DATE.
*
*
* @param entityTypes
* Entity types to detect. Can be any of the following:
*
* -
*
* USA_SSN
*
*
* -
*
* EMAIL
*
*
* -
*
* USA_ITIN
*
*
* -
*
* USA_PASSPORT_NUMBER
*
*
* -
*
* PHONE_NUMBER
*
*
* -
*
* USA_DRIVING_LICENSE
*
*
* -
*
* BANK_ACCOUNT
*
*
* -
*
* CREDIT_CARD
*
*
* -
*
* IP_ADDRESS
*
*
* -
*
* MAC_ADDRESS
*
*
* -
*
* USA_DEA_NUMBER
*
*
* -
*
* USA_HCPCS_CODE
*
*
* -
*
* USA_NATIONAL_PROVIDER_IDENTIFIER
*
*
* -
*
* USA_NATIONAL_DRUG_CODE
*
*
* -
*
* USA_HEALTH_INSURANCE_CLAIM_NUMBER
*
*
* -
*
* USA_MEDICARE_BENEFICIARY_IDENTIFIER
*
*
* -
*
* USA_CPT_CODE
*
*
* -
*
* PERSON_NAME
*
*
* -
*
* DATE
*
*
*
*
* The Entity type group USA_ALL is also supported, and includes all of the above entity types except
* PERSON_NAME and DATE.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder entityTypes(String... entityTypes);
/**
*
* Configuration of statistics that are allowed to be run on columns that contain detected entities. When
* undefined, no statistics will be computed on columns that contain detected entities.
*
*
* @param allowedStatistics
* Configuration of statistics that are allowed to be run on columns that contain detected entities. When
* undefined, no statistics will be computed on columns that contain detected entities.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder allowedStatistics(Collection allowedStatistics);
/**
*
* Configuration of statistics that are allowed to be run on columns that contain detected entities. When
* undefined, no statistics will be computed on columns that contain detected entities.
*
*
* @param allowedStatistics
* Configuration of statistics that are allowed to be run on columns that contain detected entities. When
* undefined, no statistics will be computed on columns that contain detected entities.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder allowedStatistics(AllowedStatistics... allowedStatistics);
/**
*
* Configuration of statistics that are allowed to be run on columns that contain detected entities. When
* undefined, no statistics will be computed on columns that contain detected entities.
*
* This is a convenience method that creates an instance of the
* {@link software.amazon.awssdk.services.databrew.model.AllowedStatistics.Builder} avoiding the need to create
* one manually via {@link software.amazon.awssdk.services.databrew.model.AllowedStatistics#builder()}.
*
*
* When the {@link Consumer} completes,
* {@link software.amazon.awssdk.services.databrew.model.AllowedStatistics.Builder#build()} is called
* immediately and its result is passed to {@link #allowedStatistics(List)}.
*
* @param allowedStatistics
* a consumer that will call methods on
* {@link software.amazon.awssdk.services.databrew.model.AllowedStatistics.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #allowedStatistics(java.util.Collection)
*/
Builder allowedStatistics(Consumer... allowedStatistics);
}
static final class BuilderImpl implements Builder {
private List entityTypes = DefaultSdkAutoConstructList.getInstance();
private List allowedStatistics = DefaultSdkAutoConstructList.getInstance();
private BuilderImpl() {
}
private BuilderImpl(EntityDetectorConfiguration model) {
entityTypes(model.entityTypes);
allowedStatistics(model.allowedStatistics);
}
public final Collection getEntityTypes() {
if (entityTypes instanceof SdkAutoConstructList) {
return null;
}
return entityTypes;
}
public final void setEntityTypes(Collection entityTypes) {
this.entityTypes = EntityTypeListCopier.copy(entityTypes);
}
@Override
public final Builder entityTypes(Collection entityTypes) {
this.entityTypes = EntityTypeListCopier.copy(entityTypes);
return this;
}
@Override
@SafeVarargs
public final Builder entityTypes(String... entityTypes) {
entityTypes(Arrays.asList(entityTypes));
return this;
}
public final List getAllowedStatistics() {
List result = AllowedStatisticListCopier.copyToBuilder(this.allowedStatistics);
if (result instanceof SdkAutoConstructList) {
return null;
}
return result;
}
public final void setAllowedStatistics(Collection allowedStatistics) {
this.allowedStatistics = AllowedStatisticListCopier.copyFromBuilder(allowedStatistics);
}
@Override
public final Builder allowedStatistics(Collection allowedStatistics) {
this.allowedStatistics = AllowedStatisticListCopier.copy(allowedStatistics);
return this;
}
@Override
@SafeVarargs
public final Builder allowedStatistics(AllowedStatistics... allowedStatistics) {
allowedStatistics(Arrays.asList(allowedStatistics));
return this;
}
@Override
@SafeVarargs
public final Builder allowedStatistics(Consumer... allowedStatistics) {
allowedStatistics(Stream.of(allowedStatistics).map(c -> AllowedStatistics.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
@Override
public EntityDetectorConfiguration build() {
return new EntityDetectorConfiguration(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}