software.amazon.awssdk.services.iot.model.AuditCheckDetails Maven / Gradle / Ivy
Show all versions of iot 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.iot.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;
/**
*
* Information about the audit check.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AuditCheckDetails implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField CHECK_RUN_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("checkRunStatus").getter(getter(AuditCheckDetails::checkRunStatusAsString))
.setter(setter(Builder::checkRunStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("checkRunStatus").build()).build();
private static final SdkField CHECK_COMPLIANT_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("checkCompliant").getter(getter(AuditCheckDetails::checkCompliant))
.setter(setter(Builder::checkCompliant))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("checkCompliant").build()).build();
private static final SdkField TOTAL_RESOURCES_COUNT_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("totalResourcesCount").getter(getter(AuditCheckDetails::totalResourcesCount))
.setter(setter(Builder::totalResourcesCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("totalResourcesCount").build())
.build();
private static final SdkField NON_COMPLIANT_RESOURCES_COUNT_FIELD = SdkField
. builder(MarshallingType.LONG)
.memberName("nonCompliantResourcesCount")
.getter(getter(AuditCheckDetails::nonCompliantResourcesCount))
.setter(setter(Builder::nonCompliantResourcesCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("nonCompliantResourcesCount").build())
.build();
private static final SdkField SUPPRESSED_NON_COMPLIANT_RESOURCES_COUNT_FIELD = SdkField
. builder(MarshallingType.LONG)
.memberName("suppressedNonCompliantResourcesCount")
.getter(getter(AuditCheckDetails::suppressedNonCompliantResourcesCount))
.setter(setter(Builder::suppressedNonCompliantResourcesCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("suppressedNonCompliantResourcesCount").build()).build();
private static final SdkField ERROR_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("errorCode").getter(getter(AuditCheckDetails::errorCode)).setter(setter(Builder::errorCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("errorCode").build()).build();
private static final SdkField MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("message")
.getter(getter(AuditCheckDetails::message)).setter(setter(Builder::message))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("message").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CHECK_RUN_STATUS_FIELD,
CHECK_COMPLIANT_FIELD, TOTAL_RESOURCES_COUNT_FIELD, NON_COMPLIANT_RESOURCES_COUNT_FIELD,
SUPPRESSED_NON_COMPLIANT_RESOURCES_COUNT_FIELD, ERROR_CODE_FIELD, MESSAGE_FIELD));
private static final long serialVersionUID = 1L;
private final String checkRunStatus;
private final Boolean checkCompliant;
private final Long totalResourcesCount;
private final Long nonCompliantResourcesCount;
private final Long suppressedNonCompliantResourcesCount;
private final String errorCode;
private final String message;
private AuditCheckDetails(BuilderImpl builder) {
this.checkRunStatus = builder.checkRunStatus;
this.checkCompliant = builder.checkCompliant;
this.totalResourcesCount = builder.totalResourcesCount;
this.nonCompliantResourcesCount = builder.nonCompliantResourcesCount;
this.suppressedNonCompliantResourcesCount = builder.suppressedNonCompliantResourcesCount;
this.errorCode = builder.errorCode;
this.message = builder.message;
}
/**
*
* The completion status of this check. One of "IN_PROGRESS", "WAITING_FOR_DATA_COLLECTION", "CANCELED",
* "COMPLETED_COMPLIANT", "COMPLETED_NON_COMPLIANT", or "FAILED".
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #checkRunStatus}
* will return {@link AuditCheckRunStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #checkRunStatusAsString}.
*
*
* @return The completion status of this check. One of "IN_PROGRESS", "WAITING_FOR_DATA_COLLECTION", "CANCELED",
* "COMPLETED_COMPLIANT", "COMPLETED_NON_COMPLIANT", or "FAILED".
* @see AuditCheckRunStatus
*/
public final AuditCheckRunStatus checkRunStatus() {
return AuditCheckRunStatus.fromValue(checkRunStatus);
}
/**
*
* The completion status of this check. One of "IN_PROGRESS", "WAITING_FOR_DATA_COLLECTION", "CANCELED",
* "COMPLETED_COMPLIANT", "COMPLETED_NON_COMPLIANT", or "FAILED".
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #checkRunStatus}
* will return {@link AuditCheckRunStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #checkRunStatusAsString}.
*
*
* @return The completion status of this check. One of "IN_PROGRESS", "WAITING_FOR_DATA_COLLECTION", "CANCELED",
* "COMPLETED_COMPLIANT", "COMPLETED_NON_COMPLIANT", or "FAILED".
* @see AuditCheckRunStatus
*/
public final String checkRunStatusAsString() {
return checkRunStatus;
}
/**
*
* True if the check is complete and found all resources compliant.
*
*
* @return True if the check is complete and found all resources compliant.
*/
public final Boolean checkCompliant() {
return checkCompliant;
}
/**
*
* The number of resources on which the check was performed.
*
*
* @return The number of resources on which the check was performed.
*/
public final Long totalResourcesCount() {
return totalResourcesCount;
}
/**
*
* The number of resources that were found noncompliant during the check.
*
*
* @return The number of resources that were found noncompliant during the check.
*/
public final Long nonCompliantResourcesCount() {
return nonCompliantResourcesCount;
}
/**
*
* Describes how many of the non-compliant resources created during the evaluation of an audit check were marked as
* suppressed.
*
*
* @return Describes how many of the non-compliant resources created during the evaluation of an audit check were
* marked as suppressed.
*/
public final Long suppressedNonCompliantResourcesCount() {
return suppressedNonCompliantResourcesCount;
}
/**
*
* The code of any error encountered when this check is performed during this audit. One of
* "INSUFFICIENT_PERMISSIONS" or "AUDIT_CHECK_DISABLED".
*
*
* @return The code of any error encountered when this check is performed during this audit. One of
* "INSUFFICIENT_PERMISSIONS" or "AUDIT_CHECK_DISABLED".
*/
public final String errorCode() {
return errorCode;
}
/**
*
* The message associated with any error encountered when this check is performed during this audit.
*
*
* @return The message associated with any error encountered when this check is performed during this audit.
*/
public final String message() {
return message;
}
@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(checkRunStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(checkCompliant());
hashCode = 31 * hashCode + Objects.hashCode(totalResourcesCount());
hashCode = 31 * hashCode + Objects.hashCode(nonCompliantResourcesCount());
hashCode = 31 * hashCode + Objects.hashCode(suppressedNonCompliantResourcesCount());
hashCode = 31 * hashCode + Objects.hashCode(errorCode());
hashCode = 31 * hashCode + Objects.hashCode(message());
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 AuditCheckDetails)) {
return false;
}
AuditCheckDetails other = (AuditCheckDetails) obj;
return Objects.equals(checkRunStatusAsString(), other.checkRunStatusAsString())
&& Objects.equals(checkCompliant(), other.checkCompliant())
&& Objects.equals(totalResourcesCount(), other.totalResourcesCount())
&& Objects.equals(nonCompliantResourcesCount(), other.nonCompliantResourcesCount())
&& Objects.equals(suppressedNonCompliantResourcesCount(), other.suppressedNonCompliantResourcesCount())
&& Objects.equals(errorCode(), other.errorCode()) && Objects.equals(message(), other.message());
}
/**
* 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("AuditCheckDetails").add("CheckRunStatus", checkRunStatusAsString())
.add("CheckCompliant", checkCompliant()).add("TotalResourcesCount", totalResourcesCount())
.add("NonCompliantResourcesCount", nonCompliantResourcesCount())
.add("SuppressedNonCompliantResourcesCount", suppressedNonCompliantResourcesCount())
.add("ErrorCode", errorCode()).add("Message", message()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "checkRunStatus":
return Optional.ofNullable(clazz.cast(checkRunStatusAsString()));
case "checkCompliant":
return Optional.ofNullable(clazz.cast(checkCompliant()));
case "totalResourcesCount":
return Optional.ofNullable(clazz.cast(totalResourcesCount()));
case "nonCompliantResourcesCount":
return Optional.ofNullable(clazz.cast(nonCompliantResourcesCount()));
case "suppressedNonCompliantResourcesCount":
return Optional.ofNullable(clazz.cast(suppressedNonCompliantResourcesCount()));
case "errorCode":
return Optional.ofNullable(clazz.cast(errorCode()));
case "message":
return Optional.ofNullable(clazz.cast(message()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function