software.amazon.awssdk.services.sagemaker.model.DeviceSummary Maven / Gradle / Ivy
Show all versions of sagemaker 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.sagemaker.model;
import java.beans.Transient;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
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.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Summary of the device.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DeviceSummary implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField DEVICE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DeviceName").getter(getter(DeviceSummary::deviceName)).setter(setter(Builder::deviceName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeviceName").build()).build();
private static final SdkField DEVICE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DeviceArn").getter(getter(DeviceSummary::deviceArn)).setter(setter(Builder::deviceArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeviceArn").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Description").getter(getter(DeviceSummary::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField DEVICE_FLEET_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DeviceFleetName").getter(getter(DeviceSummary::deviceFleetName))
.setter(setter(Builder::deviceFleetName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeviceFleetName").build()).build();
private static final SdkField IOT_THING_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("IotThingName").getter(getter(DeviceSummary::iotThingName)).setter(setter(Builder::iotThingName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IotThingName").build()).build();
private static final SdkField REGISTRATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("RegistrationTime").getter(getter(DeviceSummary::registrationTime))
.setter(setter(Builder::registrationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RegistrationTime").build()).build();
private static final SdkField LATEST_HEARTBEAT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LatestHeartbeat").getter(getter(DeviceSummary::latestHeartbeat))
.setter(setter(Builder::latestHeartbeat))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LatestHeartbeat").build()).build();
private static final SdkField> MODELS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Models")
.getter(getter(DeviceSummary::models))
.setter(setter(Builder::models))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Models").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(EdgeModelSummary::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField AGENT_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AgentVersion").getter(getter(DeviceSummary::agentVersion)).setter(setter(Builder::agentVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AgentVersion").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DEVICE_NAME_FIELD,
DEVICE_ARN_FIELD, DESCRIPTION_FIELD, DEVICE_FLEET_NAME_FIELD, IOT_THING_NAME_FIELD, REGISTRATION_TIME_FIELD,
LATEST_HEARTBEAT_FIELD, MODELS_FIELD, AGENT_VERSION_FIELD));
private static final long serialVersionUID = 1L;
private final String deviceName;
private final String deviceArn;
private final String description;
private final String deviceFleetName;
private final String iotThingName;
private final Instant registrationTime;
private final Instant latestHeartbeat;
private final List models;
private final String agentVersion;
private DeviceSummary(BuilderImpl builder) {
this.deviceName = builder.deviceName;
this.deviceArn = builder.deviceArn;
this.description = builder.description;
this.deviceFleetName = builder.deviceFleetName;
this.iotThingName = builder.iotThingName;
this.registrationTime = builder.registrationTime;
this.latestHeartbeat = builder.latestHeartbeat;
this.models = builder.models;
this.agentVersion = builder.agentVersion;
}
/**
*
* The unique identifier of the device.
*
*
* @return The unique identifier of the device.
*/
public final String deviceName() {
return deviceName;
}
/**
*
* Amazon Resource Name (ARN) of the device.
*
*
* @return Amazon Resource Name (ARN) of the device.
*/
public final String deviceArn() {
return deviceArn;
}
/**
*
* A description of the device.
*
*
* @return A description of the device.
*/
public final String description() {
return description;
}
/**
*
* The name of the fleet the device belongs to.
*
*
* @return The name of the fleet the device belongs to.
*/
public final String deviceFleetName() {
return deviceFleetName;
}
/**
*
* The Amazon Web Services Internet of Things (IoT) object thing name associated with the device..
*
*
* @return The Amazon Web Services Internet of Things (IoT) object thing name associated with the device..
*/
public final String iotThingName() {
return iotThingName;
}
/**
*
* The timestamp of the last registration or de-reregistration.
*
*
* @return The timestamp of the last registration or de-reregistration.
*/
public final Instant registrationTime() {
return registrationTime;
}
/**
*
* The last heartbeat received from the device.
*
*
* @return The last heartbeat received from the device.
*/
public final Instant latestHeartbeat() {
return latestHeartbeat;
}
/**
* For responses, this returns true if the service returned a value for the Models property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasModels() {
return models != null && !(models instanceof SdkAutoConstructList);
}
/**
*
* Models on the device.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasModels} method.
*
*
* @return Models on the device.
*/
public final List models() {
return models;
}
/**
*
* Edge Manager agent version.
*
*
* @return Edge Manager agent version.
*/
public final String agentVersion() {
return agentVersion;
}
@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(deviceName());
hashCode = 31 * hashCode + Objects.hashCode(deviceArn());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(deviceFleetName());
hashCode = 31 * hashCode + Objects.hashCode(iotThingName());
hashCode = 31 * hashCode + Objects.hashCode(registrationTime());
hashCode = 31 * hashCode + Objects.hashCode(latestHeartbeat());
hashCode = 31 * hashCode + Objects.hashCode(hasModels() ? models() : null);
hashCode = 31 * hashCode + Objects.hashCode(agentVersion());
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 DeviceSummary)) {
return false;
}
DeviceSummary other = (DeviceSummary) obj;
return Objects.equals(deviceName(), other.deviceName()) && Objects.equals(deviceArn(), other.deviceArn())
&& Objects.equals(description(), other.description())
&& Objects.equals(deviceFleetName(), other.deviceFleetName())
&& Objects.equals(iotThingName(), other.iotThingName())
&& Objects.equals(registrationTime(), other.registrationTime())
&& Objects.equals(latestHeartbeat(), other.latestHeartbeat()) && hasModels() == other.hasModels()
&& Objects.equals(models(), other.models()) && Objects.equals(agentVersion(), other.agentVersion());
}
/**
* 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("DeviceSummary").add("DeviceName", deviceName()).add("DeviceArn", deviceArn())
.add("Description", description()).add("DeviceFleetName", deviceFleetName()).add("IotThingName", iotThingName())
.add("RegistrationTime", registrationTime()).add("LatestHeartbeat", latestHeartbeat())
.add("Models", hasModels() ? models() : null).add("AgentVersion", agentVersion()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DeviceName":
return Optional.ofNullable(clazz.cast(deviceName()));
case "DeviceArn":
return Optional.ofNullable(clazz.cast(deviceArn()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "DeviceFleetName":
return Optional.ofNullable(clazz.cast(deviceFleetName()));
case "IotThingName":
return Optional.ofNullable(clazz.cast(iotThingName()));
case "RegistrationTime":
return Optional.ofNullable(clazz.cast(registrationTime()));
case "LatestHeartbeat":
return Optional.ofNullable(clazz.cast(latestHeartbeat()));
case "Models":
return Optional.ofNullable(clazz.cast(models()));
case "AgentVersion":
return Optional.ofNullable(clazz.cast(agentVersion()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function