software.amazon.awssdk.services.opensearch.model.ChangeProgressDetails 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.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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;
/**
*
* Container for information about a configuration change happening on a domain.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ChangeProgressDetails implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField CHANGE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ChangeId").getter(getter(ChangeProgressDetails::changeId)).setter(setter(Builder::changeId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ChangeId").build()).build();
private static final SdkField MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Message")
.getter(getter(ChangeProgressDetails::message)).setter(setter(Builder::message))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Message").build()).build();
private static final SdkField CONFIG_CHANGE_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ConfigChangeStatus").getter(getter(ChangeProgressDetails::configChangeStatusAsString))
.setter(setter(Builder::configChangeStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConfigChangeStatus").build())
.build();
private static final SdkField INITIATED_BY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InitiatedBy").getter(getter(ChangeProgressDetails::initiatedByAsString))
.setter(setter(Builder::initiatedBy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InitiatedBy").build()).build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("StartTime").getter(getter(ChangeProgressDetails::startTime)).setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartTime").build()).build();
private static final SdkField LAST_UPDATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastUpdatedTime").getter(getter(ChangeProgressDetails::lastUpdatedTime))
.setter(setter(Builder::lastUpdatedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedTime").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CHANGE_ID_FIELD,
MESSAGE_FIELD, CONFIG_CHANGE_STATUS_FIELD, INITIATED_BY_FIELD, START_TIME_FIELD, LAST_UPDATED_TIME_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final String changeId;
private final String message;
private final String configChangeStatus;
private final String initiatedBy;
private final Instant startTime;
private final Instant lastUpdatedTime;
private ChangeProgressDetails(BuilderImpl builder) {
this.changeId = builder.changeId;
this.message = builder.message;
this.configChangeStatus = builder.configChangeStatus;
this.initiatedBy = builder.initiatedBy;
this.startTime = builder.startTime;
this.lastUpdatedTime = builder.lastUpdatedTime;
}
/**
*
* The ID of the configuration change.
*
*
* @return The ID of the configuration change.
*/
public final String changeId() {
return changeId;
}
/**
*
* A message corresponding to the status of the configuration change.
*
*
* @return A message corresponding to the status of the configuration change.
*/
public final String message() {
return message;
}
/**
*
* The current status of the configuration change.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #configChangeStatus} will return {@link ConfigChangeStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #configChangeStatusAsString}.
*
*
* @return The current status of the configuration change.
* @see ConfigChangeStatus
*/
public final ConfigChangeStatus configChangeStatus() {
return ConfigChangeStatus.fromValue(configChangeStatus);
}
/**
*
* The current status of the configuration change.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #configChangeStatus} will return {@link ConfigChangeStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #configChangeStatusAsString}.
*
*
* @return The current status of the configuration change.
* @see ConfigChangeStatus
*/
public final String configChangeStatusAsString() {
return configChangeStatus;
}
/**
*
* The IAM principal who initiated the configuration change.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #initiatedBy} will
* return {@link InitiatedBy#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #initiatedByAsString}.
*
*
* @return The IAM principal who initiated the configuration change.
* @see InitiatedBy
*/
public final InitiatedBy initiatedBy() {
return InitiatedBy.fromValue(initiatedBy);
}
/**
*
* The IAM principal who initiated the configuration change.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #initiatedBy} will
* return {@link InitiatedBy#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #initiatedByAsString}.
*
*
* @return The IAM principal who initiated the configuration change.
* @see InitiatedBy
*/
public final String initiatedByAsString() {
return initiatedBy;
}
/**
*
* The time that the configuration change was initiated, in Universal Coordinated Time (UTC).
*
*
* @return The time that the configuration change was initiated, in Universal Coordinated Time (UTC).
*/
public final Instant startTime() {
return startTime;
}
/**
*
* The last time that the configuration change was updated.
*
*
* @return The last time that the configuration change was updated.
*/
public final Instant lastUpdatedTime() {
return lastUpdatedTime;
}
@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(changeId());
hashCode = 31 * hashCode + Objects.hashCode(message());
hashCode = 31 * hashCode + Objects.hashCode(configChangeStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(initiatedByAsString());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTime());
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 ChangeProgressDetails)) {
return false;
}
ChangeProgressDetails other = (ChangeProgressDetails) obj;
return Objects.equals(changeId(), other.changeId()) && Objects.equals(message(), other.message())
&& Objects.equals(configChangeStatusAsString(), other.configChangeStatusAsString())
&& Objects.equals(initiatedByAsString(), other.initiatedByAsString())
&& Objects.equals(startTime(), other.startTime()) && Objects.equals(lastUpdatedTime(), other.lastUpdatedTime());
}
/**
* 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("ChangeProgressDetails").add("ChangeId", changeId()).add("Message", message())
.add("ConfigChangeStatus", configChangeStatusAsString()).add("InitiatedBy", initiatedByAsString())
.add("StartTime", startTime()).add("LastUpdatedTime", lastUpdatedTime()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ChangeId":
return Optional.ofNullable(clazz.cast(changeId()));
case "Message":
return Optional.ofNullable(clazz.cast(message()));
case "ConfigChangeStatus":
return Optional.ofNullable(clazz.cast(configChangeStatusAsString()));
case "InitiatedBy":
return Optional.ofNullable(clazz.cast(initiatedByAsString()));
case "StartTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "LastUpdatedTime":
return Optional.ofNullable(clazz.cast(lastUpdatedTime()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("ChangeId", CHANGE_ID_FIELD);
map.put("Message", MESSAGE_FIELD);
map.put("ConfigChangeStatus", CONFIG_CHANGE_STATUS_FIELD);
map.put("InitiatedBy", INITIATED_BY_FIELD);
map.put("StartTime", START_TIME_FIELD);
map.put("LastUpdatedTime", LAST_UPDATED_TIME_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function