software.amazon.awssdk.services.opsworks.model.Command Maven / Gradle / Ivy
Show all versions of opsworks 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.opsworks.model;
import java.io.Serializable;
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;
/**
*
* Describes a command.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Command implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField COMMAND_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CommandId").getter(getter(Command::commandId)).setter(setter(Builder::commandId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CommandId").build()).build();
private static final SdkField INSTANCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InstanceId").getter(getter(Command::instanceId)).setter(setter(Builder::instanceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceId").build()).build();
private static final SdkField DEPLOYMENT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DeploymentId").getter(getter(Command::deploymentId)).setter(setter(Builder::deploymentId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeploymentId").build()).build();
private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CreatedAt").getter(getter(Command::createdAt)).setter(setter(Builder::createdAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedAt").build()).build();
private static final SdkField ACKNOWLEDGED_AT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AcknowledgedAt").getter(getter(Command::acknowledgedAt)).setter(setter(Builder::acknowledgedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AcknowledgedAt").build()).build();
private static final SdkField COMPLETED_AT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CompletedAt").getter(getter(Command::completedAt)).setter(setter(Builder::completedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CompletedAt").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(Command::status)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField EXIT_CODE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("ExitCode").getter(getter(Command::exitCode)).setter(setter(Builder::exitCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExitCode").build()).build();
private static final SdkField LOG_URL_FIELD = SdkField. builder(MarshallingType.STRING).memberName("LogUrl")
.getter(getter(Command::logUrl)).setter(setter(Builder::logUrl))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LogUrl").build()).build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Type")
.getter(getter(Command::type)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Type").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(COMMAND_ID_FIELD,
INSTANCE_ID_FIELD, DEPLOYMENT_ID_FIELD, CREATED_AT_FIELD, ACKNOWLEDGED_AT_FIELD, COMPLETED_AT_FIELD, STATUS_FIELD,
EXIT_CODE_FIELD, LOG_URL_FIELD, TYPE_FIELD));
private static final long serialVersionUID = 1L;
private final String commandId;
private final String instanceId;
private final String deploymentId;
private final String createdAt;
private final String acknowledgedAt;
private final String completedAt;
private final String status;
private final Integer exitCode;
private final String logUrl;
private final String type;
private Command(BuilderImpl builder) {
this.commandId = builder.commandId;
this.instanceId = builder.instanceId;
this.deploymentId = builder.deploymentId;
this.createdAt = builder.createdAt;
this.acknowledgedAt = builder.acknowledgedAt;
this.completedAt = builder.completedAt;
this.status = builder.status;
this.exitCode = builder.exitCode;
this.logUrl = builder.logUrl;
this.type = builder.type;
}
/**
*
* The command ID.
*
*
* @return The command ID.
*/
public final String commandId() {
return commandId;
}
/**
*
* The ID of the instance where the command was executed.
*
*
* @return The ID of the instance where the command was executed.
*/
public final String instanceId() {
return instanceId;
}
/**
*
* The command deployment ID.
*
*
* @return The command deployment ID.
*/
public final String deploymentId() {
return deploymentId;
}
/**
*
* Date and time when the command was run.
*
*
* @return Date and time when the command was run.
*/
public final String createdAt() {
return createdAt;
}
/**
*
* Date and time when the command was acknowledged.
*
*
* @return Date and time when the command was acknowledged.
*/
public final String acknowledgedAt() {
return acknowledgedAt;
}
/**
*
* Date when the command completed.
*
*
* @return Date when the command completed.
*/
public final String completedAt() {
return completedAt;
}
/**
*
* The command status:
*
*
* -
*
* failed
*
*
* -
*
* successful
*
*
* -
*
* skipped
*
*
* -
*
* pending
*
*
*
*
* @return The command status:
*
* -
*
* failed
*
*
* -
*
* successful
*
*
* -
*
* skipped
*
*
* -
*
* pending
*
*
*/
public final String status() {
return status;
}
/**
*
* The command exit code.
*
*
* @return The command exit code.
*/
public final Integer exitCode() {
return exitCode;
}
/**
*
* The URL of the command log.
*
*
* @return The URL of the command log.
*/
public final String logUrl() {
return logUrl;
}
/**
*
* The command type:
*
*
* -
*
* configure
*
*
* -
*
* deploy
*
*
* -
*
* execute_recipes
*
*
* -
*
* install_dependencies
*
*
* -
*
* restart
*
*
* -
*
* rollback
*
*
* -
*
* setup
*
*
* -
*
* start
*
*
* -
*
* stop
*
*
* -
*
* undeploy
*
*
* -
*
* update_custom_cookbooks
*
*
* -
*
* update_dependencies
*
*
*
*
* @return The command type:
*
* -
*
* configure
*
*
* -
*
* deploy
*
*
* -
*
* execute_recipes
*
*
* -
*
* install_dependencies
*
*
* -
*
* restart
*
*
* -
*
* rollback
*
*
* -
*
* setup
*
*
* -
*
* start
*
*
* -
*
* stop
*
*
* -
*
* undeploy
*
*
* -
*
* update_custom_cookbooks
*
*
* -
*
* update_dependencies
*
*
*/
public final String type() {
return type;
}
@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(commandId());
hashCode = 31 * hashCode + Objects.hashCode(instanceId());
hashCode = 31 * hashCode + Objects.hashCode(deploymentId());
hashCode = 31 * hashCode + Objects.hashCode(createdAt());
hashCode = 31 * hashCode + Objects.hashCode(acknowledgedAt());
hashCode = 31 * hashCode + Objects.hashCode(completedAt());
hashCode = 31 * hashCode + Objects.hashCode(status());
hashCode = 31 * hashCode + Objects.hashCode(exitCode());
hashCode = 31 * hashCode + Objects.hashCode(logUrl());
hashCode = 31 * hashCode + Objects.hashCode(type());
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 Command)) {
return false;
}
Command other = (Command) obj;
return Objects.equals(commandId(), other.commandId()) && Objects.equals(instanceId(), other.instanceId())
&& Objects.equals(deploymentId(), other.deploymentId()) && Objects.equals(createdAt(), other.createdAt())
&& Objects.equals(acknowledgedAt(), other.acknowledgedAt()) && Objects.equals(completedAt(), other.completedAt())
&& Objects.equals(status(), other.status()) && Objects.equals(exitCode(), other.exitCode())
&& Objects.equals(logUrl(), other.logUrl()) && Objects.equals(type(), other.type());
}
/**
* 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("Command").add("CommandId", commandId()).add("InstanceId", instanceId())
.add("DeploymentId", deploymentId()).add("CreatedAt", createdAt()).add("AcknowledgedAt", acknowledgedAt())
.add("CompletedAt", completedAt()).add("Status", status()).add("ExitCode", exitCode()).add("LogUrl", logUrl())
.add("Type", type()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CommandId":
return Optional.ofNullable(clazz.cast(commandId()));
case "InstanceId":
return Optional.ofNullable(clazz.cast(instanceId()));
case "DeploymentId":
return Optional.ofNullable(clazz.cast(deploymentId()));
case "CreatedAt":
return Optional.ofNullable(clazz.cast(createdAt()));
case "AcknowledgedAt":
return Optional.ofNullable(clazz.cast(acknowledgedAt()));
case "CompletedAt":
return Optional.ofNullable(clazz.cast(completedAt()));
case "Status":
return Optional.ofNullable(clazz.cast(status()));
case "ExitCode":
return Optional.ofNullable(clazz.cast(exitCode()));
case "LogUrl":
return Optional.ofNullable(clazz.cast(logUrl()));
case "Type":
return Optional.ofNullable(clazz.cast(type()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function