All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.glue.model.ConnectionInput Maven / Gradle / Ivy

/*
 * 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.glue.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
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.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.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* A structure that is used to specify a connection to create or update. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ConnectionInput implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(ConnectionInput::name)).setter(setter(Builder::name)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build(); private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(ConnectionInput::description)).setter(setter(Builder::description)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build(); private static final SdkField CONNECTION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(ConnectionInput::connectionTypeAsString)).setter(setter(Builder::connectionType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConnectionType").build()).build(); private static final SdkField> MATCH_CRITERIA_FIELD = SdkField .> builder(MarshallingType.LIST) .getter(getter(ConnectionInput::matchCriteria)) .setter(setter(Builder::matchCriteria)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MatchCriteria").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> CONNECTION_PROPERTIES_FIELD = SdkField .> builder(MarshallingType.MAP) .getter(getter(ConnectionInput::connectionPropertiesAsStrings)) .setter(setter(Builder::connectionPropertiesWithStrings)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConnectionProperties").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build()).build()).build()).build(); private static final SdkField PHYSICAL_CONNECTION_REQUIREMENTS_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .getter(getter(ConnectionInput::physicalConnectionRequirements)) .setter(setter(Builder::physicalConnectionRequirements)) .constructor(PhysicalConnectionRequirements::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PhysicalConnectionRequirements") .build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, DESCRIPTION_FIELD, CONNECTION_TYPE_FIELD, MATCH_CRITERIA_FIELD, CONNECTION_PROPERTIES_FIELD, PHYSICAL_CONNECTION_REQUIREMENTS_FIELD)); private static final long serialVersionUID = 1L; private final String name; private final String description; private final String connectionType; private final List matchCriteria; private final Map connectionProperties; private final PhysicalConnectionRequirements physicalConnectionRequirements; private ConnectionInput(BuilderImpl builder) { this.name = builder.name; this.description = builder.description; this.connectionType = builder.connectionType; this.matchCriteria = builder.matchCriteria; this.connectionProperties = builder.connectionProperties; this.physicalConnectionRequirements = builder.physicalConnectionRequirements; } /** *

* The name of the connection. *

* * @return The name of the connection. */ public String name() { return name; } /** *

* The description of the connection. *

* * @return The description of the connection. */ public String description() { return description; } /** *

* The type of the connection. Currently, these types are supported: *

*
    *
  • *

    * JDBC - Designates a connection to a database through Java Database Connectivity (JDBC). *

    *
  • *
  • *

    * MONGODB - Designates a connection to a MongoDB document database. *

    *
  • *
*

* SFTP is not supported. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #connectionType} * will return {@link ConnectionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #connectionTypeAsString}. *

* * @return The type of the connection. Currently, these types are supported:

*
    *
  • *

    * JDBC - Designates a connection to a database through Java Database Connectivity (JDBC). *

    *
  • *
  • *

    * MONGODB - Designates a connection to a MongoDB document database. *

    *
  • *
*

* SFTP is not supported. * @see ConnectionType */ public ConnectionType connectionType() { return ConnectionType.fromValue(connectionType); } /** *

* The type of the connection. Currently, these types are supported: *

*
    *
  • *

    * JDBC - Designates a connection to a database through Java Database Connectivity (JDBC). *

    *
  • *
  • *

    * MONGODB - Designates a connection to a MongoDB document database. *

    *
  • *
*

* SFTP is not supported. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #connectionType} * will return {@link ConnectionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #connectionTypeAsString}. *

* * @return The type of the connection. Currently, these types are supported:

*
    *
  • *

    * JDBC - Designates a connection to a database through Java Database Connectivity (JDBC). *

    *
  • *
  • *

    * MONGODB - Designates a connection to a MongoDB document database. *

    *
  • *
*

* SFTP is not supported. * @see ConnectionType */ public String connectionTypeAsString() { return connectionType; } /** * Returns true if the MatchCriteria property was specified by the sender (it may be empty), or false if the sender * did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public boolean hasMatchCriteria() { return matchCriteria != null && !(matchCriteria instanceof SdkAutoConstructList); } /** *

* A list of criteria that can be used in selecting this connection. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasMatchCriteria()} to see if a value was sent in this field. *

* * @return A list of criteria that can be used in selecting this connection. */ public List matchCriteria() { return matchCriteria; } /** *

* These key-value pairs define parameters for the connection. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasConnectionProperties()} to see if a value was sent in this field. *

* * @return These key-value pairs define parameters for the connection. */ public Map connectionProperties() { return ConnectionPropertiesCopier.copyStringToEnum(connectionProperties); } /** * Returns true if the ConnectionProperties property was specified by the sender (it may be empty), or false if the * sender did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS * service. */ public boolean hasConnectionProperties() { return connectionProperties != null && !(connectionProperties instanceof SdkAutoConstructMap); } /** *

* These key-value pairs define parameters for the connection. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasConnectionProperties()} to see if a value was sent in this field. *

* * @return These key-value pairs define parameters for the connection. */ public Map connectionPropertiesAsStrings() { return connectionProperties; } /** *

* A map of physical connection requirements, such as virtual private cloud (VPC) and SecurityGroup, * that are needed to successfully make this connection. *

* * @return A map of physical connection requirements, such as virtual private cloud (VPC) and * SecurityGroup, that are needed to successfully make this connection. */ public PhysicalConnectionRequirements physicalConnectionRequirements() { return physicalConnectionRequirements; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(connectionTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(matchCriteria()); hashCode = 31 * hashCode + Objects.hashCode(connectionPropertiesAsStrings()); hashCode = 31 * hashCode + Objects.hashCode(physicalConnectionRequirements()); return hashCode; } @Override public boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ConnectionInput)) { return false; } ConnectionInput other = (ConnectionInput) obj; return Objects.equals(name(), other.name()) && Objects.equals(description(), other.description()) && Objects.equals(connectionTypeAsString(), other.connectionTypeAsString()) && Objects.equals(matchCriteria(), other.matchCriteria()) && Objects.equals(connectionPropertiesAsStrings(), other.connectionPropertiesAsStrings()) && Objects.equals(physicalConnectionRequirements(), other.physicalConnectionRequirements()); } /** * 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 String toString() { return ToString.builder("ConnectionInput").add("Name", name()).add("Description", description()) .add("ConnectionType", connectionTypeAsString()).add("MatchCriteria", matchCriteria()) .add("ConnectionProperties", connectionPropertiesAsStrings()) .add("PhysicalConnectionRequirements", physicalConnectionRequirements()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Name": return Optional.ofNullable(clazz.cast(name())); case "Description": return Optional.ofNullable(clazz.cast(description())); case "ConnectionType": return Optional.ofNullable(clazz.cast(connectionTypeAsString())); case "MatchCriteria": return Optional.ofNullable(clazz.cast(matchCriteria())); case "ConnectionProperties": return Optional.ofNullable(clazz.cast(connectionPropertiesAsStrings())); case "PhysicalConnectionRequirements": return Optional.ofNullable(clazz.cast(physicalConnectionRequirements())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ConnectionInput) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the connection. *

* * @param name * The name of the connection. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

* The description of the connection. *

* * @param description * The description of the connection. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** *

* The type of the connection. Currently, these types are supported: *

*
    *
  • *

    * JDBC - Designates a connection to a database through Java Database Connectivity (JDBC). *

    *
  • *
  • *

    * MONGODB - Designates a connection to a MongoDB document database. *

    *
  • *
*

* SFTP is not supported. *

* * @param connectionType * The type of the connection. Currently, these types are supported:

*
    *
  • *

    * JDBC - Designates a connection to a database through Java Database Connectivity (JDBC). *

    *
  • *
  • *

    * MONGODB - Designates a connection to a MongoDB document database. *

    *
  • *
*

* SFTP is not supported. * @see ConnectionType * @return Returns a reference to this object so that method calls can be chained together. * @see ConnectionType */ Builder connectionType(String connectionType); /** *

* The type of the connection. Currently, these types are supported: *

*
    *
  • *

    * JDBC - Designates a connection to a database through Java Database Connectivity (JDBC). *

    *
  • *
  • *

    * MONGODB - Designates a connection to a MongoDB document database. *

    *
  • *
*

* SFTP is not supported. *

* * @param connectionType * The type of the connection. Currently, these types are supported:

*
    *
  • *

    * JDBC - Designates a connection to a database through Java Database Connectivity (JDBC). *

    *
  • *
  • *

    * MONGODB - Designates a connection to a MongoDB document database. *

    *
  • *
*

* SFTP is not supported. * @see ConnectionType * @return Returns a reference to this object so that method calls can be chained together. * @see ConnectionType */ Builder connectionType(ConnectionType connectionType); /** *

* A list of criteria that can be used in selecting this connection. *

* * @param matchCriteria * A list of criteria that can be used in selecting this connection. * @return Returns a reference to this object so that method calls can be chained together. */ Builder matchCriteria(Collection matchCriteria); /** *

* A list of criteria that can be used in selecting this connection. *

* * @param matchCriteria * A list of criteria that can be used in selecting this connection. * @return Returns a reference to this object so that method calls can be chained together. */ Builder matchCriteria(String... matchCriteria); /** *

* These key-value pairs define parameters for the connection. *

* * @param connectionProperties * These key-value pairs define parameters for the connection. * @return Returns a reference to this object so that method calls can be chained together. */ Builder connectionPropertiesWithStrings(Map connectionProperties); /** *

* These key-value pairs define parameters for the connection. *

* * @param connectionProperties * These key-value pairs define parameters for the connection. * @return Returns a reference to this object so that method calls can be chained together. */ Builder connectionProperties(Map connectionProperties); /** *

* A map of physical connection requirements, such as virtual private cloud (VPC) and SecurityGroup * , that are needed to successfully make this connection. *

* * @param physicalConnectionRequirements * A map of physical connection requirements, such as virtual private cloud (VPC) and * SecurityGroup, that are needed to successfully make this connection. * @return Returns a reference to this object so that method calls can be chained together. */ Builder physicalConnectionRequirements(PhysicalConnectionRequirements physicalConnectionRequirements); /** *

* A map of physical connection requirements, such as virtual private cloud (VPC) and SecurityGroup * , that are needed to successfully make this connection. *

* This is a convenience that creates an instance of the {@link PhysicalConnectionRequirements.Builder} avoiding * the need to create one manually via {@link PhysicalConnectionRequirements#builder()}. * * When the {@link Consumer} completes, {@link PhysicalConnectionRequirements.Builder#build()} is called * immediately and its result is passed to * {@link #physicalConnectionRequirements(PhysicalConnectionRequirements)}. * * @param physicalConnectionRequirements * a consumer that will call methods on {@link PhysicalConnectionRequirements.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #physicalConnectionRequirements(PhysicalConnectionRequirements) */ default Builder physicalConnectionRequirements( Consumer physicalConnectionRequirements) { return physicalConnectionRequirements(PhysicalConnectionRequirements.builder() .applyMutation(physicalConnectionRequirements).build()); } } static final class BuilderImpl implements Builder { private String name; private String description; private String connectionType; private List matchCriteria = DefaultSdkAutoConstructList.getInstance(); private Map connectionProperties = DefaultSdkAutoConstructMap.getInstance(); private PhysicalConnectionRequirements physicalConnectionRequirements; private BuilderImpl() { } private BuilderImpl(ConnectionInput model) { name(model.name); description(model.description); connectionType(model.connectionType); matchCriteria(model.matchCriteria); connectionPropertiesWithStrings(model.connectionProperties); physicalConnectionRequirements(model.physicalConnectionRequirements); } public final String getName() { return name; } @Override public final Builder name(String name) { this.name = name; return this; } public final void setName(String name) { this.name = name; } public final String getDescription() { return description; } @Override public final Builder description(String description) { this.description = description; return this; } public final void setDescription(String description) { this.description = description; } public final String getConnectionTypeAsString() { return connectionType; } @Override public final Builder connectionType(String connectionType) { this.connectionType = connectionType; return this; } @Override public final Builder connectionType(ConnectionType connectionType) { this.connectionType(connectionType == null ? null : connectionType.toString()); return this; } public final void setConnectionType(String connectionType) { this.connectionType = connectionType; } public final Collection getMatchCriteria() { return matchCriteria; } @Override public final Builder matchCriteria(Collection matchCriteria) { this.matchCriteria = MatchCriteriaCopier.copy(matchCriteria); return this; } @Override @SafeVarargs public final Builder matchCriteria(String... matchCriteria) { matchCriteria(Arrays.asList(matchCriteria)); return this; } public final void setMatchCriteria(Collection matchCriteria) { this.matchCriteria = MatchCriteriaCopier.copy(matchCriteria); } public final Map getConnectionPropertiesAsStrings() { return connectionProperties; } @Override public final Builder connectionPropertiesWithStrings(Map connectionProperties) { this.connectionProperties = ConnectionPropertiesCopier.copy(connectionProperties); return this; } @Override public final Builder connectionProperties(Map connectionProperties) { this.connectionProperties = ConnectionPropertiesCopier.copyEnumToString(connectionProperties); return this; } public final void setConnectionPropertiesWithStrings(Map connectionProperties) { this.connectionProperties = ConnectionPropertiesCopier.copy(connectionProperties); } public final PhysicalConnectionRequirements.Builder getPhysicalConnectionRequirements() { return physicalConnectionRequirements != null ? physicalConnectionRequirements.toBuilder() : null; } @Override public final Builder physicalConnectionRequirements(PhysicalConnectionRequirements physicalConnectionRequirements) { this.physicalConnectionRequirements = physicalConnectionRequirements; return this; } public final void setPhysicalConnectionRequirements( PhysicalConnectionRequirements.BuilderImpl physicalConnectionRequirements) { this.physicalConnectionRequirements = physicalConnectionRequirements != null ? physicalConnectionRequirements.build() : null; } @Override public ConnectionInput build() { return new ConnectionInput(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy