software.amazon.awssdk.services.cloudformation.model.ResourceScanSummary Maven / Gradle / Ivy
Show all versions of cloudformation 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.cloudformation.model;
import java.io.Serializable;
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.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;
/**
*
* A summary of the resource scan. This is returned by the ListResourceScan
API action.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ResourceScanSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField RESOURCE_SCAN_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResourceScanId").getter(getter(ResourceScanSummary::resourceScanId))
.setter(setter(Builder::resourceScanId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceScanId").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(ResourceScanSummary::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField STATUS_REASON_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StatusReason").getter(getter(ResourceScanSummary::statusReason)).setter(setter(Builder::statusReason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StatusReason").build()).build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("StartTime").getter(getter(ResourceScanSummary::startTime)).setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartTime").build()).build();
private static final SdkField END_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("EndTime").getter(getter(ResourceScanSummary::endTime)).setter(setter(Builder::endTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndTime").build()).build();
private static final SdkField PERCENTAGE_COMPLETED_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.memberName("PercentageCompleted").getter(getter(ResourceScanSummary::percentageCompleted))
.setter(setter(Builder::percentageCompleted))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PercentageCompleted").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(RESOURCE_SCAN_ID_FIELD,
STATUS_FIELD, STATUS_REASON_FIELD, START_TIME_FIELD, END_TIME_FIELD, PERCENTAGE_COMPLETED_FIELD));
private static final long serialVersionUID = 1L;
private final String resourceScanId;
private final String status;
private final String statusReason;
private final Instant startTime;
private final Instant endTime;
private final Double percentageCompleted;
private ResourceScanSummary(BuilderImpl builder) {
this.resourceScanId = builder.resourceScanId;
this.status = builder.status;
this.statusReason = builder.statusReason;
this.startTime = builder.startTime;
this.endTime = builder.endTime;
this.percentageCompleted = builder.percentageCompleted;
}
/**
*
* The Amazon Resource Name (ARN) of the resource scan.
*
*
* @return The Amazon Resource Name (ARN) of the resource scan.
*/
public final String resourceScanId() {
return resourceScanId;
}
/**
*
* Status of the resource scan.
*
*
* - INPROGRESS
* -
*
* The resource scan is still in progress.
*
*
* - COMPLETE
* -
*
* The resource scan is complete.
*
*
* - EXPIRED
* -
*
* The resource scan has expired.
*
*
* - FAILED
* -
*
* The resource scan has failed.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ResourceScanStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return Status of the resource scan.
*
* - INPROGRESS
* -
*
* The resource scan is still in progress.
*
*
* - COMPLETE
* -
*
* The resource scan is complete.
*
*
* - EXPIRED
* -
*
* The resource scan has expired.
*
*
* - FAILED
* -
*
* The resource scan has failed.
*
*
* @see ResourceScanStatus
*/
public final ResourceScanStatus status() {
return ResourceScanStatus.fromValue(status);
}
/**
*
* Status of the resource scan.
*
*
* - INPROGRESS
* -
*
* The resource scan is still in progress.
*
*
* - COMPLETE
* -
*
* The resource scan is complete.
*
*
* - EXPIRED
* -
*
* The resource scan has expired.
*
*
* - FAILED
* -
*
* The resource scan has failed.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ResourceScanStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return Status of the resource scan.
*
* - INPROGRESS
* -
*
* The resource scan is still in progress.
*
*
* - COMPLETE
* -
*
* The resource scan is complete.
*
*
* - EXPIRED
* -
*
* The resource scan has expired.
*
*
* - FAILED
* -
*
* The resource scan has failed.
*
*
* @see ResourceScanStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The reason for the resource scan status, providing more information if a failure happened.
*
*
* @return The reason for the resource scan status, providing more information if a failure happened.
*/
public final String statusReason() {
return statusReason;
}
/**
*
* The time that the resource scan was started.
*
*
* @return The time that the resource scan was started.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* The time that the resource scan was finished.
*
*
* @return The time that the resource scan was finished.
*/
public final Instant endTime() {
return endTime;
}
/**
*
* The percentage of the resource scan that has been completed.
*
*
* @return The percentage of the resource scan that has been completed.
*/
public final Double percentageCompleted() {
return percentageCompleted;
}
@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(resourceScanId());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusReason());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
hashCode = 31 * hashCode + Objects.hashCode(percentageCompleted());
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 ResourceScanSummary)) {
return false;
}
ResourceScanSummary other = (ResourceScanSummary) obj;
return Objects.equals(resourceScanId(), other.resourceScanId())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(statusReason(), other.statusReason()) && Objects.equals(startTime(), other.startTime())
&& Objects.equals(endTime(), other.endTime())
&& Objects.equals(percentageCompleted(), other.percentageCompleted());
}
/**
* 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("ResourceScanSummary").add("ResourceScanId", resourceScanId()).add("Status", statusAsString())
.add("StatusReason", statusReason()).add("StartTime", startTime()).add("EndTime", endTime())
.add("PercentageCompleted", percentageCompleted()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ResourceScanId":
return Optional.ofNullable(clazz.cast(resourceScanId()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "StatusReason":
return Optional.ofNullable(clazz.cast(statusReason()));
case "StartTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "EndTime":
return Optional.ofNullable(clazz.cast(endTime()));
case "PercentageCompleted":
return Optional.ofNullable(clazz.cast(percentageCompleted()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function