software.amazon.awssdk.services.elasticbeanstalk.model.InstanceHealthSummary Maven / Gradle / Ivy
Show all versions of elasticbeanstalk 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.elasticbeanstalk.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;
/**
*
* Represents summary information about the health of an instance. For more information, see Health Colors and
* Statuses.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class InstanceHealthSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField NO_DATA_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("NoData").getter(getter(InstanceHealthSummary::noData)).setter(setter(Builder::noData))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NoData").build()).build();
private static final SdkField UNKNOWN_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("Unknown").getter(getter(InstanceHealthSummary::unknown)).setter(setter(Builder::unknown))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Unknown").build()).build();
private static final SdkField PENDING_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("Pending").getter(getter(InstanceHealthSummary::pending)).setter(setter(Builder::pending))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Pending").build()).build();
private static final SdkField OK_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("Ok")
.getter(getter(InstanceHealthSummary::ok)).setter(setter(Builder::ok))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Ok").build()).build();
private static final SdkField INFO_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("Info")
.getter(getter(InstanceHealthSummary::info)).setter(setter(Builder::info))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Info").build()).build();
private static final SdkField WARNING_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("Warning").getter(getter(InstanceHealthSummary::warning)).setter(setter(Builder::warning))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Warning").build()).build();
private static final SdkField DEGRADED_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("Degraded").getter(getter(InstanceHealthSummary::degraded)).setter(setter(Builder::degraded))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Degraded").build()).build();
private static final SdkField SEVERE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("Severe").getter(getter(InstanceHealthSummary::severe)).setter(setter(Builder::severe))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Severe").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NO_DATA_FIELD, UNKNOWN_FIELD,
PENDING_FIELD, OK_FIELD, INFO_FIELD, WARNING_FIELD, DEGRADED_FIELD, SEVERE_FIELD));
private static final long serialVersionUID = 1L;
private final Integer noData;
private final Integer unknown;
private final Integer pending;
private final Integer ok;
private final Integer info;
private final Integer warning;
private final Integer degraded;
private final Integer severe;
private InstanceHealthSummary(BuilderImpl builder) {
this.noData = builder.noData;
this.unknown = builder.unknown;
this.pending = builder.pending;
this.ok = builder.ok;
this.info = builder.info;
this.warning = builder.warning;
this.degraded = builder.degraded;
this.severe = builder.severe;
}
/**
*
* Grey. AWS Elastic Beanstalk and the health agent are reporting no data on an instance.
*
*
* @return Grey. AWS Elastic Beanstalk and the health agent are reporting no data on an instance.
*/
public final Integer noData() {
return noData;
}
/**
*
* Grey. AWS Elastic Beanstalk and the health agent are reporting an insufficient amount of data on an
* instance.
*
*
* @return Grey. AWS Elastic Beanstalk and the health agent are reporting an insufficient amount of data on
* an instance.
*/
public final Integer unknown() {
return unknown;
}
/**
*
* Grey. An operation is in progress on an instance within the command timeout.
*
*
* @return Grey. An operation is in progress on an instance within the command timeout.
*/
public final Integer pending() {
return pending;
}
/**
*
* Green. An instance is passing health checks and the health agent is not reporting any problems.
*
*
* @return Green. An instance is passing health checks and the health agent is not reporting any problems.
*/
public final Integer ok() {
return ok;
}
/**
*
* Green. An operation is in progress on an instance.
*
*
* @return Green. An operation is in progress on an instance.
*/
public final Integer info() {
return info;
}
/**
*
* Yellow. The health agent is reporting a moderate number of request failures or other issues for an
* instance or environment.
*
*
* @return Yellow. The health agent is reporting a moderate number of request failures or other issues for an
* instance or environment.
*/
public final Integer warning() {
return warning;
}
/**
*
* Red. The health agent is reporting a high number of request failures or other issues for an instance or
* environment.
*
*
* @return Red. The health agent is reporting a high number of request failures or other issues for an
* instance or environment.
*/
public final Integer degraded() {
return degraded;
}
/**
*
* Red. The health agent is reporting a very high number of request failures or other issues for an instance
* or environment.
*
*
* @return Red. The health agent is reporting a very high number of request failures or other issues for an
* instance or environment.
*/
public final Integer severe() {
return severe;
}
@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(noData());
hashCode = 31 * hashCode + Objects.hashCode(unknown());
hashCode = 31 * hashCode + Objects.hashCode(pending());
hashCode = 31 * hashCode + Objects.hashCode(ok());
hashCode = 31 * hashCode + Objects.hashCode(info());
hashCode = 31 * hashCode + Objects.hashCode(warning());
hashCode = 31 * hashCode + Objects.hashCode(degraded());
hashCode = 31 * hashCode + Objects.hashCode(severe());
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 InstanceHealthSummary)) {
return false;
}
InstanceHealthSummary other = (InstanceHealthSummary) obj;
return Objects.equals(noData(), other.noData()) && Objects.equals(unknown(), other.unknown())
&& Objects.equals(pending(), other.pending()) && Objects.equals(ok(), other.ok())
&& Objects.equals(info(), other.info()) && Objects.equals(warning(), other.warning())
&& Objects.equals(degraded(), other.degraded()) && Objects.equals(severe(), other.severe());
}
/**
* 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("InstanceHealthSummary").add("NoData", noData()).add("Unknown", unknown())
.add("Pending", pending()).add("Ok", ok()).add("Info", info()).add("Warning", warning())
.add("Degraded", degraded()).add("Severe", severe()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "NoData":
return Optional.ofNullable(clazz.cast(noData()));
case "Unknown":
return Optional.ofNullable(clazz.cast(unknown()));
case "Pending":
return Optional.ofNullable(clazz.cast(pending()));
case "Ok":
return Optional.ofNullable(clazz.cast(ok()));
case "Info":
return Optional.ofNullable(clazz.cast(info()));
case "Warning":
return Optional.ofNullable(clazz.cast(warning()));
case "Degraded":
return Optional.ofNullable(clazz.cast(degraded()));
case "Severe":
return Optional.ofNullable(clazz.cast(severe()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function