
software.amazon.awssdk.services.elasticsearch.model.UpgradeStepItem Maven / Gradle / Ivy
/*
* Copyright 2014-2019 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.elasticsearch.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.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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents a single step of the Upgrade or Upgrade Eligibility Check workflow.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class UpgradeStepItem implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField UPGRADE_STEP_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(UpgradeStepItem::upgradeStepAsString)).setter(setter(Builder::upgradeStep))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpgradeStep").build()).build();
private static final SdkField UPGRADE_STEP_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(UpgradeStepItem::upgradeStepStatusAsString)).setter(setter(Builder::upgradeStepStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpgradeStepStatus").build()).build();
private static final SdkField> ISSUES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(UpgradeStepItem::issues))
.setter(setter(Builder::issues))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Issues").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField PROGRESS_PERCENT_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.getter(getter(UpgradeStepItem::progressPercent)).setter(setter(Builder::progressPercent))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProgressPercent").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(UPGRADE_STEP_FIELD,
UPGRADE_STEP_STATUS_FIELD, ISSUES_FIELD, PROGRESS_PERCENT_FIELD));
private static final long serialVersionUID = 1L;
private final String upgradeStep;
private final String upgradeStepStatus;
private final List issues;
private final Double progressPercent;
private UpgradeStepItem(BuilderImpl builder) {
this.upgradeStep = builder.upgradeStep;
this.upgradeStepStatus = builder.upgradeStepStatus;
this.issues = builder.issues;
this.progressPercent = builder.progressPercent;
}
/**
*
* Represents one of 3 steps that an Upgrade or Upgrade Eligibility Check does through:
*
* - PreUpgradeCheck
* - Snapshot
* - Upgrade
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #upgradeStep} will
* return {@link UpgradeStep#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #upgradeStepAsString}.
*
*
* @return Represents one of 3 steps that an Upgrade or Upgrade Eligibility Check does through:
*
* - PreUpgradeCheck
* - Snapshot
* - Upgrade
*
* @see UpgradeStep
*/
public UpgradeStep upgradeStep() {
return UpgradeStep.fromValue(upgradeStep);
}
/**
*
* Represents one of 3 steps that an Upgrade or Upgrade Eligibility Check does through:
*
* - PreUpgradeCheck
* - Snapshot
* - Upgrade
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #upgradeStep} will
* return {@link UpgradeStep#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #upgradeStepAsString}.
*
*
* @return Represents one of 3 steps that an Upgrade or Upgrade Eligibility Check does through:
*
* - PreUpgradeCheck
* - Snapshot
* - Upgrade
*
* @see UpgradeStep
*/
public String upgradeStepAsString() {
return upgradeStep;
}
/**
*
* The status of a particular step during an upgrade. The status can take one of the following values:
*
* - In Progress
* - Succeeded
* - Succeeded with Issues
* - Failed
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #upgradeStepStatus}
* will return {@link UpgradeStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #upgradeStepStatusAsString}.
*
*
* @return The status of a particular step during an upgrade. The status can take one of the following values:
*
* - In Progress
* - Succeeded
* - Succeeded with Issues
* - Failed
*
* @see UpgradeStatus
*/
public UpgradeStatus upgradeStepStatus() {
return UpgradeStatus.fromValue(upgradeStepStatus);
}
/**
*
* The status of a particular step during an upgrade. The status can take one of the following values:
*
* - In Progress
* - Succeeded
* - Succeeded with Issues
* - Failed
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #upgradeStepStatus}
* will return {@link UpgradeStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #upgradeStepStatusAsString}.
*
*
* @return The status of a particular step during an upgrade. The status can take one of the following values:
*
* - In Progress
* - Succeeded
* - Succeeded with Issues
* - Failed
*
* @see UpgradeStatus
*/
public String upgradeStepStatusAsString() {
return upgradeStepStatus;
}
/**
*
* A list of strings containing detailed information about the errors encountered in a particular step.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return A list of strings containing detailed information about the errors encountered in a particular step.
*/
public List issues() {
return issues;
}
/**
*
* The Floating point value representing progress percentage of a particular step.
*
*
* @return The Floating point value representing progress percentage of a particular step.
*/
public Double progressPercent() {
return progressPercent;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(upgradeStepAsString());
hashCode = 31 * hashCode + Objects.hashCode(upgradeStepStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(issues());
hashCode = 31 * hashCode + Objects.hashCode(progressPercent());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof UpgradeStepItem)) {
return false;
}
UpgradeStepItem other = (UpgradeStepItem) obj;
return Objects.equals(upgradeStepAsString(), other.upgradeStepAsString())
&& Objects.equals(upgradeStepStatusAsString(), other.upgradeStepStatusAsString())
&& Objects.equals(issues(), other.issues()) && Objects.equals(progressPercent(), other.progressPercent());
}
/**
* 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 String toString() {
return ToString.builder("UpgradeStepItem").add("UpgradeStep", upgradeStepAsString())
.add("UpgradeStepStatus", upgradeStepStatusAsString()).add("Issues", issues())
.add("ProgressPercent", progressPercent()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "UpgradeStep":
return Optional.ofNullable(clazz.cast(upgradeStepAsString()));
case "UpgradeStepStatus":
return Optional.ofNullable(clazz.cast(upgradeStepStatusAsString()));
case "Issues":
return Optional.ofNullable(clazz.cast(issues()));
case "ProgressPercent":
return Optional.ofNullable(clazz.cast(progressPercent()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function