software.amazon.awssdk.services.opensearch.model.AutoTuneStatus 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.opensearch.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;
/**
*
* The current status of Auto-Tune for the domain. For more information, see Auto-Tune for Amazon
* OpenSearch Service.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AutoTuneStatus implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField CREATION_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationDate").getter(getter(AutoTuneStatus::creationDate)).setter(setter(Builder::creationDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationDate").build()).build();
private static final SdkField UPDATE_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("UpdateDate").getter(getter(AutoTuneStatus::updateDate)).setter(setter(Builder::updateDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpdateDate").build()).build();
private static final SdkField UPDATE_VERSION_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("UpdateVersion").getter(getter(AutoTuneStatus::updateVersion)).setter(setter(Builder::updateVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpdateVersion").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(AutoTuneStatus::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final SdkField ERROR_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ErrorMessage").getter(getter(AutoTuneStatus::errorMessage)).setter(setter(Builder::errorMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ErrorMessage").build()).build();
private static final SdkField PENDING_DELETION_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("PendingDeletion").getter(getter(AutoTuneStatus::pendingDeletion))
.setter(setter(Builder::pendingDeletion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PendingDeletion").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CREATION_DATE_FIELD,
UPDATE_DATE_FIELD, UPDATE_VERSION_FIELD, STATE_FIELD, ERROR_MESSAGE_FIELD, PENDING_DELETION_FIELD));
private static final long serialVersionUID = 1L;
private final Instant creationDate;
private final Instant updateDate;
private final Integer updateVersion;
private final String state;
private final String errorMessage;
private final Boolean pendingDeletion;
private AutoTuneStatus(BuilderImpl builder) {
this.creationDate = builder.creationDate;
this.updateDate = builder.updateDate;
this.updateVersion = builder.updateVersion;
this.state = builder.state;
this.errorMessage = builder.errorMessage;
this.pendingDeletion = builder.pendingDeletion;
}
/**
*
* Date and time when Auto-Tune was enabled for the domain.
*
*
* @return Date and time when Auto-Tune was enabled for the domain.
*/
public final Instant creationDate() {
return creationDate;
}
/**
*
* Date and time when the Auto-Tune options were last updated for the domain.
*
*
* @return Date and time when the Auto-Tune options were last updated for the domain.
*/
public final Instant updateDate() {
return updateDate;
}
/**
*
* The latest version of the Auto-Tune options.
*
*
* @return The latest version of the Auto-Tune options.
*/
public final Integer updateVersion() {
return updateVersion;
}
/**
*
* The current state of Auto-Tune on the domain.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link AutoTuneState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The current state of Auto-Tune on the domain.
* @see AutoTuneState
*/
public final AutoTuneState state() {
return AutoTuneState.fromValue(state);
}
/**
*
* The current state of Auto-Tune on the domain.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link AutoTuneState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The current state of Auto-Tune on the domain.
* @see AutoTuneState
*/
public final String stateAsString() {
return state;
}
/**
*
* Any errors that occurred while enabling or disabling Auto-Tune.
*
*
* @return Any errors that occurred while enabling or disabling Auto-Tune.
*/
public final String errorMessage() {
return errorMessage;
}
/**
*
* Indicates whether the domain is being deleted.
*
*
* @return Indicates whether the domain is being deleted.
*/
public final Boolean pendingDeletion() {
return pendingDeletion;
}
@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(creationDate());
hashCode = 31 * hashCode + Objects.hashCode(updateDate());
hashCode = 31 * hashCode + Objects.hashCode(updateVersion());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
hashCode = 31 * hashCode + Objects.hashCode(errorMessage());
hashCode = 31 * hashCode + Objects.hashCode(pendingDeletion());
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 AutoTuneStatus)) {
return false;
}
AutoTuneStatus other = (AutoTuneStatus) obj;
return Objects.equals(creationDate(), other.creationDate()) && Objects.equals(updateDate(), other.updateDate())
&& Objects.equals(updateVersion(), other.updateVersion())
&& Objects.equals(stateAsString(), other.stateAsString()) && Objects.equals(errorMessage(), other.errorMessage())
&& Objects.equals(pendingDeletion(), other.pendingDeletion());
}
/**
* 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("AutoTuneStatus").add("CreationDate", creationDate()).add("UpdateDate", updateDate())
.add("UpdateVersion", updateVersion()).add("State", stateAsString()).add("ErrorMessage", errorMessage())
.add("PendingDeletion", pendingDeletion()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CreationDate":
return Optional.ofNullable(clazz.cast(creationDate()));
case "UpdateDate":
return Optional.ofNullable(clazz.cast(updateDate()));
case "UpdateVersion":
return Optional.ofNullable(clazz.cast(updateVersion()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
case "ErrorMessage":
return Optional.ofNullable(clazz.cast(errorMessage()));
case "PendingDeletion":
return Optional.ofNullable(clazz.cast(pendingDeletion()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function