
software.amazon.awssdk.services.macie2.model.GetResourceProfileResponse 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.time.Instant;
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.Consumer;
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.core.traits.TimestampFormatTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class GetResourceProfileResponse extends Macie2Response implements
ToCopyableBuilder {
private static final SdkField PROFILE_UPDATED_AT_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("profileUpdatedAt")
.getter(getter(GetResourceProfileResponse::profileUpdatedAt))
.setter(setter(Builder::profileUpdatedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("profileUpdatedAt").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField SENSITIVITY_SCORE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("sensitivityScore").getter(getter(GetResourceProfileResponse::sensitivityScore))
.setter(setter(Builder::sensitivityScore))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("sensitivityScore").build()).build();
private static final SdkField SENSITIVITY_SCORE_OVERRIDDEN_FIELD = SdkField
. builder(MarshallingType.BOOLEAN)
.memberName("sensitivityScoreOverridden")
.getter(getter(GetResourceProfileResponse::sensitivityScoreOverridden))
.setter(setter(Builder::sensitivityScoreOverridden))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("sensitivityScoreOverridden").build())
.build();
private static final SdkField STATISTICS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("statistics")
.getter(getter(GetResourceProfileResponse::statistics)).setter(setter(Builder::statistics))
.constructor(ResourceStatistics::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("statistics").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PROFILE_UPDATED_AT_FIELD,
SENSITIVITY_SCORE_FIELD, SENSITIVITY_SCORE_OVERRIDDEN_FIELD, STATISTICS_FIELD));
private final Instant profileUpdatedAt;
private final Integer sensitivityScore;
private final Boolean sensitivityScoreOverridden;
private final ResourceStatistics statistics;
private GetResourceProfileResponse(BuilderImpl builder) {
super(builder);
this.profileUpdatedAt = builder.profileUpdatedAt;
this.sensitivityScore = builder.sensitivityScore;
this.sensitivityScoreOverridden = builder.sensitivityScoreOverridden;
this.statistics = builder.statistics;
}
/**
*
* The date and time, in UTC and extended ISO 8601 format, when Amazon Macie most recently recalculated sensitive
* data discovery statistics and details for the bucket. If the bucket's sensitivity score is calculated
* automatically, this includes the score.
*
*
* @return The date and time, in UTC and extended ISO 8601 format, when Amazon Macie most recently recalculated
* sensitive data discovery statistics and details for the bucket. If the bucket's sensitivity score is
* calculated automatically, this includes the score.
*/
public final Instant profileUpdatedAt() {
return profileUpdatedAt;
}
/**
*
* The current sensitivity score for the bucket, ranging from -1 (no analysis due to an error) to 100 (sensitive).
* By default, this score is calculated automatically based on the amount of data that Amazon Macie has analyzed in
* the bucket and the amount of sensitive data that Macie has found in the bucket.
*
*
* @return The current sensitivity score for the bucket, ranging from -1 (no analysis due to an error) to 100
* (sensitive). By default, this score is calculated automatically based on the amount of data that Amazon
* Macie has analyzed in the bucket and the amount of sensitive data that Macie has found in the bucket.
*/
public final Integer sensitivityScore() {
return sensitivityScore;
}
/**
*
* Specifies whether the bucket's current sensitivity score was set manually. If this value is true, the score was
* manually changed to 100. If this value is false, the score was calculated automatically by Amazon Macie.
*
*
* @return Specifies whether the bucket's current sensitivity score was set manually. If this value is true, the
* score was manually changed to 100. If this value is false, the score was calculated automatically by
* Amazon Macie.
*/
public final Boolean sensitivityScoreOverridden() {
return sensitivityScoreOverridden;
}
/**
*
* The sensitive data discovery statistics for the bucket. The statistics capture the results of automated sensitive
* data discovery activities that Amazon Macie has performed for the bucket.
*
*
* @return The sensitive data discovery statistics for the bucket. The statistics capture the results of automated
* sensitive data discovery activities that Amazon Macie has performed for the bucket.
*/
public final ResourceStatistics statistics() {
return statistics;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(profileUpdatedAt());
hashCode = 31 * hashCode + Objects.hashCode(sensitivityScore());
hashCode = 31 * hashCode + Objects.hashCode(sensitivityScoreOverridden());
hashCode = 31 * hashCode + Objects.hashCode(statistics());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof GetResourceProfileResponse)) {
return false;
}
GetResourceProfileResponse other = (GetResourceProfileResponse) obj;
return Objects.equals(profileUpdatedAt(), other.profileUpdatedAt())
&& Objects.equals(sensitivityScore(), other.sensitivityScore())
&& Objects.equals(sensitivityScoreOverridden(), other.sensitivityScoreOverridden())
&& Objects.equals(statistics(), other.statistics());
}
/**
* 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("GetResourceProfileResponse").add("ProfileUpdatedAt", profileUpdatedAt())
.add("SensitivityScore", sensitivityScore()).add("SensitivityScoreOverridden", sensitivityScoreOverridden())
.add("Statistics", statistics()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "profileUpdatedAt":
return Optional.ofNullable(clazz.cast(profileUpdatedAt()));
case "sensitivityScore":
return Optional.ofNullable(clazz.cast(sensitivityScore()));
case "sensitivityScoreOverridden":
return Optional.ofNullable(clazz.cast(sensitivityScoreOverridden()));
case "statistics":
return Optional.ofNullable(clazz.cast(statistics()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function