software.amazon.awssdk.services.kafka.model.ClusterOperationInfo 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.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.traits.TimestampFormatTrait;
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;
/**
*
*
* Returns information about a cluster operation.
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ClusterOperationInfo implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField CLIENT_REQUEST_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ClientRequestId").getter(getter(ClusterOperationInfo::clientRequestId))
.setter(setter(Builder::clientRequestId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clientRequestId").build()).build();
private static final SdkField CLUSTER_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ClusterArn").getter(getter(ClusterOperationInfo::clusterArn)).setter(setter(Builder::clusterArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clusterArn").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("CreationTime")
.getter(getter(ClusterOperationInfo::creationTime))
.setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("creationTime").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField END_TIME_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("EndTime")
.getter(getter(ClusterOperationInfo::endTime))
.setter(setter(Builder::endTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("endTime").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField ERROR_INFO_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("ErrorInfo").getter(getter(ClusterOperationInfo::errorInfo)).setter(setter(Builder::errorInfo))
.constructor(ErrorInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("errorInfo").build()).build();
private static final SdkField OPERATION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OperationArn").getter(getter(ClusterOperationInfo::operationArn)).setter(setter(Builder::operationArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("operationArn").build()).build();
private static final SdkField OPERATION_STATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OperationState").getter(getter(ClusterOperationInfo::operationState))
.setter(setter(Builder::operationState))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("operationState").build()).build();
private static final SdkField> OPERATION_STEPS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("OperationSteps")
.getter(getter(ClusterOperationInfo::operationSteps))
.setter(setter(Builder::operationSteps))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("operationSteps").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ClusterOperationStep::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField OPERATION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OperationType").getter(getter(ClusterOperationInfo::operationType))
.setter(setter(Builder::operationType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("operationType").build()).build();
private static final SdkField SOURCE_CLUSTER_INFO_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("SourceClusterInfo")
.getter(getter(ClusterOperationInfo::sourceClusterInfo)).setter(setter(Builder::sourceClusterInfo))
.constructor(MutableClusterInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("sourceClusterInfo").build()).build();
private static final SdkField TARGET_CLUSTER_INFO_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("TargetClusterInfo")
.getter(getter(ClusterOperationInfo::targetClusterInfo)).setter(setter(Builder::targetClusterInfo))
.constructor(MutableClusterInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("targetClusterInfo").build()).build();
private static final SdkField VPC_CONNECTION_INFO_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("VpcConnectionInfo")
.getter(getter(ClusterOperationInfo::vpcConnectionInfo)).setter(setter(Builder::vpcConnectionInfo))
.constructor(VpcConnectionInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("vpcConnectionInfo").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CLIENT_REQUEST_ID_FIELD,
CLUSTER_ARN_FIELD, CREATION_TIME_FIELD, END_TIME_FIELD, ERROR_INFO_FIELD, OPERATION_ARN_FIELD, OPERATION_STATE_FIELD,
OPERATION_STEPS_FIELD, OPERATION_TYPE_FIELD, SOURCE_CLUSTER_INFO_FIELD, TARGET_CLUSTER_INFO_FIELD,
VPC_CONNECTION_INFO_FIELD));
private static final long serialVersionUID = 1L;
private final String clientRequestId;
private final String clusterArn;
private final Instant creationTime;
private final Instant endTime;
private final ErrorInfo errorInfo;
private final String operationArn;
private final String operationState;
private final List operationSteps;
private final String operationType;
private final MutableClusterInfo sourceClusterInfo;
private final MutableClusterInfo targetClusterInfo;
private final VpcConnectionInfo vpcConnectionInfo;
private ClusterOperationInfo(BuilderImpl builder) {
this.clientRequestId = builder.clientRequestId;
this.clusterArn = builder.clusterArn;
this.creationTime = builder.creationTime;
this.endTime = builder.endTime;
this.errorInfo = builder.errorInfo;
this.operationArn = builder.operationArn;
this.operationState = builder.operationState;
this.operationSteps = builder.operationSteps;
this.operationType = builder.operationType;
this.sourceClusterInfo = builder.sourceClusterInfo;
this.targetClusterInfo = builder.targetClusterInfo;
this.vpcConnectionInfo = builder.vpcConnectionInfo;
}
/**
*
*
* The ID of the API request that triggered this operation.
*
*
* @return
* The ID of the API request that triggered this operation.
*
*/
public final String clientRequestId() {
return clientRequestId;
}
/**
*
*
* ARN of the cluster.
*
*
* @return
* ARN of the cluster.
*
*/
public final String clusterArn() {
return clusterArn;
}
/**
*
*
* The time that the operation was created.
*
*
* @return
* The time that the operation was created.
*
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
*
* The time at which the operation finished.
*
*
* @return
* The time at which the operation finished.
*
*/
public final Instant endTime() {
return endTime;
}
/**
*
*
* Describes the error if the operation fails.
*
*
* @return
* Describes the error if the operation fails.
*
*/
public final ErrorInfo errorInfo() {
return errorInfo;
}
/**
*
*
* ARN of the cluster operation.
*
*
* @return
* ARN of the cluster operation.
*
*/
public final String operationArn() {
return operationArn;
}
/**
*
*
* State of the cluster operation.
*
*
* @return
* State of the cluster operation.
*
*/
public final String operationState() {
return operationState;
}
/**
* For responses, this returns true if the service returned a value for the OperationSteps 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 hasOperationSteps() {
return operationSteps != null && !(operationSteps instanceof SdkAutoConstructList);
}
/**
*
*
* Steps completed during the operation.
*
*
*
* 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 #hasOperationSteps} method.
*
*
* @return
* Steps completed during the operation.
*
*/
public final List operationSteps() {
return operationSteps;
}
/**
*
*
* Type of the cluster operation.
*
*
* @return
* Type of the cluster operation.
*
*/
public final String operationType() {
return operationType;
}
/**
*
*
* Information about cluster attributes before a cluster is updated.
*
*
* @return
* Information about cluster attributes before a cluster is updated.
*
*/
public final MutableClusterInfo sourceClusterInfo() {
return sourceClusterInfo;
}
/**
*
*
* Information about cluster attributes after a cluster is updated.
*
*
* @return
* Information about cluster attributes after a cluster is updated.
*
*/
public final MutableClusterInfo targetClusterInfo() {
return targetClusterInfo;
}
/**
*
*
* Description of the VPC connection for CreateVpcConnection and DeleteVpcConnection operations.
*
*
* @return
* Description of the VPC connection for CreateVpcConnection and DeleteVpcConnection operations.
*
*/
public final VpcConnectionInfo vpcConnectionInfo() {
return vpcConnectionInfo;
}
@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(clientRequestId());
hashCode = 31 * hashCode + Objects.hashCode(clusterArn());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
hashCode = 31 * hashCode + Objects.hashCode(errorInfo());
hashCode = 31 * hashCode + Objects.hashCode(operationArn());
hashCode = 31 * hashCode + Objects.hashCode(operationState());
hashCode = 31 * hashCode + Objects.hashCode(hasOperationSteps() ? operationSteps() : null);
hashCode = 31 * hashCode + Objects.hashCode(operationType());
hashCode = 31 * hashCode + Objects.hashCode(sourceClusterInfo());
hashCode = 31 * hashCode + Objects.hashCode(targetClusterInfo());
hashCode = 31 * hashCode + Objects.hashCode(vpcConnectionInfo());
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 ClusterOperationInfo)) {
return false;
}
ClusterOperationInfo other = (ClusterOperationInfo) obj;
return Objects.equals(clientRequestId(), other.clientRequestId()) && Objects.equals(clusterArn(), other.clusterArn())
&& Objects.equals(creationTime(), other.creationTime()) && Objects.equals(endTime(), other.endTime())
&& Objects.equals(errorInfo(), other.errorInfo()) && Objects.equals(operationArn(), other.operationArn())
&& Objects.equals(operationState(), other.operationState()) && hasOperationSteps() == other.hasOperationSteps()
&& Objects.equals(operationSteps(), other.operationSteps())
&& Objects.equals(operationType(), other.operationType())
&& Objects.equals(sourceClusterInfo(), other.sourceClusterInfo())
&& Objects.equals(targetClusterInfo(), other.targetClusterInfo())
&& Objects.equals(vpcConnectionInfo(), other.vpcConnectionInfo());
}
/**
* 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("ClusterOperationInfo").add("ClientRequestId", clientRequestId()).add("ClusterArn", clusterArn())
.add("CreationTime", creationTime()).add("EndTime", endTime()).add("ErrorInfo", errorInfo())
.add("OperationArn", operationArn()).add("OperationState", operationState())
.add("OperationSteps", hasOperationSteps() ? operationSteps() : null).add("OperationType", operationType())
.add("SourceClusterInfo", sourceClusterInfo()).add("TargetClusterInfo", targetClusterInfo())
.add("VpcConnectionInfo", vpcConnectionInfo()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ClientRequestId":
return Optional.ofNullable(clazz.cast(clientRequestId()));
case "ClusterArn":
return Optional.ofNullable(clazz.cast(clusterArn()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "EndTime":
return Optional.ofNullable(clazz.cast(endTime()));
case "ErrorInfo":
return Optional.ofNullable(clazz.cast(errorInfo()));
case "OperationArn":
return Optional.ofNullable(clazz.cast(operationArn()));
case "OperationState":
return Optional.ofNullable(clazz.cast(operationState()));
case "OperationSteps":
return Optional.ofNullable(clazz.cast(operationSteps()));
case "OperationType":
return Optional.ofNullable(clazz.cast(operationType()));
case "SourceClusterInfo":
return Optional.ofNullable(clazz.cast(sourceClusterInfo()));
case "TargetClusterInfo":
return Optional.ofNullable(clazz.cast(targetClusterInfo()));
case "VpcConnectionInfo":
return Optional.ofNullable(clazz.cast(vpcConnectionInfo()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function