All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.macie2.model.ClassificationResult 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.macie2.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;

/**
 * 

* Provides the details of a sensitive data finding, including the types, number of occurrences, and locations of the * sensitive data that was detected. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ClassificationResult implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ADDITIONAL_OCCURRENCES_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("additionalOccurrences").getter(getter(ClassificationResult::additionalOccurrences)) .setter(setter(Builder::additionalOccurrences)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("additionalOccurrences").build()) .build(); private static final SdkField CUSTOM_DATA_IDENTIFIERS_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("customDataIdentifiers") .getter(getter(ClassificationResult::customDataIdentifiers)).setter(setter(Builder::customDataIdentifiers)) .constructor(CustomDataIdentifiers::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("customDataIdentifiers").build()) .build(); private static final SdkField MIME_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("mimeType").getter(getter(ClassificationResult::mimeType)).setter(setter(Builder::mimeType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("mimeType").build()).build(); private static final SdkField> SENSITIVE_DATA_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("sensitiveData") .getter(getter(ClassificationResult::sensitiveData)) .setter(setter(Builder::sensitiveData)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("sensitiveData").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(SensitiveDataItem::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField SIZE_CLASSIFIED_FIELD = SdkField. builder(MarshallingType.LONG) .memberName("sizeClassified").getter(getter(ClassificationResult::sizeClassified)) .setter(setter(Builder::sizeClassified)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("sizeClassified").build()).build(); private static final SdkField STATUS_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("status") .getter(getter(ClassificationResult::status)).setter(setter(Builder::status)) .constructor(ClassificationResultStatus::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ADDITIONAL_OCCURRENCES_FIELD, CUSTOM_DATA_IDENTIFIERS_FIELD, MIME_TYPE_FIELD, SENSITIVE_DATA_FIELD, SIZE_CLASSIFIED_FIELD, STATUS_FIELD)); private static final long serialVersionUID = 1L; private final Boolean additionalOccurrences; private final CustomDataIdentifiers customDataIdentifiers; private final String mimeType; private final List sensitiveData; private final Long sizeClassified; private final ClassificationResultStatus status; private ClassificationResult(BuilderImpl builder) { this.additionalOccurrences = builder.additionalOccurrences; this.customDataIdentifiers = builder.customDataIdentifiers; this.mimeType = builder.mimeType; this.sensitiveData = builder.sensitiveData; this.sizeClassified = builder.sizeClassified; this.status = builder.status; } /** *

* Specifies whether Amazon Macie detected additional occurrences of sensitive data in the S3 object. A finding * includes location data for a maximum of 15 occurrences of sensitive data. *

*

* This value can help you determine whether to investigate additional occurrences of sensitive data in an object. * You can do this by referring to the corresponding sensitive data discovery result for the finding * (ClassificationDetails.detailedResultsLocation). *

* * @return Specifies whether Amazon Macie detected additional occurrences of sensitive data in the S3 object. A * finding includes location data for a maximum of 15 occurrences of sensitive data.

*

* This value can help you determine whether to investigate additional occurrences of sensitive data in an * object. You can do this by referring to the corresponding sensitive data discovery result for the finding * (ClassificationDetails.detailedResultsLocation). */ public final Boolean additionalOccurrences() { return additionalOccurrences; } /** *

* The custom data identifiers that detected the sensitive data and the number of occurrences of the data that they * detected. *

* * @return The custom data identifiers that detected the sensitive data and the number of occurrences of the data * that they detected. */ public final CustomDataIdentifiers customDataIdentifiers() { return customDataIdentifiers; } /** *

* The type of content, as a MIME type, that the finding applies to. For example, application/gzip, for a GNU Gzip * compressed archive file, or application/pdf, for an Adobe Portable Document Format file. *

* * @return The type of content, as a MIME type, that the finding applies to. For example, application/gzip, for a * GNU Gzip compressed archive file, or application/pdf, for an Adobe Portable Document Format file. */ public final String mimeType() { return mimeType; } /** * For responses, this returns true if the service returned a value for the SensitiveData 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 hasSensitiveData() { return sensitiveData != null && !(sensitiveData instanceof SdkAutoConstructList); } /** *

* The category, types, and number of occurrences of the sensitive data that produced the finding. *

*

* 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 #hasSensitiveData} method. *

* * @return The category, types, and number of occurrences of the sensitive data that produced the finding. */ public final List sensitiveData() { return sensitiveData; } /** *

* The total size, in bytes, of the data that the finding applies to. *

* * @return The total size, in bytes, of the data that the finding applies to. */ public final Long sizeClassified() { return sizeClassified; } /** *

* The status of the finding. *

* * @return The status of the finding. */ public final ClassificationResultStatus status() { return status; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(additionalOccurrences()); hashCode = 31 * hashCode + Objects.hashCode(customDataIdentifiers()); hashCode = 31 * hashCode + Objects.hashCode(mimeType()); hashCode = 31 * hashCode + Objects.hashCode(hasSensitiveData() ? sensitiveData() : null); hashCode = 31 * hashCode + Objects.hashCode(sizeClassified()); hashCode = 31 * hashCode + Objects.hashCode(status()); 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 ClassificationResult)) { return false; } ClassificationResult other = (ClassificationResult) obj; return Objects.equals(additionalOccurrences(), other.additionalOccurrences()) && Objects.equals(customDataIdentifiers(), other.customDataIdentifiers()) && Objects.equals(mimeType(), other.mimeType()) && hasSensitiveData() == other.hasSensitiveData() && Objects.equals(sensitiveData(), other.sensitiveData()) && Objects.equals(sizeClassified(), other.sizeClassified()) && Objects.equals(status(), other.status()); } /** * 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("ClassificationResult").add("AdditionalOccurrences", additionalOccurrences()) .add("CustomDataIdentifiers", customDataIdentifiers()).add("MimeType", mimeType()) .add("SensitiveData", hasSensitiveData() ? sensitiveData() : null).add("SizeClassified", sizeClassified()) .add("Status", status()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "additionalOccurrences": return Optional.ofNullable(clazz.cast(additionalOccurrences())); case "customDataIdentifiers": return Optional.ofNullable(clazz.cast(customDataIdentifiers())); case "mimeType": return Optional.ofNullable(clazz.cast(mimeType())); case "sensitiveData": return Optional.ofNullable(clazz.cast(sensitiveData())); case "sizeClassified": return Optional.ofNullable(clazz.cast(sizeClassified())); case "status": return Optional.ofNullable(clazz.cast(status())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ClassificationResult) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Specifies whether Amazon Macie detected additional occurrences of sensitive data in the S3 object. A finding * includes location data for a maximum of 15 occurrences of sensitive data. *

*

* This value can help you determine whether to investigate additional occurrences of sensitive data in an * object. You can do this by referring to the corresponding sensitive data discovery result for the finding * (ClassificationDetails.detailedResultsLocation). *

* * @param additionalOccurrences * Specifies whether Amazon Macie detected additional occurrences of sensitive data in the S3 object. A * finding includes location data for a maximum of 15 occurrences of sensitive data.

*

* This value can help you determine whether to investigate additional occurrences of sensitive data in * an object. You can do this by referring to the corresponding sensitive data discovery result for the * finding (ClassificationDetails.detailedResultsLocation). * @return Returns a reference to this object so that method calls can be chained together. */ Builder additionalOccurrences(Boolean additionalOccurrences); /** *

* The custom data identifiers that detected the sensitive data and the number of occurrences of the data that * they detected. *

* * @param customDataIdentifiers * The custom data identifiers that detected the sensitive data and the number of occurrences of the data * that they detected. * @return Returns a reference to this object so that method calls can be chained together. */ Builder customDataIdentifiers(CustomDataIdentifiers customDataIdentifiers); /** *

* The custom data identifiers that detected the sensitive data and the number of occurrences of the data that * they detected. *

* This is a convenience method that creates an instance of the {@link CustomDataIdentifiers.Builder} avoiding * the need to create one manually via {@link CustomDataIdentifiers#builder()}. * *

* When the {@link Consumer} completes, {@link CustomDataIdentifiers.Builder#build()} is called immediately and * its result is passed to {@link #customDataIdentifiers(CustomDataIdentifiers)}. * * @param customDataIdentifiers * a consumer that will call methods on {@link CustomDataIdentifiers.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #customDataIdentifiers(CustomDataIdentifiers) */ default Builder customDataIdentifiers(Consumer customDataIdentifiers) { return customDataIdentifiers(CustomDataIdentifiers.builder().applyMutation(customDataIdentifiers).build()); } /** *

* The type of content, as a MIME type, that the finding applies to. For example, application/gzip, for a GNU * Gzip compressed archive file, or application/pdf, for an Adobe Portable Document Format file. *

* * @param mimeType * The type of content, as a MIME type, that the finding applies to. For example, application/gzip, for a * GNU Gzip compressed archive file, or application/pdf, for an Adobe Portable Document Format file. * @return Returns a reference to this object so that method calls can be chained together. */ Builder mimeType(String mimeType); /** *

* The category, types, and number of occurrences of the sensitive data that produced the finding. *

* * @param sensitiveData * The category, types, and number of occurrences of the sensitive data that produced the finding. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sensitiveData(Collection sensitiveData); /** *

* The category, types, and number of occurrences of the sensitive data that produced the finding. *

* * @param sensitiveData * The category, types, and number of occurrences of the sensitive data that produced the finding. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sensitiveData(SensitiveDataItem... sensitiveData); /** *

* The category, types, and number of occurrences of the sensitive data that produced the finding. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.macie2.model.SensitiveDataItem.Builder} avoiding the need to create * one manually via {@link software.amazon.awssdk.services.macie2.model.SensitiveDataItem#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.macie2.model.SensitiveDataItem.Builder#build()} is called immediately * and its result is passed to {@link #sensitiveData(List)}. * * @param sensitiveData * a consumer that will call methods on * {@link software.amazon.awssdk.services.macie2.model.SensitiveDataItem.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #sensitiveData(java.util.Collection) */ Builder sensitiveData(Consumer... sensitiveData); /** *

* The total size, in bytes, of the data that the finding applies to. *

* * @param sizeClassified * The total size, in bytes, of the data that the finding applies to. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sizeClassified(Long sizeClassified); /** *

* The status of the finding. *

* * @param status * The status of the finding. * @return Returns a reference to this object so that method calls can be chained together. */ Builder status(ClassificationResultStatus status); /** *

* The status of the finding. *

* This is a convenience method that creates an instance of the {@link ClassificationResultStatus.Builder} * avoiding the need to create one manually via {@link ClassificationResultStatus#builder()}. * *

* When the {@link Consumer} completes, {@link ClassificationResultStatus.Builder#build()} is called immediately * and its result is passed to {@link #status(ClassificationResultStatus)}. * * @param status * a consumer that will call methods on {@link ClassificationResultStatus.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #status(ClassificationResultStatus) */ default Builder status(Consumer status) { return status(ClassificationResultStatus.builder().applyMutation(status).build()); } } static final class BuilderImpl implements Builder { private Boolean additionalOccurrences; private CustomDataIdentifiers customDataIdentifiers; private String mimeType; private List sensitiveData = DefaultSdkAutoConstructList.getInstance(); private Long sizeClassified; private ClassificationResultStatus status; private BuilderImpl() { } private BuilderImpl(ClassificationResult model) { additionalOccurrences(model.additionalOccurrences); customDataIdentifiers(model.customDataIdentifiers); mimeType(model.mimeType); sensitiveData(model.sensitiveData); sizeClassified(model.sizeClassified); status(model.status); } public final Boolean getAdditionalOccurrences() { return additionalOccurrences; } public final void setAdditionalOccurrences(Boolean additionalOccurrences) { this.additionalOccurrences = additionalOccurrences; } @Override public final Builder additionalOccurrences(Boolean additionalOccurrences) { this.additionalOccurrences = additionalOccurrences; return this; } public final CustomDataIdentifiers.Builder getCustomDataIdentifiers() { return customDataIdentifiers != null ? customDataIdentifiers.toBuilder() : null; } public final void setCustomDataIdentifiers(CustomDataIdentifiers.BuilderImpl customDataIdentifiers) { this.customDataIdentifiers = customDataIdentifiers != null ? customDataIdentifiers.build() : null; } @Override public final Builder customDataIdentifiers(CustomDataIdentifiers customDataIdentifiers) { this.customDataIdentifiers = customDataIdentifiers; return this; } public final String getMimeType() { return mimeType; } public final void setMimeType(String mimeType) { this.mimeType = mimeType; } @Override public final Builder mimeType(String mimeType) { this.mimeType = mimeType; return this; } public final List getSensitiveData() { List result = SensitiveDataCopier.copyToBuilder(this.sensitiveData); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setSensitiveData(Collection sensitiveData) { this.sensitiveData = SensitiveDataCopier.copyFromBuilder(sensitiveData); } @Override public final Builder sensitiveData(Collection sensitiveData) { this.sensitiveData = SensitiveDataCopier.copy(sensitiveData); return this; } @Override @SafeVarargs public final Builder sensitiveData(SensitiveDataItem... sensitiveData) { sensitiveData(Arrays.asList(sensitiveData)); return this; } @Override @SafeVarargs public final Builder sensitiveData(Consumer... sensitiveData) { sensitiveData(Stream.of(sensitiveData).map(c -> SensitiveDataItem.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final Long getSizeClassified() { return sizeClassified; } public final void setSizeClassified(Long sizeClassified) { this.sizeClassified = sizeClassified; } @Override public final Builder sizeClassified(Long sizeClassified) { this.sizeClassified = sizeClassified; return this; } public final ClassificationResultStatus.Builder getStatus() { return status != null ? status.toBuilder() : null; } public final void setStatus(ClassificationResultStatus.BuilderImpl status) { this.status = status != null ? status.build() : null; } @Override public final Builder status(ClassificationResultStatus status) { this.status = status; return this; } @Override public ClassificationResult build() { return new ClassificationResult(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy