software.amazon.awssdk.services.kafka.model.NodeInfo Maven / Gradle / Ivy
Show all versions of kafka 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.kafka.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.Consumer;
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 node information object.
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class NodeInfo implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ADDED_TO_CLUSTER_TIME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AddedToClusterTime").getter(getter(NodeInfo::addedToClusterTime))
.setter(setter(Builder::addedToClusterTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("addedToClusterTime").build())
.build();
private static final SdkField BROKER_NODE_INFO_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("BrokerNodeInfo")
.getter(getter(NodeInfo::brokerNodeInfo)).setter(setter(Builder::brokerNodeInfo))
.constructor(BrokerNodeInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("brokerNodeInfo").build()).build();
private static final SdkField CONTROLLER_NODE_INFO_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ControllerNodeInfo")
.getter(getter(NodeInfo::controllerNodeInfo)).setter(setter(Builder::controllerNodeInfo))
.constructor(ControllerNodeInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("controllerNodeInfo").build())
.build();
private static final SdkField INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InstanceType").getter(getter(NodeInfo::instanceType)).setter(setter(Builder::instanceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("instanceType").build()).build();
private static final SdkField NODE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NodeARN").getter(getter(NodeInfo::nodeARN)).setter(setter(Builder::nodeARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("nodeARN").build()).build();
private static final SdkField NODE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NodeType").getter(getter(NodeInfo::nodeTypeAsString)).setter(setter(Builder::nodeType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("nodeType").build()).build();
private static final SdkField ZOOKEEPER_NODE_INFO_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ZookeeperNodeInfo")
.getter(getter(NodeInfo::zookeeperNodeInfo)).setter(setter(Builder::zookeeperNodeInfo))
.constructor(ZookeeperNodeInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("zookeeperNodeInfo").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ADDED_TO_CLUSTER_TIME_FIELD,
BROKER_NODE_INFO_FIELD, CONTROLLER_NODE_INFO_FIELD, INSTANCE_TYPE_FIELD, NODE_ARN_FIELD, NODE_TYPE_FIELD,
ZOOKEEPER_NODE_INFO_FIELD));
private static final long serialVersionUID = 1L;
private final String addedToClusterTime;
private final BrokerNodeInfo brokerNodeInfo;
private final ControllerNodeInfo controllerNodeInfo;
private final String instanceType;
private final String nodeARN;
private final String nodeType;
private final ZookeeperNodeInfo zookeeperNodeInfo;
private NodeInfo(BuilderImpl builder) {
this.addedToClusterTime = builder.addedToClusterTime;
this.brokerNodeInfo = builder.brokerNodeInfo;
this.controllerNodeInfo = builder.controllerNodeInfo;
this.instanceType = builder.instanceType;
this.nodeARN = builder.nodeARN;
this.nodeType = builder.nodeType;
this.zookeeperNodeInfo = builder.zookeeperNodeInfo;
}
/**
*
*
* The start time.
*
*
* @return
* The start time.
*
*/
public final String addedToClusterTime() {
return addedToClusterTime;
}
/**
*
*
* The broker node info.
*
*
* @return
* The broker node info.
*
*/
public final BrokerNodeInfo brokerNodeInfo() {
return brokerNodeInfo;
}
/**
*
*
* The ControllerNodeInfo.
*
*
* @return
* The ControllerNodeInfo.
*
*/
public final ControllerNodeInfo controllerNodeInfo() {
return controllerNodeInfo;
}
/**
*
*
* The instance type.
*
*
* @return
* The instance type.
*
*/
public final String instanceType() {
return instanceType;
}
/**
*
*
* The Amazon Resource Name (ARN) of the node.
*
*
* @return
* The Amazon Resource Name (ARN) of the node.
*
*/
public final String nodeARN() {
return nodeARN;
}
/**
*
*
* The node type.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #nodeType} will
* return {@link NodeType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #nodeTypeAsString}.
*
*
* @return
* The node type.
*
* @see NodeType
*/
public final NodeType nodeType() {
return NodeType.fromValue(nodeType);
}
/**
*
*
* The node type.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #nodeType} will
* return {@link NodeType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #nodeTypeAsString}.
*
*
* @return
* The node type.
*
* @see NodeType
*/
public final String nodeTypeAsString() {
return nodeType;
}
/**
*
*
* The ZookeeperNodeInfo.
*
*
* @return
* The ZookeeperNodeInfo.
*
*/
public final ZookeeperNodeInfo zookeeperNodeInfo() {
return zookeeperNodeInfo;
}
@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(addedToClusterTime());
hashCode = 31 * hashCode + Objects.hashCode(brokerNodeInfo());
hashCode = 31 * hashCode + Objects.hashCode(controllerNodeInfo());
hashCode = 31 * hashCode + Objects.hashCode(instanceType());
hashCode = 31 * hashCode + Objects.hashCode(nodeARN());
hashCode = 31 * hashCode + Objects.hashCode(nodeTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(zookeeperNodeInfo());
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 NodeInfo)) {
return false;
}
NodeInfo other = (NodeInfo) obj;
return Objects.equals(addedToClusterTime(), other.addedToClusterTime())
&& Objects.equals(brokerNodeInfo(), other.brokerNodeInfo())
&& Objects.equals(controllerNodeInfo(), other.controllerNodeInfo())
&& Objects.equals(instanceType(), other.instanceType()) && Objects.equals(nodeARN(), other.nodeARN())
&& Objects.equals(nodeTypeAsString(), other.nodeTypeAsString())
&& Objects.equals(zookeeperNodeInfo(), other.zookeeperNodeInfo());
}
/**
* 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("NodeInfo").add("AddedToClusterTime", addedToClusterTime())
.add("BrokerNodeInfo", brokerNodeInfo()).add("ControllerNodeInfo", controllerNodeInfo())
.add("InstanceType", instanceType()).add("NodeARN", nodeARN()).add("NodeType", nodeTypeAsString())
.add("ZookeeperNodeInfo", zookeeperNodeInfo()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AddedToClusterTime":
return Optional.ofNullable(clazz.cast(addedToClusterTime()));
case "BrokerNodeInfo":
return Optional.ofNullable(clazz.cast(brokerNodeInfo()));
case "ControllerNodeInfo":
return Optional.ofNullable(clazz.cast(controllerNodeInfo()));
case "InstanceType":
return Optional.ofNullable(clazz.cast(instanceType()));
case "NodeARN":
return Optional.ofNullable(clazz.cast(nodeARN()));
case "NodeType":
return Optional.ofNullable(clazz.cast(nodeTypeAsString()));
case "ZookeeperNodeInfo":
return Optional.ofNullable(clazz.cast(zookeeperNodeInfo()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function