
software.amazon.awssdk.services.medialive.model.DescribeNodeSummary 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.medialive.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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.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;
/**
* Placeholder documentation for DescribeNodeSummary
*/
@Generated("software.amazon.awssdk:codegen")
public final class DescribeNodeSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn")
.getter(getter(DescribeNodeSummary::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField> CHANNEL_PLACEMENT_GROUPS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("ChannelPlacementGroups")
.getter(getter(DescribeNodeSummary::channelPlacementGroups))
.setter(setter(Builder::channelPlacementGroups))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("channelPlacementGroups").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField CLUSTER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ClusterId").getter(getter(DescribeNodeSummary::clusterId)).setter(setter(Builder::clusterId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clusterId").build()).build();
private static final SdkField CONNECTION_STATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ConnectionState").getter(getter(DescribeNodeSummary::connectionStateAsString))
.setter(setter(Builder::connectionState))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("connectionState").build()).build();
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
.getter(getter(DescribeNodeSummary::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("id").build()).build();
private static final SdkField INSTANCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InstanceArn").getter(getter(DescribeNodeSummary::instanceArn)).setter(setter(Builder::instanceArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("instanceArn").build()).build();
private static final SdkField MANAGED_INSTANCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ManagedInstanceId").getter(getter(DescribeNodeSummary::managedInstanceId))
.setter(setter(Builder::managedInstanceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("managedInstanceId").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(DescribeNodeSummary::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField> NODE_INTERFACE_MAPPINGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("NodeInterfaceMappings")
.getter(getter(DescribeNodeSummary::nodeInterfaceMappings))
.setter(setter(Builder::nodeInterfaceMappings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("nodeInterfaceMappings").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(NodeInterfaceMapping::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField ROLE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Role")
.getter(getter(DescribeNodeSummary::roleAsString)).setter(setter(Builder::role))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("role").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(DescribeNodeSummary::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("state").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD,
CHANNEL_PLACEMENT_GROUPS_FIELD, CLUSTER_ID_FIELD, CONNECTION_STATE_FIELD, ID_FIELD, INSTANCE_ARN_FIELD,
MANAGED_INSTANCE_ID_FIELD, NAME_FIELD, NODE_INTERFACE_MAPPINGS_FIELD, ROLE_FIELD, STATE_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final String arn;
private final List channelPlacementGroups;
private final String clusterId;
private final String connectionState;
private final String id;
private final String instanceArn;
private final String managedInstanceId;
private final String name;
private final List nodeInterfaceMappings;
private final String role;
private final String state;
private DescribeNodeSummary(BuilderImpl builder) {
this.arn = builder.arn;
this.channelPlacementGroups = builder.channelPlacementGroups;
this.clusterId = builder.clusterId;
this.connectionState = builder.connectionState;
this.id = builder.id;
this.instanceArn = builder.instanceArn;
this.managedInstanceId = builder.managedInstanceId;
this.name = builder.name;
this.nodeInterfaceMappings = builder.nodeInterfaceMappings;
this.role = builder.role;
this.state = builder.state;
}
/**
* The ARN of the Node. It is automatically assigned when the Node is created.
*
* @return The ARN of the Node. It is automatically assigned when the Node is created.
*/
public final String arn() {
return arn;
}
/**
* For responses, this returns true if the service returned a value for the ChannelPlacementGroups 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 hasChannelPlacementGroups() {
return channelPlacementGroups != null && !(channelPlacementGroups instanceof SdkAutoConstructList);
}
/**
* An array of IDs. Each ID is one ChannelPlacementGroup that is associated with this Node. Empty if the Node is not
* yet associated with any groups.
*
* 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 #hasChannelPlacementGroups} method.
*
*
* @return An array of IDs. Each ID is one ChannelPlacementGroup that is associated with this Node. Empty if the
* Node is not yet associated with any groups.
*/
public final List channelPlacementGroups() {
return channelPlacementGroups;
}
/**
* The ID of the Cluster that the Node belongs to.
*
* @return The ID of the Cluster that the Node belongs to.
*/
public final String clusterId() {
return clusterId;
}
/**
* The current connection state of the Node.
*
* If the service returns an enum value that is not available in the current SDK version, {@link #connectionState}
* will return {@link NodeConnectionState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #connectionStateAsString}.
*
*
* @return The current connection state of the Node.
* @see NodeConnectionState
*/
public final NodeConnectionState connectionState() {
return NodeConnectionState.fromValue(connectionState);
}
/**
* The current connection state of the Node.
*
* If the service returns an enum value that is not available in the current SDK version, {@link #connectionState}
* will return {@link NodeConnectionState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #connectionStateAsString}.
*
*
* @return The current connection state of the Node.
* @see NodeConnectionState
*/
public final String connectionStateAsString() {
return connectionState;
}
/**
* The unique ID of the Node. Unique in the Cluster. The ID is the resource-id portion of the ARN.
*
* @return The unique ID of the Node. Unique in the Cluster. The ID is the resource-id portion of the ARN.
*/
public final String id() {
return id;
}
/**
* The EC2 ARN of the Instance associated with the Node.
*
* @return The EC2 ARN of the Instance associated with the Node.
*/
public final String instanceArn() {
return instanceArn;
}
/**
* At the routing layer will get it from the callerId/context for use with bring your own device.
*
* @return At the routing layer will get it from the callerId/context for use with bring your own device.
*/
public final String managedInstanceId() {
return managedInstanceId;
}
/**
* The name that you specified for the Node.
*
* @return The name that you specified for the Node.
*/
public final String name() {
return name;
}
/**
* For responses, this returns true if the service returned a value for the NodeInterfaceMappings 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 hasNodeInterfaceMappings() {
return nodeInterfaceMappings != null && !(nodeInterfaceMappings instanceof SdkAutoConstructList);
}
/**
* Documentation update needed
*
* 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 #hasNodeInterfaceMappings} method.
*
*
* @return Documentation update needed
*/
public final List nodeInterfaceMappings() {
return nodeInterfaceMappings;
}
/**
* The initial role current role of the Node in the Cluster. ACTIVE means the Node is available for encoding. BACKUP
* means the Node is a redundant Node and might get used if an ACTIVE Node fails.
*
* If the service returns an enum value that is not available in the current SDK version, {@link #role} will return
* {@link NodeRole#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #roleAsString}.
*
*
* @return The initial role current role of the Node in the Cluster. ACTIVE means the Node is available for
* encoding. BACKUP means the Node is a redundant Node and might get used if an ACTIVE Node fails.
* @see NodeRole
*/
public final NodeRole role() {
return NodeRole.fromValue(role);
}
/**
* The initial role current role of the Node in the Cluster. ACTIVE means the Node is available for encoding. BACKUP
* means the Node is a redundant Node and might get used if an ACTIVE Node fails.
*
* If the service returns an enum value that is not available in the current SDK version, {@link #role} will return
* {@link NodeRole#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #roleAsString}.
*
*
* @return The initial role current role of the Node in the Cluster. ACTIVE means the Node is available for
* encoding. BACKUP means the Node is a redundant Node and might get used if an ACTIVE Node fails.
* @see NodeRole
*/
public final String roleAsString() {
return role;
}
/**
* The current state of the Node.
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link NodeState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The current state of the Node.
* @see NodeState
*/
public final NodeState state() {
return NodeState.fromValue(state);
}
/**
* The current state of the Node.
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link NodeState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The current state of the Node.
* @see NodeState
*/
public final String stateAsString() {
return state;
}
@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(arn());
hashCode = 31 * hashCode + Objects.hashCode(hasChannelPlacementGroups() ? channelPlacementGroups() : null);
hashCode = 31 * hashCode + Objects.hashCode(clusterId());
hashCode = 31 * hashCode + Objects.hashCode(connectionStateAsString());
hashCode = 31 * hashCode + Objects.hashCode(id());
hashCode = 31 * hashCode + Objects.hashCode(instanceArn());
hashCode = 31 * hashCode + Objects.hashCode(managedInstanceId());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(hasNodeInterfaceMappings() ? nodeInterfaceMappings() : null);
hashCode = 31 * hashCode + Objects.hashCode(roleAsString());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
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 DescribeNodeSummary)) {
return false;
}
DescribeNodeSummary other = (DescribeNodeSummary) obj;
return Objects.equals(arn(), other.arn()) && hasChannelPlacementGroups() == other.hasChannelPlacementGroups()
&& Objects.equals(channelPlacementGroups(), other.channelPlacementGroups())
&& Objects.equals(clusterId(), other.clusterId())
&& Objects.equals(connectionStateAsString(), other.connectionStateAsString()) && Objects.equals(id(), other.id())
&& Objects.equals(instanceArn(), other.instanceArn())
&& Objects.equals(managedInstanceId(), other.managedInstanceId()) && Objects.equals(name(), other.name())
&& hasNodeInterfaceMappings() == other.hasNodeInterfaceMappings()
&& Objects.equals(nodeInterfaceMappings(), other.nodeInterfaceMappings())
&& Objects.equals(roleAsString(), other.roleAsString()) && Objects.equals(stateAsString(), other.stateAsString());
}
/**
* 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("DescribeNodeSummary").add("Arn", arn())
.add("ChannelPlacementGroups", hasChannelPlacementGroups() ? channelPlacementGroups() : null)
.add("ClusterId", clusterId()).add("ConnectionState", connectionStateAsString()).add("Id", id())
.add("InstanceArn", instanceArn()).add("ManagedInstanceId", managedInstanceId()).add("Name", name())
.add("NodeInterfaceMappings", hasNodeInterfaceMappings() ? nodeInterfaceMappings() : null)
.add("Role", roleAsString()).add("State", stateAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Arn":
return Optional.ofNullable(clazz.cast(arn()));
case "ChannelPlacementGroups":
return Optional.ofNullable(clazz.cast(channelPlacementGroups()));
case "ClusterId":
return Optional.ofNullable(clazz.cast(clusterId()));
case "ConnectionState":
return Optional.ofNullable(clazz.cast(connectionStateAsString()));
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "InstanceArn":
return Optional.ofNullable(clazz.cast(instanceArn()));
case "ManagedInstanceId":
return Optional.ofNullable(clazz.cast(managedInstanceId()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "NodeInterfaceMappings":
return Optional.ofNullable(clazz.cast(nodeInterfaceMappings()));
case "Role":
return Optional.ofNullable(clazz.cast(roleAsString()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
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("arn", ARN_FIELD);
map.put("channelPlacementGroups", CHANNEL_PLACEMENT_GROUPS_FIELD);
map.put("clusterId", CLUSTER_ID_FIELD);
map.put("connectionState", CONNECTION_STATE_FIELD);
map.put("id", ID_FIELD);
map.put("instanceArn", INSTANCE_ARN_FIELD);
map.put("managedInstanceId", MANAGED_INSTANCE_ID_FIELD);
map.put("name", NAME_FIELD);
map.put("nodeInterfaceMappings", NODE_INTERFACE_MAPPINGS_FIELD);
map.put("role", ROLE_FIELD);
map.put("state", STATE_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function