
software.amazon.awssdk.services.robomaker.model.Robot 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.robomaker.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;
/**
*
* Information about a robot.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Robot implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Robot::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Robot::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField FLEET_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Robot::fleetArn)).setter(setter(Builder::fleetArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("fleetArn").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Robot::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField GREEN_GRASS_GROUP_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Robot::greenGrassGroupId)).setter(setter(Builder::greenGrassGroupId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("greenGrassGroupId").build()).build();
private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(Robot::createdAt)).setter(setter(Builder::createdAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createdAt").build()).build();
private static final SdkField ARCHITECTURE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Robot::architectureAsString)).setter(setter(Builder::architecture))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("architecture").build()).build();
private static final SdkField LAST_DEPLOYMENT_JOB_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Robot::lastDeploymentJob)).setter(setter(Builder::lastDeploymentJob))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastDeploymentJob").build()).build();
private static final SdkField LAST_DEPLOYMENT_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(Robot::lastDeploymentTime)).setter(setter(Builder::lastDeploymentTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastDeploymentTime").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, NAME_FIELD,
FLEET_ARN_FIELD, STATUS_FIELD, GREEN_GRASS_GROUP_ID_FIELD, CREATED_AT_FIELD, ARCHITECTURE_FIELD,
LAST_DEPLOYMENT_JOB_FIELD, LAST_DEPLOYMENT_TIME_FIELD));
private static final long serialVersionUID = 1L;
private final String arn;
private final String name;
private final String fleetArn;
private final String status;
private final String greenGrassGroupId;
private final Instant createdAt;
private final String architecture;
private final String lastDeploymentJob;
private final Instant lastDeploymentTime;
private Robot(BuilderImpl builder) {
this.arn = builder.arn;
this.name = builder.name;
this.fleetArn = builder.fleetArn;
this.status = builder.status;
this.greenGrassGroupId = builder.greenGrassGroupId;
this.createdAt = builder.createdAt;
this.architecture = builder.architecture;
this.lastDeploymentJob = builder.lastDeploymentJob;
this.lastDeploymentTime = builder.lastDeploymentTime;
}
/**
*
* The Amazon Resource Name (ARN) of the robot.
*
*
* @return The Amazon Resource Name (ARN) of the robot.
*/
public String arn() {
return arn;
}
/**
*
* The name of the robot.
*
*
* @return The name of the robot.
*/
public String name() {
return name;
}
/**
*
* The Amazon Resource Name (ARN) of the fleet.
*
*
* @return The Amazon Resource Name (ARN) of the fleet.
*/
public String fleetArn() {
return fleetArn;
}
/**
*
* The status of the robot.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link RobotStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the robot.
* @see RobotStatus
*/
public RobotStatus status() {
return RobotStatus.fromValue(status);
}
/**
*
* The status of the robot.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link RobotStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the robot.
* @see RobotStatus
*/
public String statusAsString() {
return status;
}
/**
*
* The Greengrass group associated with the robot.
*
*
* @return The Greengrass group associated with the robot.
*/
public String greenGrassGroupId() {
return greenGrassGroupId;
}
/**
*
* The time, in milliseconds since the epoch, when the robot was created.
*
*
* @return The time, in milliseconds since the epoch, when the robot was created.
*/
public Instant createdAt() {
return createdAt;
}
/**
*
* The architecture of the robot.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #architecture} will
* return {@link Architecture#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #architectureAsString}.
*
*
* @return The architecture of the robot.
* @see Architecture
*/
public Architecture architecture() {
return Architecture.fromValue(architecture);
}
/**
*
* The architecture of the robot.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #architecture} will
* return {@link Architecture#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #architectureAsString}.
*
*
* @return The architecture of the robot.
* @see Architecture
*/
public String architectureAsString() {
return architecture;
}
/**
*
* The Amazon Resource Name (ARN) of the last deployment job.
*
*
* @return The Amazon Resource Name (ARN) of the last deployment job.
*/
public String lastDeploymentJob() {
return lastDeploymentJob;
}
/**
*
* The time of the last deployment.
*
*
* @return The time of the last deployment.
*/
public Instant lastDeploymentTime() {
return lastDeploymentTime;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(fleetArn());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(greenGrassGroupId());
hashCode = 31 * hashCode + Objects.hashCode(createdAt());
hashCode = 31 * hashCode + Objects.hashCode(architectureAsString());
hashCode = 31 * hashCode + Objects.hashCode(lastDeploymentJob());
hashCode = 31 * hashCode + Objects.hashCode(lastDeploymentTime());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Robot)) {
return false;
}
Robot other = (Robot) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(name(), other.name())
&& Objects.equals(fleetArn(), other.fleetArn()) && Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(greenGrassGroupId(), other.greenGrassGroupId())
&& Objects.equals(createdAt(), other.createdAt())
&& Objects.equals(architectureAsString(), other.architectureAsString())
&& Objects.equals(lastDeploymentJob(), other.lastDeploymentJob())
&& Objects.equals(lastDeploymentTime(), other.lastDeploymentTime());
}
/**
* 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 String toString() {
return ToString.builder("Robot").add("Arn", arn()).add("Name", name()).add("FleetArn", fleetArn())
.add("Status", statusAsString()).add("GreenGrassGroupId", greenGrassGroupId()).add("CreatedAt", createdAt())
.add("Architecture", architectureAsString()).add("LastDeploymentJob", lastDeploymentJob())
.add("LastDeploymentTime", lastDeploymentTime()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "fleetArn":
return Optional.ofNullable(clazz.cast(fleetArn()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "greenGrassGroupId":
return Optional.ofNullable(clazz.cast(greenGrassGroupId()));
case "createdAt":
return Optional.ofNullable(clazz.cast(createdAt()));
case "architecture":
return Optional.ofNullable(clazz.cast(architectureAsString()));
case "lastDeploymentJob":
return Optional.ofNullable(clazz.cast(lastDeploymentJob()));
case "lastDeploymentTime":
return Optional.ofNullable(clazz.cast(lastDeploymentTime()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function