software.amazon.awssdk.services.opensearch.model.OptionStatus Maven / Gradle / Ivy
Show all versions of opensearch 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.opensearch.model;
import java.beans.Transient;
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;
/**
*
* Provides the current status of the entity.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class OptionStatus implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField CREATION_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationDate").getter(getter(OptionStatus::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(OptionStatus::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(OptionStatus::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(OptionStatus::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final SdkField PENDING_DELETION_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("PendingDeletion").getter(getter(OptionStatus::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, 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 Boolean pendingDeletion;
private OptionStatus(BuilderImpl builder) {
this.creationDate = builder.creationDate;
this.updateDate = builder.updateDate;
this.updateVersion = builder.updateVersion;
this.state = builder.state;
this.pendingDeletion = builder.pendingDeletion;
}
/**
*
* The timestamp of when the entity was created.
*
*
* @return The timestamp of when the entity was created.
*/
public final Instant creationDate() {
return creationDate;
}
/**
*
* The timestamp of the last time the entity was updated.
*
*
* @return The timestamp of the last time the entity was updated.
*/
public final Instant updateDate() {
return updateDate;
}
/**
*
* The latest version of the entity.
*
*
* @return The latest version of the entity.
*/
public final Integer updateVersion() {
return updateVersion;
}
/**
*
* Provides the OptionState
for the domain.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link OptionState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return Provides the OptionState
for the domain.
* @see OptionState
*/
public final OptionState state() {
return OptionState.fromValue(state);
}
/**
*
* Provides the OptionState
for the domain.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link OptionState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return Provides the OptionState
for the domain.
* @see OptionState
*/
public final String stateAsString() {
return state;
}
/**
*
* 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(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 OptionStatus)) {
return false;
}
OptionStatus other = (OptionStatus) obj;
return Objects.equals(creationDate(), other.creationDate()) && Objects.equals(updateDate(), other.updateDate())
&& Objects.equals(updateVersion(), other.updateVersion())
&& Objects.equals(stateAsString(), other.stateAsString())
&& 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("OptionStatus").add("CreationDate", creationDate()).add("UpdateDate", updateDate())
.add("UpdateVersion", updateVersion()).add("State", stateAsString()).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 "PendingDeletion":
return Optional.ofNullable(clazz.cast(pendingDeletion()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function