software.amazon.awssdk.services.opensearch.model.CreateOutboundConnectionRequest 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.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 software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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;
/**
*
* Container for the parameters to the CreateOutboundConnection
operation.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateOutboundConnectionRequest extends OpenSearchRequest implements
ToCopyableBuilder {
private static final SdkField LOCAL_DOMAIN_INFO_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("LocalDomainInfo")
.getter(getter(CreateOutboundConnectionRequest::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(CreateOutboundConnectionRequest::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(CreateOutboundConnectionRequest::connectionAlias))
.setter(setter(Builder::connectionAlias))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConnectionAlias").build()).build();
private static final SdkField CONNECTION_MODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ConnectionMode").getter(getter(CreateOutboundConnectionRequest::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(CreateOutboundConnectionRequest::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_MODE_FIELD, CONNECTION_PROPERTIES_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private final DomainInformationContainer localDomainInfo;
private final DomainInformationContainer remoteDomainInfo;
private final String connectionAlias;
private final String connectionMode;
private final ConnectionProperties connectionProperties;
private CreateOutboundConnectionRequest(BuilderImpl builder) {
super(builder);
this.localDomainInfo = builder.localDomainInfo;
this.remoteDomainInfo = builder.remoteDomainInfo;
this.connectionAlias = builder.connectionAlias;
this.connectionMode = builder.connectionMode;
this.connectionProperties = builder.connectionProperties;
}
/**
*
* Name and Region of the source (local) domain.
*
*
* @return Name and Region of the source (local) domain.
*/
public final DomainInformationContainer localDomainInfo() {
return localDomainInfo;
}
/**
*
* Name and Region of the destination (remote) domain.
*
*
* @return Name and Region of 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 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 outbound connection.
*
*
* @return The ConnectionProperties
for the outbound 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(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 CreateOutboundConnectionRequest)) {
return false;
}
CreateOutboundConnectionRequest other = (CreateOutboundConnectionRequest) obj;
return Objects.equals(localDomainInfo(), other.localDomainInfo())
&& Objects.equals(remoteDomainInfo(), other.remoteDomainInfo())
&& Objects.equals(connectionAlias(), other.connectionAlias())
&& 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("CreateOutboundConnectionRequest").add("LocalDomainInfo", localDomainInfo())
.add("RemoteDomainInfo", remoteDomainInfo()).add("ConnectionAlias", connectionAlias())
.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 "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;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("LocalDomainInfo", LOCAL_DOMAIN_INFO_FIELD);
map.put("RemoteDomainInfo", REMOTE_DOMAIN_INFO_FIELD);
map.put("ConnectionAlias", CONNECTION_ALIAS_FIELD);
map.put("ConnectionMode", CONNECTION_MODE_FIELD);
map.put("ConnectionProperties", CONNECTION_PROPERTIES_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function