software.amazon.awssdk.services.kafkaconnect.model.ConnectorSummary Maven / Gradle / Ivy
Show all versions of kafkaconnect 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.kafkaconnect.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;
/**
*
* Summary of a connector.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ConnectorSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField CAPACITY_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("capacity")
.getter(getter(ConnectorSummary::capacity)).setter(setter(Builder::capacity))
.constructor(CapacityDescription::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("capacity").build()).build();
private static final SdkField CONNECTOR_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("connectorArn").getter(getter(ConnectorSummary::connectorArn)).setter(setter(Builder::connectorArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("connectorArn").build()).build();
private static final SdkField CONNECTOR_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("connectorDescription").getter(getter(ConnectorSummary::connectorDescription))
.setter(setter(Builder::connectorDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("connectorDescription").build())
.build();
private static final SdkField CONNECTOR_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("connectorName").getter(getter(ConnectorSummary::connectorName)).setter(setter(Builder::connectorName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("connectorName").build()).build();
private static final SdkField CONNECTOR_STATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("connectorState").getter(getter(ConnectorSummary::connectorStateAsString))
.setter(setter(Builder::connectorState))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("connectorState").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("creationTime")
.getter(getter(ConnectorSummary::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 CURRENT_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("currentVersion").getter(getter(ConnectorSummary::currentVersion))
.setter(setter(Builder::currentVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("currentVersion").build()).build();
private static final SdkField KAFKA_CLUSTER_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("kafkaCluster")
.getter(getter(ConnectorSummary::kafkaCluster)).setter(setter(Builder::kafkaCluster))
.constructor(KafkaClusterDescription::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("kafkaCluster").build()).build();
private static final SdkField KAFKA_CLUSTER_CLIENT_AUTHENTICATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("kafkaClusterClientAuthentication")
.getter(getter(ConnectorSummary::kafkaClusterClientAuthentication))
.setter(setter(Builder::kafkaClusterClientAuthentication))
.constructor(KafkaClusterClientAuthenticationDescription::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("kafkaClusterClientAuthentication")
.build()).build();
private static final SdkField KAFKA_CLUSTER_ENCRYPTION_IN_TRANSIT_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("kafkaClusterEncryptionInTransit")
.getter(getter(ConnectorSummary::kafkaClusterEncryptionInTransit))
.setter(setter(Builder::kafkaClusterEncryptionInTransit))
.constructor(KafkaClusterEncryptionInTransitDescription::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("kafkaClusterEncryptionInTransit")
.build()).build();
private static final SdkField KAFKA_CONNECT_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("kafkaConnectVersion").getter(getter(ConnectorSummary::kafkaConnectVersion))
.setter(setter(Builder::kafkaConnectVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("kafkaConnectVersion").build())
.build();
private static final SdkField LOG_DELIVERY_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("logDelivery")
.getter(getter(ConnectorSummary::logDelivery)).setter(setter(Builder::logDelivery))
.constructor(LogDeliveryDescription::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("logDelivery").build()).build();
private static final SdkField> PLUGINS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("plugins")
.getter(getter(ConnectorSummary::plugins))
.setter(setter(Builder::plugins))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("plugins").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(PluginDescription::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField SERVICE_EXECUTION_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("serviceExecutionRoleArn").getter(getter(ConnectorSummary::serviceExecutionRoleArn))
.setter(setter(Builder::serviceExecutionRoleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serviceExecutionRoleArn").build())
.build();
private static final SdkField WORKER_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("workerConfiguration")
.getter(getter(ConnectorSummary::workerConfiguration)).setter(setter(Builder::workerConfiguration))
.constructor(WorkerConfigurationDescription::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("workerConfiguration").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CAPACITY_FIELD,
CONNECTOR_ARN_FIELD, CONNECTOR_DESCRIPTION_FIELD, CONNECTOR_NAME_FIELD, CONNECTOR_STATE_FIELD, CREATION_TIME_FIELD,
CURRENT_VERSION_FIELD, KAFKA_CLUSTER_FIELD, KAFKA_CLUSTER_CLIENT_AUTHENTICATION_FIELD,
KAFKA_CLUSTER_ENCRYPTION_IN_TRANSIT_FIELD, KAFKA_CONNECT_VERSION_FIELD, LOG_DELIVERY_FIELD, PLUGINS_FIELD,
SERVICE_EXECUTION_ROLE_ARN_FIELD, WORKER_CONFIGURATION_FIELD));
private static final long serialVersionUID = 1L;
private final CapacityDescription capacity;
private final String connectorArn;
private final String connectorDescription;
private final String connectorName;
private final String connectorState;
private final Instant creationTime;
private final String currentVersion;
private final KafkaClusterDescription kafkaCluster;
private final KafkaClusterClientAuthenticationDescription kafkaClusterClientAuthentication;
private final KafkaClusterEncryptionInTransitDescription kafkaClusterEncryptionInTransit;
private final String kafkaConnectVersion;
private final LogDeliveryDescription logDelivery;
private final List plugins;
private final String serviceExecutionRoleArn;
private final WorkerConfigurationDescription workerConfiguration;
private ConnectorSummary(BuilderImpl builder) {
this.capacity = builder.capacity;
this.connectorArn = builder.connectorArn;
this.connectorDescription = builder.connectorDescription;
this.connectorName = builder.connectorName;
this.connectorState = builder.connectorState;
this.creationTime = builder.creationTime;
this.currentVersion = builder.currentVersion;
this.kafkaCluster = builder.kafkaCluster;
this.kafkaClusterClientAuthentication = builder.kafkaClusterClientAuthentication;
this.kafkaClusterEncryptionInTransit = builder.kafkaClusterEncryptionInTransit;
this.kafkaConnectVersion = builder.kafkaConnectVersion;
this.logDelivery = builder.logDelivery;
this.plugins = builder.plugins;
this.serviceExecutionRoleArn = builder.serviceExecutionRoleArn;
this.workerConfiguration = builder.workerConfiguration;
}
/**
*
* The connector's compute capacity settings.
*
*
* @return The connector's compute capacity settings.
*/
public final CapacityDescription capacity() {
return capacity;
}
/**
*
* The Amazon Resource Name (ARN) of the connector.
*
*
* @return The Amazon Resource Name (ARN) of the connector.
*/
public final String connectorArn() {
return connectorArn;
}
/**
*
* The description of the connector.
*
*
* @return The description of the connector.
*/
public final String connectorDescription() {
return connectorDescription;
}
/**
*
* The name of the connector.
*
*
* @return The name of the connector.
*/
public final String connectorName() {
return connectorName;
}
/**
*
* The state of the connector.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #connectorState}
* will return {@link ConnectorState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #connectorStateAsString}.
*
*
* @return The state of the connector.
* @see ConnectorState
*/
public final ConnectorState connectorState() {
return ConnectorState.fromValue(connectorState);
}
/**
*
* The state of the connector.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #connectorState}
* will return {@link ConnectorState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #connectorStateAsString}.
*
*
* @return The state of the connector.
* @see ConnectorState
*/
public final String connectorStateAsString() {
return connectorState;
}
/**
*
* The time that the connector was created.
*
*
* @return The time that the connector was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The current version of the connector.
*
*
* @return The current version of the connector.
*/
public final String currentVersion() {
return currentVersion;
}
/**
*
* The details of the Apache Kafka cluster to which the connector is connected.
*
*
* @return The details of the Apache Kafka cluster to which the connector is connected.
*/
public final KafkaClusterDescription kafkaCluster() {
return kafkaCluster;
}
/**
*
* The type of client authentication used to connect to the Apache Kafka cluster. The value is NONE when no client
* authentication is used.
*
*
* @return The type of client authentication used to connect to the Apache Kafka cluster. The value is NONE when no
* client authentication is used.
*/
public final KafkaClusterClientAuthenticationDescription kafkaClusterClientAuthentication() {
return kafkaClusterClientAuthentication;
}
/**
*
* Details of encryption in transit to the Apache Kafka cluster.
*
*
* @return Details of encryption in transit to the Apache Kafka cluster.
*/
public final KafkaClusterEncryptionInTransitDescription kafkaClusterEncryptionInTransit() {
return kafkaClusterEncryptionInTransit;
}
/**
*
* The version of Kafka Connect. It has to be compatible with both the Apache Kafka cluster's version and the
* plugins.
*
*
* @return The version of Kafka Connect. It has to be compatible with both the Apache Kafka cluster's version and
* the plugins.
*/
public final String kafkaConnectVersion() {
return kafkaConnectVersion;
}
/**
*
* The settings for delivering connector logs to Amazon CloudWatch Logs.
*
*
* @return The settings for delivering connector logs to Amazon CloudWatch Logs.
*/
public final LogDeliveryDescription logDelivery() {
return logDelivery;
}
/**
* For responses, this returns true if the service returned a value for the Plugins 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 hasPlugins() {
return plugins != null && !(plugins instanceof SdkAutoConstructList);
}
/**
*
* Specifies which plugins were used for this connector.
*
*
* 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 #hasPlugins} method.
*
*
* @return Specifies which plugins were used for this connector.
*/
public final List plugins() {
return plugins;
}
/**
*
* The Amazon Resource Name (ARN) of the IAM role used by the connector to access Amazon Web Services resources.
*
*
* @return The Amazon Resource Name (ARN) of the IAM role used by the connector to access Amazon Web Services
* resources.
*/
public final String serviceExecutionRoleArn() {
return serviceExecutionRoleArn;
}
/**
*
* The worker configurations that are in use with the connector.
*
*
* @return The worker configurations that are in use with the connector.
*/
public final WorkerConfigurationDescription workerConfiguration() {
return workerConfiguration;
}
@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(capacity());
hashCode = 31 * hashCode + Objects.hashCode(connectorArn());
hashCode = 31 * hashCode + Objects.hashCode(connectorDescription());
hashCode = 31 * hashCode + Objects.hashCode(connectorName());
hashCode = 31 * hashCode + Objects.hashCode(connectorStateAsString());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(currentVersion());
hashCode = 31 * hashCode + Objects.hashCode(kafkaCluster());
hashCode = 31 * hashCode + Objects.hashCode(kafkaClusterClientAuthentication());
hashCode = 31 * hashCode + Objects.hashCode(kafkaClusterEncryptionInTransit());
hashCode = 31 * hashCode + Objects.hashCode(kafkaConnectVersion());
hashCode = 31 * hashCode + Objects.hashCode(logDelivery());
hashCode = 31 * hashCode + Objects.hashCode(hasPlugins() ? plugins() : null);
hashCode = 31 * hashCode + Objects.hashCode(serviceExecutionRoleArn());
hashCode = 31 * hashCode + Objects.hashCode(workerConfiguration());
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 ConnectorSummary)) {
return false;
}
ConnectorSummary other = (ConnectorSummary) obj;
return Objects.equals(capacity(), other.capacity()) && Objects.equals(connectorArn(), other.connectorArn())
&& Objects.equals(connectorDescription(), other.connectorDescription())
&& Objects.equals(connectorName(), other.connectorName())
&& Objects.equals(connectorStateAsString(), other.connectorStateAsString())
&& Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(currentVersion(), other.currentVersion())
&& Objects.equals(kafkaCluster(), other.kafkaCluster())
&& Objects.equals(kafkaClusterClientAuthentication(), other.kafkaClusterClientAuthentication())
&& Objects.equals(kafkaClusterEncryptionInTransit(), other.kafkaClusterEncryptionInTransit())
&& Objects.equals(kafkaConnectVersion(), other.kafkaConnectVersion())
&& Objects.equals(logDelivery(), other.logDelivery()) && hasPlugins() == other.hasPlugins()
&& Objects.equals(plugins(), other.plugins())
&& Objects.equals(serviceExecutionRoleArn(), other.serviceExecutionRoleArn())
&& Objects.equals(workerConfiguration(), other.workerConfiguration());
}
/**
* 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("ConnectorSummary").add("Capacity", capacity()).add("ConnectorArn", connectorArn())
.add("ConnectorDescription", connectorDescription()).add("ConnectorName", connectorName())
.add("ConnectorState", connectorStateAsString()).add("CreationTime", creationTime())
.add("CurrentVersion", currentVersion()).add("KafkaCluster", kafkaCluster())
.add("KafkaClusterClientAuthentication", kafkaClusterClientAuthentication())
.add("KafkaClusterEncryptionInTransit", kafkaClusterEncryptionInTransit())
.add("KafkaConnectVersion", kafkaConnectVersion()).add("LogDelivery", logDelivery())
.add("Plugins", hasPlugins() ? plugins() : null).add("ServiceExecutionRoleArn", serviceExecutionRoleArn())
.add("WorkerConfiguration", workerConfiguration()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "capacity":
return Optional.ofNullable(clazz.cast(capacity()));
case "connectorArn":
return Optional.ofNullable(clazz.cast(connectorArn()));
case "connectorDescription":
return Optional.ofNullable(clazz.cast(connectorDescription()));
case "connectorName":
return Optional.ofNullable(clazz.cast(connectorName()));
case "connectorState":
return Optional.ofNullable(clazz.cast(connectorStateAsString()));
case "creationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "currentVersion":
return Optional.ofNullable(clazz.cast(currentVersion()));
case "kafkaCluster":
return Optional.ofNullable(clazz.cast(kafkaCluster()));
case "kafkaClusterClientAuthentication":
return Optional.ofNullable(clazz.cast(kafkaClusterClientAuthentication()));
case "kafkaClusterEncryptionInTransit":
return Optional.ofNullable(clazz.cast(kafkaClusterEncryptionInTransit()));
case "kafkaConnectVersion":
return Optional.ofNullable(clazz.cast(kafkaConnectVersion()));
case "logDelivery":
return Optional.ofNullable(clazz.cast(logDelivery()));
case "plugins":
return Optional.ofNullable(clazz.cast(plugins()));
case "serviceExecutionRoleArn":
return Optional.ofNullable(clazz.cast(serviceExecutionRoleArn()));
case "workerConfiguration":
return Optional.ofNullable(clazz.cast(workerConfiguration()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function