software.amazon.awssdk.services.opensearch.model.CreateOutboundConnectionResponse Maven / Gradle / Ivy
Show all versions of opensearch 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.opensearch.model;
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 result of a CreateOutboundConnection
request. Contains details about the newly created cross-cluster
* connection.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateOutboundConnectionResponse extends OpenSearchResponse implements
ToCopyableBuilder {
private static final SdkField LOCAL_DOMAIN_INFO_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("LocalDomainInfo")
.getter(getter(CreateOutboundConnectionResponse::localDomainInfo)).setter(setter(Builder::localDomainInfo))
.constructor(DomainInformationContainer::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LocalDomainInfo").build()).build();
private static final SdkField REMOTE_DOMAIN_INFO_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("RemoteDomainInfo")
.getter(getter(CreateOutboundConnectionResponse::remoteDomainInfo)).setter(setter(Builder::remoteDomainInfo))
.constructor(DomainInformationContainer::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RemoteDomainInfo").build()).build();
private static final SdkField CONNECTION_ALIAS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ConnectionAlias").getter(getter(CreateOutboundConnectionResponse::connectionAlias))
.setter(setter(Builder::connectionAlias))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConnectionAlias").build()).build();
private static final SdkField CONNECTION_STATUS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ConnectionStatus")
.getter(getter(CreateOutboundConnectionResponse::connectionStatus)).setter(setter(Builder::connectionStatus))
.constructor(OutboundConnectionStatus::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConnectionStatus").build()).build();
private static final SdkField CONNECTION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ConnectionId").getter(getter(CreateOutboundConnectionResponse::connectionId))
.setter(setter(Builder::connectionId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConnectionId").build()).build();
private static final SdkField CONNECTION_MODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ConnectionMode").getter(getter(CreateOutboundConnectionResponse::connectionModeAsString))
.setter(setter(Builder::connectionMode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConnectionMode").build()).build();
private static final SdkField CONNECTION_PROPERTIES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ConnectionProperties")
.getter(getter(CreateOutboundConnectionResponse::connectionProperties)).setter(setter(Builder::connectionProperties))
.constructor(ConnectionProperties::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConnectionProperties").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(LOCAL_DOMAIN_INFO_FIELD,
REMOTE_DOMAIN_INFO_FIELD, CONNECTION_ALIAS_FIELD, CONNECTION_STATUS_FIELD, CONNECTION_ID_FIELD,
CONNECTION_MODE_FIELD, CONNECTION_PROPERTIES_FIELD));
private final DomainInformationContainer localDomainInfo;
private final DomainInformationContainer remoteDomainInfo;
private final String connectionAlias;
private final OutboundConnectionStatus connectionStatus;
private final String connectionId;
private final String connectionMode;
private final ConnectionProperties connectionProperties;
private CreateOutboundConnectionResponse(BuilderImpl builder) {
super(builder);
this.localDomainInfo = builder.localDomainInfo;
this.remoteDomainInfo = builder.remoteDomainInfo;
this.connectionAlias = builder.connectionAlias;
this.connectionStatus = builder.connectionStatus;
this.connectionId = builder.connectionId;
this.connectionMode = builder.connectionMode;
this.connectionProperties = builder.connectionProperties;
}
/**
*
* Information about the source (local) domain.
*
*
* @return Information about the source (local) domain.
*/
public final DomainInformationContainer localDomainInfo() {
return localDomainInfo;
}
/**
*
* Information about the destination (remote) domain.
*
*
* @return Information about the destination (remote) domain.
*/
public final DomainInformationContainer remoteDomainInfo() {
return remoteDomainInfo;
}
/**
*
* Name of the connection.
*
*
* @return Name of the connection.
*/
public final String connectionAlias() {
return connectionAlias;
}
/**
*
* The status of the connection.
*
*
* @return The status of the connection.
*/
public final OutboundConnectionStatus connectionStatus() {
return connectionStatus;
}
/**
*
* The unique identifier for the created outbound connection, which is used for subsequent operations on the
* connection.
*
*
* @return The unique identifier for the created outbound connection, which is used for subsequent operations on the
* connection.
*/
public final String connectionId() {
return connectionId;
}
/**
*
* The connection mode.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #connectionMode}
* will return {@link ConnectionMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #connectionModeAsString}.
*
*
* @return The connection mode.
* @see ConnectionMode
*/
public final ConnectionMode connectionMode() {
return ConnectionMode.fromValue(connectionMode);
}
/**
*
* The connection mode.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #connectionMode}
* will return {@link ConnectionMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #connectionModeAsString}.
*
*
* @return The connection mode.
* @see ConnectionMode
*/
public final String connectionModeAsString() {
return connectionMode;
}
/**
*
* The ConnectionProperties
for the newly created connection.
*
*
* @return The ConnectionProperties
for the newly created connection.
*/
public final ConnectionProperties connectionProperties() {
return connectionProperties;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(localDomainInfo());
hashCode = 31 * hashCode + Objects.hashCode(remoteDomainInfo());
hashCode = 31 * hashCode + Objects.hashCode(connectionAlias());
hashCode = 31 * hashCode + Objects.hashCode(connectionStatus());
hashCode = 31 * hashCode + Objects.hashCode(connectionId());
hashCode = 31 * hashCode + Objects.hashCode(connectionModeAsString());
hashCode = 31 * hashCode + Objects.hashCode(connectionProperties());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateOutboundConnectionResponse)) {
return false;
}
CreateOutboundConnectionResponse other = (CreateOutboundConnectionResponse) obj;
return Objects.equals(localDomainInfo(), other.localDomainInfo())
&& Objects.equals(remoteDomainInfo(), other.remoteDomainInfo())
&& Objects.equals(connectionAlias(), other.connectionAlias())
&& Objects.equals(connectionStatus(), other.connectionStatus())
&& Objects.equals(connectionId(), other.connectionId())
&& Objects.equals(connectionModeAsString(), other.connectionModeAsString())
&& Objects.equals(connectionProperties(), other.connectionProperties());
}
/**
* 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("CreateOutboundConnectionResponse").add("LocalDomainInfo", localDomainInfo())
.add("RemoteDomainInfo", remoteDomainInfo()).add("ConnectionAlias", connectionAlias())
.add("ConnectionStatus", connectionStatus()).add("ConnectionId", connectionId())
.add("ConnectionMode", connectionModeAsString()).add("ConnectionProperties", connectionProperties()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "LocalDomainInfo":
return Optional.ofNullable(clazz.cast(localDomainInfo()));
case "RemoteDomainInfo":
return Optional.ofNullable(clazz.cast(remoteDomainInfo()));
case "ConnectionAlias":
return Optional.ofNullable(clazz.cast(connectionAlias()));
case "ConnectionStatus":
return Optional.ofNullable(clazz.cast(connectionStatus()));
case "ConnectionId":
return Optional.ofNullable(clazz.cast(connectionId()));
case "ConnectionMode":
return Optional.ofNullable(clazz.cast(connectionModeAsString()));
case "ConnectionProperties":
return Optional.ofNullable(clazz.cast(connectionProperties()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function