software.amazon.awssdk.services.elasticbeanstalk.model.ManagedActionHistoryItem 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.elasticbeanstalk.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 record of a completed or failed managed action.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ManagedActionHistoryItem implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ACTION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ActionId").getter(getter(ManagedActionHistoryItem::actionId)).setter(setter(Builder::actionId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ActionId").build()).build();
private static final SdkField ACTION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ActionType").getter(getter(ManagedActionHistoryItem::actionTypeAsString))
.setter(setter(Builder::actionType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ActionType").build()).build();
private static final SdkField ACTION_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ActionDescription").getter(getter(ManagedActionHistoryItem::actionDescription))
.setter(setter(Builder::actionDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ActionDescription").build()).build();
private static final SdkField FAILURE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("FailureType").getter(getter(ManagedActionHistoryItem::failureTypeAsString))
.setter(setter(Builder::failureType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailureType").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(ManagedActionHistoryItem::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField FAILURE_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("FailureDescription").getter(getter(ManagedActionHistoryItem::failureDescription))
.setter(setter(Builder::failureDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailureDescription").build())
.build();
private static final SdkField EXECUTED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("ExecutedTime").getter(getter(ManagedActionHistoryItem::executedTime))
.setter(setter(Builder::executedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExecutedTime").build()).build();
private static final SdkField FINISHED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("FinishedTime").getter(getter(ManagedActionHistoryItem::finishedTime))
.setter(setter(Builder::finishedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FinishedTime").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACTION_ID_FIELD,
ACTION_TYPE_FIELD, ACTION_DESCRIPTION_FIELD, FAILURE_TYPE_FIELD, STATUS_FIELD, FAILURE_DESCRIPTION_FIELD,
EXECUTED_TIME_FIELD, FINISHED_TIME_FIELD));
private static final long serialVersionUID = 1L;
private final String actionId;
private final String actionType;
private final String actionDescription;
private final String failureType;
private final String status;
private final String failureDescription;
private final Instant executedTime;
private final Instant finishedTime;
private ManagedActionHistoryItem(BuilderImpl builder) {
this.actionId = builder.actionId;
this.actionType = builder.actionType;
this.actionDescription = builder.actionDescription;
this.failureType = builder.failureType;
this.status = builder.status;
this.failureDescription = builder.failureDescription;
this.executedTime = builder.executedTime;
this.finishedTime = builder.finishedTime;
}
/**
*
* A unique identifier for the managed action.
*
*
* @return A unique identifier for the managed action.
*/
public final String actionId() {
return actionId;
}
/**
*
* The type of the managed action.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #actionType} will
* return {@link ActionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #actionTypeAsString}.
*
*
* @return The type of the managed action.
* @see ActionType
*/
public final ActionType actionType() {
return ActionType.fromValue(actionType);
}
/**
*
* The type of the managed action.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #actionType} will
* return {@link ActionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #actionTypeAsString}.
*
*
* @return The type of the managed action.
* @see ActionType
*/
public final String actionTypeAsString() {
return actionType;
}
/**
*
* A description of the managed action.
*
*
* @return A description of the managed action.
*/
public final String actionDescription() {
return actionDescription;
}
/**
*
* If the action failed, the type of failure.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #failureType} will
* return {@link FailureType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #failureTypeAsString}.
*
*
* @return If the action failed, the type of failure.
* @see FailureType
*/
public final FailureType failureType() {
return FailureType.fromValue(failureType);
}
/**
*
* If the action failed, the type of failure.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #failureType} will
* return {@link FailureType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #failureTypeAsString}.
*
*
* @return If the action failed, the type of failure.
* @see FailureType
*/
public final String failureTypeAsString() {
return failureType;
}
/**
*
* The status of the action.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ActionHistoryStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the action.
* @see ActionHistoryStatus
*/
public final ActionHistoryStatus status() {
return ActionHistoryStatus.fromValue(status);
}
/**
*
* The status of the action.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ActionHistoryStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the action.
* @see ActionHistoryStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* If the action failed, a description of the failure.
*
*
* @return If the action failed, a description of the failure.
*/
public final String failureDescription() {
return failureDescription;
}
/**
*
* The date and time that the action started executing.
*
*
* @return The date and time that the action started executing.
*/
public final Instant executedTime() {
return executedTime;
}
/**
*
* The date and time that the action finished executing.
*
*
* @return The date and time that the action finished executing.
*/
public final Instant finishedTime() {
return finishedTime;
}
@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(actionId());
hashCode = 31 * hashCode + Objects.hashCode(actionTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(actionDescription());
hashCode = 31 * hashCode + Objects.hashCode(failureTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(failureDescription());
hashCode = 31 * hashCode + Objects.hashCode(executedTime());
hashCode = 31 * hashCode + Objects.hashCode(finishedTime());
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 ManagedActionHistoryItem)) {
return false;
}
ManagedActionHistoryItem other = (ManagedActionHistoryItem) obj;
return Objects.equals(actionId(), other.actionId()) && Objects.equals(actionTypeAsString(), other.actionTypeAsString())
&& Objects.equals(actionDescription(), other.actionDescription())
&& Objects.equals(failureTypeAsString(), other.failureTypeAsString())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(failureDescription(), other.failureDescription())
&& Objects.equals(executedTime(), other.executedTime()) && Objects.equals(finishedTime(), other.finishedTime());
}
/**
* 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("ManagedActionHistoryItem").add("ActionId", actionId()).add("ActionType", actionTypeAsString())
.add("ActionDescription", actionDescription()).add("FailureType", failureTypeAsString())
.add("Status", statusAsString()).add("FailureDescription", failureDescription())
.add("ExecutedTime", executedTime()).add("FinishedTime", finishedTime()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ActionId":
return Optional.ofNullable(clazz.cast(actionId()));
case "ActionType":
return Optional.ofNullable(clazz.cast(actionTypeAsString()));
case "ActionDescription":
return Optional.ofNullable(clazz.cast(actionDescription()));
case "FailureType":
return Optional.ofNullable(clazz.cast(failureTypeAsString()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "FailureDescription":
return Optional.ofNullable(clazz.cast(failureDescription()));
case "ExecutedTime":
return Optional.ofNullable(clazz.cast(executedTime()));
case "FinishedTime":
return Optional.ofNullable(clazz.cast(finishedTime()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function