feat(glue): Data Catalog connections (#3939)

* feat(glue): Data Catalog connections

Add CreateConnection, GetConnection, GetConnections, UpdateConnection,
DeleteConnection, BatchDeleteConnection and TestConnection. A connection
precedes every job and crawler in a Glue stack and Terraform reads it on
each plan, so without it a stack with an aws_glue_connection could not
get past its first plan.

Behaviour follows the Glue API reference: HidePassword omits PASSWORD
and ENCRYPTED_PASSWORD, UpdateConnection redefines the connection rather
than merging into it, ConnectionInput is validated against the documented
limits and enumerations, credentials are accepted and never returned,
and TestConnection accepts a well-formed request with an empty body
without opening a socket.

Closes #3938

* feat(glue): cap BatchDeleteConnection at 25 names and document HidePassword's scope

The API reference caps ConnectionNameList at 25 entries; a longer list
is now InvalidInputException. HidePassword's coverage of the Kafka
credential keys is not documented by AWS, so the docs page states that
Floci removes PASSWORD and ENCRYPTED_PASSWORD only.
This commit is contained in:
David authored and GitHub committed 2026-09-20 12:29:28 -04:00
1 parent 957542d172
commit a793776c1a
13 files changed
+1539 -2

No files matched your search

@@ -26,6 +26,7 @@ import java.util.Objects;
public class GlueJsonHandler {
private static final TypeReference<List<String>> STRING_LIST = new TypeReference<>() {};
private static final TypeReference<Map<String, String>> STRING_MAP = new TypeReference<>() {};
private static final TypeReference<List<Map<String, Object>>> MAP_LIST = new TypeReference<>() {};
private static final TypeReference<List<Partition>> PARTITION_LIST = new TypeReference<>() {};
@@ -285,6 +286,21 @@ public class GlueJsonHandler {
glueService.deleteCrawler(req.getName(), region);
yield Response.ok().build();
}
case "CreateConnection" -> handleCreateConnection(request, region);
case "GetConnection" -> handleGetConnection(request);
case "GetConnections" -> handleGetConnections(request);
case "UpdateConnection" -> handleUpdateConnection(request);
case "DeleteConnection" -> {
glueService.deleteConnection(request.path("ConnectionName").asText(null), region);
yield Response.ok(Map.of()).build();
}
case "BatchDeleteConnection" -> {
List<String> names = request.hasNonNull("ConnectionNameList")
? mapper.convertValue(request.get("ConnectionNameList"), STRING_LIST)
: null;
yield Response.ok(glueService.batchDeleteConnections(names, region)).build();
}
case "TestConnection" -> handleTestConnection(request);
// Read-only Glue actions for resources the emulator does not model. The AWS SDK
// expects each to return a 200 with its result key present (empty), so we emit the
// documented empty shape rather than an InvalidAction 400 that callers can't read.
@@ -858,6 +874,59 @@ public class GlueJsonHandler {
return Response.ok().build();
}
private Response handleCreateConnection(JsonNode request, String region) throws Exception {
ConnectionInput input = request.hasNonNull("ConnectionInput")
? mapper.treeToValue(request.get("ConnectionInput"), ConnectionInput.class)
: null;
Map<String, String> tags = request.hasNonNull("Tags")
? mapper.convertValue(request.get("Tags"), STRING_MAP)
: null;
String status = glueService.createConnection(input, tags, region);
return Response.ok(Map.of("CreateConnectionStatus", status)).build();
}
private Response handleGetConnection(JsonNode request) {
Connection connection = glueService.getConnection(
request.path("Name").asText(null), request.path("HidePassword").asBoolean(false));
return Response.ok(Map.of("Connection", connection)).build();
}
private Response handleGetConnections(JsonNode request) {
JsonNode filter = request.path("Filter");
List<String> matchCriteria = filter.hasNonNull("MatchCriteria")
? mapper.convertValue(filter.get("MatchCriteria"), STRING_LIST)
: null;
String connectionType = filter.path("ConnectionType").asText(null);
Integer schemaVersion = filter.hasNonNull("ConnectionSchemaVersion")
? filter.get("ConnectionSchemaVersion").asInt()
: null;
GlueService.Page<Connection> page = glueService.getConnections(
matchCriteria, connectionType, schemaVersion,
request.path("HidePassword").asBoolean(false),
readMaxResults(request), readNextToken(request));
return Response.ok(pageResponse("ConnectionList", page.items(), page.nextToken())).build();
}
private Response handleUpdateConnection(JsonNode request) throws Exception {
ConnectionInput input = request.hasNonNull("ConnectionInput")
? mapper.treeToValue(request.get("ConnectionInput"), ConnectionInput.class)
: null;
glueService.updateConnection(request.path("Name").asText(null), input);
return Response.ok(Map.of()).build();
}
private Response handleTestConnection(JsonNode request) {
JsonNode input = request.path("TestConnectionInput");
Map<String, String> properties = input.hasNonNull("ConnectionProperties")
? mapper.convertValue(input.get("ConnectionProperties"), STRING_MAP)
: null;
glueService.testConnection(
request.path("ConnectionName").asText(null),
input.path("ConnectionType").asText(null),
properties);
return Response.ok(Map.of()).build();
}
private Response handleGetTags(JsonNode request, String region) {
String arn = request.path("ResourceArn").asText(null);
Map<String, String> tags = glueService.getTags(arn, region);
@@ -8,6 +8,8 @@ import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.glue.model.Classifier;
import io.github.hectorvent.floci.services.glue.model.Column;
import io.github.hectorvent.floci.services.glue.model.Connection;
import io.github.hectorvent.floci.services.glue.model.ConnectionInput;
import io.github.hectorvent.floci.services.glue.model.Crawler;
import io.github.hectorvent.floci.services.glue.model.CrawlerTargets;
import io.github.hectorvent.floci.services.glue.model.Database;
@@ -72,6 +74,45 @@ public class GlueService {
/** Measured against real Glue (us-west-2): a fourth index reports the limit. */
private static final int MAX_PARTITION_INDEXES_PER_TABLE = 3;
// Connection limits and enumerations from the Glue API reference (ConnectionInput and the
// Connection structure). AWS rejects a value outside them with InvalidInputException.
private static final int MAX_CONNECTION_NAME_LENGTH = 255;
private static final int MAX_CONNECTION_DESCRIPTION_LENGTH = 2048;
private static final int MAX_CONNECTION_MATCH_CRITERIA = 10;
private static final int MAX_CONNECTION_PROPERTIES = 100;
private static final int MAX_BATCH_DELETE_CONNECTIONS = 25;
private static final Set<String> CONNECTION_TYPES = Set.of(
"JDBC", "SFTP", "MONGODB", "KAFKA", "NETWORK", "MARKETPLACE", "CUSTOM", "SALESFORCE",
"VIEW_VALIDATION_REDSHIFT", "VIEW_VALIDATION_ATHENA", "GOOGLEADS", "GOOGLESHEETS",
"GOOGLEANALYTICS4", "SERVICENOW", "MARKETO", "SAPODATA", "ZENDESK", "JIRACLOUD", "NETSUITEERP",
"HUBSPOT", "FACEBOOKADS", "INSTAGRAMADS", "ZOHOCRM", "SALESFORCEPARDOT",
"SALESFORCEMARKETINGCLOUD", "ADOBEANALYTICS", "SLACK", "LINKEDIN", "MIXPANEL", "ASANA", "STRIPE",
"SMARTSHEET", "DATADOG", "WOOCOMMERCE", "INTERCOM", "SNAPCHATADS", "PAYPAL", "QUICKBOOKS",
"FACEBOOKPAGEINSIGHTS", "FRESHDESK", "TWILIO", "DOCUSIGNMONITOR", "FRESHSALES", "ZOOM",
"GOOGLESEARCHCONSOLE", "SALESFORCECOMMERCECLOUD", "SAPCONCUR", "DYNATRACE",
"MICROSOFTDYNAMIC365FINANCEANDOPS", "MICROSOFTTEAMS", "BLACKBAUDRAISEREDGENXT", "MAILCHIMP",
"GITLAB", "PENDO", "PRODUCTBOARD", "CIRCLECI", "PIPEDIVE", "SENDGRID", "AZURECOSMOS", "AZURESQL",
"BIGQUERY", "BLACKBAUD", "CLOUDERAHIVE", "CLOUDERAIMPALA", "CLOUDWATCH", "CLOUDWATCHMETRICS",
"CMDB", "DATALAKEGEN2", "DB2", "DB2AS400", "DOCUMENTDB", "DOMO", "DYNAMODB",
"GOOGLECLOUDSTORAGE", "HBASE", "KUSTOMER", "MICROSOFTDYNAMICS365CRM", "MONDAY", "MYSQL", "OKTA",
"OPENSEARCH", "ORACLE", "PIPEDRIVE", "POSTGRESQL", "SAPHANA", "SQLSERVER", "SYNAPSE", "TERADATA",
"TERADATANOS", "TIMESTREAM", "TPCDS", "VERTICA");
private static final Set<String> CONNECTION_PROPERTY_KEYS = Set.of(
"HOST", "PORT", "USERNAME", "PASSWORD", "ENCRYPTED_PASSWORD", "JDBC_DRIVER_JAR_URI",
"JDBC_DRIVER_CLASS_NAME", "JDBC_ENGINE", "JDBC_ENGINE_VERSION", "CONFIG_FILES", "INSTANCE_ID",
"JDBC_CONNECTION_URL", "JDBC_ENFORCE_SSL", "CUSTOM_JDBC_CERT", "SKIP_CUSTOM_JDBC_CERT_VALIDATION",
"CUSTOM_JDBC_CERT_STRING", "CONNECTION_URL", "KAFKA_BOOTSTRAP_SERVERS", "KAFKA_SSL_ENABLED",
"KAFKA_CUSTOM_CERT", "KAFKA_SKIP_CUSTOM_CERT_VALIDATION", "KAFKA_CLIENT_KEYSTORE",
"KAFKA_CLIENT_KEYSTORE_PASSWORD", "KAFKA_CLIENT_KEY_PASSWORD",
"ENCRYPTED_KAFKA_CLIENT_KEYSTORE_PASSWORD", "ENCRYPTED_KAFKA_CLIENT_KEY_PASSWORD",
"KAFKA_SASL_MECHANISM", "KAFKA_SASL_PLAIN_USERNAME", "KAFKA_SASL_PLAIN_PASSWORD",
"ENCRYPTED_KAFKA_SASL_PLAIN_PASSWORD", "KAFKA_SASL_SCRAM_USERNAME", "KAFKA_SASL_SCRAM_PASSWORD",
"KAFKA_SASL_SCRAM_SECRETS_ARN", "ENCRYPTED_KAFKA_SASL_SCRAM_PASSWORD", "KAFKA_SASL_GSSAPI_KEYTAB",
"KAFKA_SASL_GSSAPI_KRB5_CONF", "KAFKA_SASL_GSSAPI_SERVICE", "KAFKA_SASL_GSSAPI_PRINCIPAL",
"SECRET_ID", "CONNECTOR_URL", "CONNECTOR_TYPE", "CONNECTOR_CLASS_NAME", "ENDPOINT",
"ENDPOINT_TYPE", "ROLE_ARN", "REGION", "WORKGROUP_NAME", "CLUSTER_IDENTIFIER", "DATABASE");
private static final String CONNECTION_STATUS_READY = "READY";
// Glue's partition index states. FAILED also exists but is only reachable through a backfill
// failure, which is not emulated.
private static final String INDEX_STATUS_CREATING = "CREATING";
@@ -89,6 +130,7 @@ public class GlueService {
private final StorageBackend<String, Job> jobStore;
private final StorageBackend<String, Crawler> crawlerStore;
private final StorageBackend<String, Classifier> classifierStore;
private final StorageBackend<String, Connection> connectionStore;
private final GlueSchemaRegistryService schemaRegistryService;
private final RegionResolver regionResolver;
private final ResourceGroupsTaggingService resourceGroupsTaggingService;
@@ -111,6 +153,7 @@ public class GlueService {
this.jobStore = storageFactory.create("glue", "jobs.json", new TypeReference<>() {});
this.crawlerStore = storageFactory.create("glue", "crawlers.json", new TypeReference<>() {});
this.classifierStore = storageFactory.create("glue", "classifiers.json", new TypeReference<>() {});
this.connectionStore = storageFactory.create("glue", "connections.json", new TypeReference<>() {});
this.schemaRegistryService = schemaRegistryService;
this.regionResolver = regionResolver;
this.resourceGroupsTaggingService = resourceGroupsTaggingService;
@@ -127,6 +170,7 @@ public class GlueService {
StorageBackend<String, Job> jobStore,
StorageBackend<String, Crawler> crawlerStore,
StorageBackend<String, Classifier> classifierStore,
StorageBackend<String, Connection> connectionStore,
GlueSchemaRegistryService schemaRegistryService,
RegionResolver regionResolver,
ResourceGroupsTaggingService resourceGroupsTaggingService) {
@@ -141,6 +185,7 @@ public class GlueService {
this.jobStore = jobStore;
this.crawlerStore = crawlerStore;
this.classifierStore = classifierStore;
this.connectionStore = connectionStore;
this.schemaRegistryService = schemaRegistryService;
this.regionResolver = regionResolver;
this.resourceGroupsTaggingService = resourceGroupsTaggingService;
@@ -1337,6 +1382,10 @@ public class GlueService {
return regionResolver.buildArn("glue", region, "job/" + jobName);
}
private String connectionArn(String region, String connectionName) {
return regionResolver.buildArn("glue", region, "connection/" + connectionName);
}
private String crawlerArn(String region, String crawlerName) {
return regionResolver.buildArn("glue", region, "crawler/" + crawlerName);
}
@@ -1891,6 +1940,202 @@ public class GlueService {
LOG.infov("Deleted Glue Crawler: {0}", name);
}
// ---- Connections -----------------------------------------------------------------------
public String createConnection(ConnectionInput input, Map<String, String> tags, String region) {
validateConnectionInput(input);
// Connections keep their case, as jobs and crawlers do: AWS matches the name exactly.
String name = input.getName();
if (connectionStore.get(name).isPresent()) {
throw new AwsException("AlreadyExistsException", "Connection " + name + " already exists.", 400);
}
Instant now = Instant.now();
Connection connection = toConnection(input);
connection.setCreationTime(now);
connection.setLastUpdatedTime(now);
connectionStore.put(name, connection);
if (tags != null && !tags.isEmpty()) {
resourceGroupsTaggingService.tagResources(List.of(connectionArn(region, name)), tags, region);
}
LOG.infov("Created Glue Connection: {0}", name);
// Nothing is validated against the data store, so there is no IN_PROGRESS phase to report.
return CONNECTION_STATUS_READY;
}
public Connection getConnection(String name, boolean hidePassword) {
validateRequired(name, "Name");
Connection connection = connectionStore.get(name)
.orElseThrow(() -> new AwsException("EntityNotFoundException", "Connection " + name + " not found.", 400));
return hidePassword ? connection.withoutPassword() : connection;
}
/**
* Lists connections, narrowed by the GetConnections filter: every {@code MatchCriteria}
* entry must appear on the connection, and {@code ConnectionType} and
* {@code ConnectionSchemaVersion} must match exactly when given.
*/
public Page<Connection> getConnections(List<String> matchCriteria, String connectionType,
Integer connectionSchemaVersion, boolean hidePassword,
Integer maxResults, String nextToken) {
List<Connection> matching = new ArrayList<>();
for (Connection connection : connectionStore.scan(k -> true)) {
if (matchCriteria != null && !matchCriteria.isEmpty()
&& (connection.getMatchCriteria() == null
|| !connection.getMatchCriteria().containsAll(matchCriteria))) {
continue;
}
if (connectionType != null && !connectionType.equals(connection.getConnectionType())) {
continue;
}
if (connectionSchemaVersion != null
&& !connectionSchemaVersion.equals(connection.getConnectionSchemaVersion())) {
continue;
}
matching.add(hidePassword ? connection.withoutPassword() : connection);
}
matching.sort(Comparator.comparing(Connection::getName));
return paginate(matching, maxResults, nextToken);
}
/**
* UpdateConnection takes a ConnectionInput that "redefines the connection in question"
* (API reference), so the stored definition is replaced rather than merged: a member left
* out of the input is gone afterwards. The connection keeps its name and creation time.
*/
public void updateConnection(String name, ConnectionInput input) {
validateRequired(name, "Name");
validateRequired(input, "ConnectionInput");
Connection existing = connectionStore.get(name)
.orElseThrow(() -> new AwsException("EntityNotFoundException", "Connection " + name + " not found.", 400));
validateConnectionInput(input);
Connection updated = toConnection(input);
updated.setName(existing.getName());
updated.setCreationTime(existing.getCreationTime());
updated.setLastUpdatedTime(Instant.now());
connectionStore.put(name, updated);
LOG.infov("Updated Glue Connection: {0}", name);
}
public void deleteConnection(String name, String region) {
validateRequired(name, "ConnectionName");
if (connectionStore.get(name).isEmpty()) {
throw new AwsException("EntityNotFoundException", "Connection " + name + " not found.", 400);
}
connectionStore.delete(name);
resourceGroupsTaggingService.deleteResources(List.of(connectionArn(region, name)), region);
LOG.infov("Deleted Glue Connection: {0}", name);
}
/** Deletes what it can; the names that could not be deleted come back keyed in the errors map. */
public BatchDeleteConnectionResult batchDeleteConnections(List<String> names, String region) {
validateRequired(names, "ConnectionNameList");
if (names.size() > MAX_BATCH_DELETE_CONNECTIONS) {
throw new AwsException("InvalidInputException",
"ConnectionNameList must have at most " + MAX_BATCH_DELETE_CONNECTIONS + " items.", 400);
}
List<String> succeeded = new ArrayList<>();
Map<String, ErrorDetail> errors = new LinkedHashMap<>();
for (String name : names) {
try {
deleteConnection(name, region);
succeeded.add(name);
} catch (AwsException e) {
errors.put(name, new ErrorDetail(e.getErrorCode(), e.getMessage()));
}
}
return new BatchDeleteConnectionResult(succeeded, errors);
}
/**
* TestConnection on AWS is asynchronous and answers with an empty body: the outcome is only
* visible later, on the connection's status. Floci never reaches the data store (no job can
* run against it yet), so the request is checked for shape and accepted. Either an existing
* connection is named, or an inline definition with a type and properties is given.
*/
public void testConnection(String connectionName, String connectionType,
Map<String, String> connectionProperties) {
if (connectionName != null && !connectionName.isBlank()) {
getConnection(connectionName, false);
return;
}
validateRequired(connectionType, "TestConnectionInput.ConnectionType");
validateConnectionType(connectionType);
validateRequired(connectionProperties, "TestConnectionInput.ConnectionProperties");
validateConnectionProperties(connectionProperties);
}
private Connection toConnection(ConnectionInput input) {
Connection connection = new Connection();
connection.setName(input.getName());
connection.setDescription(input.getDescription());
connection.setConnectionType(input.getConnectionType());
connection.setMatchCriteria(input.getMatchCriteria());
connection.setConnectionProperties(new LinkedHashMap<>(input.getConnectionProperties()));
connection.setSparkProperties(input.getSparkProperties());
connection.setAthenaProperties(input.getAthenaProperties());
connection.setPythonProperties(input.getPythonProperties());
connection.setPhysicalConnectionRequirements(input.getPhysicalConnectionRequirements());
if (input.getAuthenticationConfiguration() != null) {
connection.setAuthenticationConfiguration(input.getAuthenticationConfiguration().toOutput());
}
connection.setStatus(CONNECTION_STATUS_READY);
// Schema version 2 "supports properties for specific compute environments" (Connection
// structure). A definition that uses any of those members is a version 2 connection;
// the classic JDBC/Kafka/Network shape is version 1.
boolean usesComputeEnvironmentMembers = input.getAuthenticationConfiguration() != null
|| input.getSparkProperties() != null
|| input.getAthenaProperties() != null
|| input.getPythonProperties() != null;
connection.setConnectionSchemaVersion(usesComputeEnvironmentMembers ? 2 : 1);
return connection;
}
private void validateConnectionInput(ConnectionInput input) {
validateRequired(input, "ConnectionInput");
validateRequired(input.getName(), "ConnectionInput.Name");
if (input.getName().length() > MAX_CONNECTION_NAME_LENGTH) {
throw new AwsException("InvalidInputException",
"ConnectionInput.Name must be between 1 and " + MAX_CONNECTION_NAME_LENGTH + " characters.", 400);
}
validateRequired(input.getConnectionType(), "ConnectionInput.ConnectionType");
validateConnectionType(input.getConnectionType());
validateRequired(input.getConnectionProperties(), "ConnectionInput.ConnectionProperties");
validateConnectionProperties(input.getConnectionProperties());
if (input.getDescription() != null && input.getDescription().length() > MAX_CONNECTION_DESCRIPTION_LENGTH) {
throw new AwsException("InvalidInputException",
"ConnectionInput.Description must be at most " + MAX_CONNECTION_DESCRIPTION_LENGTH + " characters.", 400);
}
if (input.getMatchCriteria() != null && input.getMatchCriteria().size() > MAX_CONNECTION_MATCH_CRITERIA) {
throw new AwsException("InvalidInputException",
"ConnectionInput.MatchCriteria must have at most " + MAX_CONNECTION_MATCH_CRITERIA + " items.", 400);
}
}
private void validateConnectionType(String connectionType) {
if (!CONNECTION_TYPES.contains(connectionType)) {
throw new AwsException("InvalidInputException",
"Unsupported connection type: " + connectionType, 400);
}
}
private void validateConnectionProperties(Map<String, String> properties) {
if (properties.size() > MAX_CONNECTION_PROPERTIES) {
throw new AwsException("InvalidInputException",
"ConnectionProperties must have at most " + MAX_CONNECTION_PROPERTIES + " entries.", 400);
}
for (String key : properties.keySet()) {
if (!CONNECTION_PROPERTY_KEYS.contains(key)) {
throw new AwsException("InvalidInputException",
"Unsupported connection property key: " + key, 400);
}
}
}
@RegisterForReflection
public record BatchDeleteConnectionResult(
@JsonProperty("Succeeded") List<String> succeeded,
@JsonProperty("Errors") Map<String, ErrorDetail> errors) {}
public void tagResource(String arn, Map<String, String> tags, String region) {
validateArn(arn);
if (arn.contains(":registry/") || arn.contains(":schema/")) {
@@ -1937,6 +2182,9 @@ public class GlueService {
} else if (resource.startsWith("crawler/")) {
getCrawler(resource.substring(8));
return;
} else if (resource.startsWith("connection/")) {
getConnection(resource.substring(11), false);
return;
} else if (resource.startsWith("database/")) {
getDatabase(resource.substring(9));
return;
@@ -0,0 +1,65 @@
package io.github.hectorvent.floci.services.glue.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.Map;
/**
* How a connection authenticates. {@code BasicAuthenticationCredentials} and
* {@code CustomAuthenticationCredentials} are input-only on AWS: a Get never echoes a
* credential, so {@link #toOutput()} drops them along with the OAuth2 secrets.
*/
@RegisterForReflection
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AuthenticationConfiguration {
@JsonProperty("AuthenticationType")
private String authenticationType;
@JsonProperty("SecretArn")
private String secretArn;
@JsonProperty("KmsKeyArn")
private String kmsKeyArn;
@JsonProperty("OAuth2Properties")
private OAuth2Properties oAuth2Properties;
@JsonProperty("BasicAuthenticationCredentials")
private Map<String, String> basicAuthenticationCredentials;
@JsonProperty("CustomAuthenticationCredentials")
private Map<String, String> customAuthenticationCredentials;
public AuthenticationConfiguration toOutput() {
AuthenticationConfiguration output = new AuthenticationConfiguration();
output.authenticationType = authenticationType;
output.secretArn = secretArn;
output.kmsKeyArn = kmsKeyArn;
output.oAuth2Properties = oAuth2Properties == null ? null : oAuth2Properties.toOutput();
return output;
}
public String getAuthenticationType() { return authenticationType; }
public void setAuthenticationType(String authenticationType) { this.authenticationType = authenticationType; }
public String getSecretArn() { return secretArn; }
public void setSecretArn(String secretArn) { this.secretArn = secretArn; }
public String getKmsKeyArn() { return kmsKeyArn; }
public void setKmsKeyArn(String kmsKeyArn) { this.kmsKeyArn = kmsKeyArn; }
public OAuth2Properties getOAuth2Properties() { return oAuth2Properties; }
public void setOAuth2Properties(OAuth2Properties oAuth2Properties) { this.oAuth2Properties = oAuth2Properties; }
public Map<String, String> getBasicAuthenticationCredentials() { return basicAuthenticationCredentials; }
public void setBasicAuthenticationCredentials(Map<String, String> basicAuthenticationCredentials) {
this.basicAuthenticationCredentials = basicAuthenticationCredentials;
}
public Map<String, String> getCustomAuthenticationCredentials() { return customAuthenticationCredentials; }
public void setCustomAuthenticationCredentials(Map<String, String> customAuthenticationCredentials) {
this.customAuthenticationCredentials = customAuthenticationCredentials;
}
}
@@ -0,0 +1,183 @@
package io.github.hectorvent.floci.services.glue.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.time.Instant;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* A Data Catalog connection as GetConnection returns it: the caller's {@link ConnectionInput}
* plus the members the service owns (timestamps, status, schema version). Credentials never
* reach this shape; see {@link AuthenticationConfiguration#toOutput()}.
*/
@RegisterForReflection
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Connection {
@JsonProperty("Name")
private String name;
@JsonProperty("Description")
private String description;
@JsonProperty("ConnectionType")
private String connectionType;
@JsonProperty("MatchCriteria")
private List<String> matchCriteria;
@JsonProperty("ConnectionProperties")
private Map<String, String> connectionProperties;
@JsonProperty("SparkProperties")
private Map<String, String> sparkProperties;
@JsonProperty("AthenaProperties")
private Map<String, String> athenaProperties;
@JsonProperty("PythonProperties")
private Map<String, String> pythonProperties;
@JsonProperty("PhysicalConnectionRequirements")
private PhysicalConnectionRequirements physicalConnectionRequirements;
@JsonProperty("CreationTime")
@JsonFormat(shape = JsonFormat.Shape.NUMBER)
private Instant creationTime;
@JsonProperty("LastUpdatedTime")
@JsonFormat(shape = JsonFormat.Shape.NUMBER)
private Instant lastUpdatedTime;
@JsonProperty("LastUpdatedBy")
private String lastUpdatedBy;
@JsonProperty("Status")
private String status;
@JsonProperty("StatusReason")
private String statusReason;
@JsonProperty("LastConnectionValidationTime")
@JsonFormat(shape = JsonFormat.Shape.NUMBER)
private Instant lastConnectionValidationTime;
@JsonProperty("AuthenticationConfiguration")
private AuthenticationConfiguration authenticationConfiguration;
@JsonProperty("ConnectionSchemaVersion")
private Integer connectionSchemaVersion;
@JsonProperty("CompatibleComputeEnvironments")
private List<String> compatibleComputeEnvironments;
/**
* A copy with the password members of {@code ConnectionProperties} removed: what
* GetConnection and GetConnections return for {@code HidePassword=true}. The API reference
* names {@code PASSWORD} and {@code ENCRYPTED_PASSWORD} as the connection's password
* fields, the latter being the form stored under catalog password encryption.
*/
public Connection withoutPassword() {
Connection copy = copy();
if (connectionProperties != null) {
Map<String, String> visible = new LinkedHashMap<>(connectionProperties);
visible.remove("PASSWORD");
visible.remove("ENCRYPTED_PASSWORD");
copy.connectionProperties = visible;
}
return copy;
}
private Connection copy() {
Connection copy = new Connection();
copy.name = name;
copy.description = description;
copy.connectionType = connectionType;
copy.matchCriteria = matchCriteria;
copy.connectionProperties = connectionProperties;
copy.sparkProperties = sparkProperties;
copy.athenaProperties = athenaProperties;
copy.pythonProperties = pythonProperties;
copy.physicalConnectionRequirements = physicalConnectionRequirements;
copy.creationTime = creationTime;
copy.lastUpdatedTime = lastUpdatedTime;
copy.lastUpdatedBy = lastUpdatedBy;
copy.status = status;
copy.statusReason = statusReason;
copy.lastConnectionValidationTime = lastConnectionValidationTime;
copy.authenticationConfiguration = authenticationConfiguration;
copy.connectionSchemaVersion = connectionSchemaVersion;
copy.compatibleComputeEnvironments = compatibleComputeEnvironments;
return copy;
}
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
public String getConnectionType() { return connectionType; }
public void setConnectionType(String connectionType) { this.connectionType = connectionType; }
public List<String> getMatchCriteria() { return matchCriteria; }
public void setMatchCriteria(List<String> matchCriteria) { this.matchCriteria = matchCriteria; }
public Map<String, String> getConnectionProperties() { return connectionProperties; }
public void setConnectionProperties(Map<String, String> connectionProperties) {
this.connectionProperties = connectionProperties;
}
public Map<String, String> getSparkProperties() { return sparkProperties; }
public void setSparkProperties(Map<String, String> sparkProperties) { this.sparkProperties = sparkProperties; }
public Map<String, String> getAthenaProperties() { return athenaProperties; }
public void setAthenaProperties(Map<String, String> athenaProperties) { this.athenaProperties = athenaProperties; }
public Map<String, String> getPythonProperties() { return pythonProperties; }
public void setPythonProperties(Map<String, String> pythonProperties) { this.pythonProperties = pythonProperties; }
public PhysicalConnectionRequirements getPhysicalConnectionRequirements() { return physicalConnectionRequirements; }
public void setPhysicalConnectionRequirements(PhysicalConnectionRequirements physicalConnectionRequirements) {
this.physicalConnectionRequirements = physicalConnectionRequirements;
}
public Instant getCreationTime() { return creationTime; }
public void setCreationTime(Instant creationTime) { this.creationTime = creationTime; }
public Instant getLastUpdatedTime() { return lastUpdatedTime; }
public void setLastUpdatedTime(Instant lastUpdatedTime) { this.lastUpdatedTime = lastUpdatedTime; }
public String getLastUpdatedBy() { return lastUpdatedBy; }
public void setLastUpdatedBy(String lastUpdatedBy) { this.lastUpdatedBy = lastUpdatedBy; }
public String getStatus() { return status; }
public void setStatus(String status) { this.status = status; }
public String getStatusReason() { return statusReason; }
public void setStatusReason(String statusReason) { this.statusReason = statusReason; }
public Instant getLastConnectionValidationTime() { return lastConnectionValidationTime; }
public void setLastConnectionValidationTime(Instant lastConnectionValidationTime) {
this.lastConnectionValidationTime = lastConnectionValidationTime;
}
public AuthenticationConfiguration getAuthenticationConfiguration() { return authenticationConfiguration; }
public void setAuthenticationConfiguration(AuthenticationConfiguration authenticationConfiguration) {
this.authenticationConfiguration = authenticationConfiguration;
}
public Integer getConnectionSchemaVersion() { return connectionSchemaVersion; }
public void setConnectionSchemaVersion(Integer connectionSchemaVersion) {
this.connectionSchemaVersion = connectionSchemaVersion;
}
public List<String> getCompatibleComputeEnvironments() { return compatibleComputeEnvironments; }
public void setCompatibleComputeEnvironments(List<String> compatibleComputeEnvironments) {
this.compatibleComputeEnvironments = compatibleComputeEnvironments;
}
}
@@ -0,0 +1,95 @@
package io.github.hectorvent.floci.services.glue.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import java.util.Map;
/**
* The {@code ConnectionInput} structure of CreateConnection and UpdateConnection: the caller's
* full definition of a connection. On Update it redefines the connection rather than patching
* it, which is why it carries the required members again instead of an optional subset.
*/
@RegisterForReflection
public class ConnectionInput {
@JsonProperty("Name")
private String name;
@JsonProperty("Description")
private String description;
@JsonProperty("ConnectionType")
private String connectionType;
@JsonProperty("MatchCriteria")
private List<String> matchCriteria;
@JsonProperty("ConnectionProperties")
private Map<String, String> connectionProperties;
@JsonProperty("SparkProperties")
private Map<String, String> sparkProperties;
@JsonProperty("AthenaProperties")
private Map<String, String> athenaProperties;
@JsonProperty("PythonProperties")
private Map<String, String> pythonProperties;
@JsonProperty("PhysicalConnectionRequirements")
private PhysicalConnectionRequirements physicalConnectionRequirements;
@JsonProperty("AuthenticationConfiguration")
private AuthenticationConfiguration authenticationConfiguration;
@JsonProperty("ValidateCredentials")
private Boolean validateCredentials;
@JsonProperty("ValidateForComputeEnvironments")
private List<String> validateForComputeEnvironments;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
public String getConnectionType() { return connectionType; }
public void setConnectionType(String connectionType) { this.connectionType = connectionType; }
public List<String> getMatchCriteria() { return matchCriteria; }
public void setMatchCriteria(List<String> matchCriteria) { this.matchCriteria = matchCriteria; }
public Map<String, String> getConnectionProperties() { return connectionProperties; }
public void setConnectionProperties(Map<String, String> connectionProperties) {
this.connectionProperties = connectionProperties;
}
public Map<String, String> getSparkProperties() { return sparkProperties; }
public void setSparkProperties(Map<String, String> sparkProperties) { this.sparkProperties = sparkProperties; }
public Map<String, String> getAthenaProperties() { return athenaProperties; }
public void setAthenaProperties(Map<String, String> athenaProperties) { this.athenaProperties = athenaProperties; }
public Map<String, String> getPythonProperties() { return pythonProperties; }
public void setPythonProperties(Map<String, String> pythonProperties) { this.pythonProperties = pythonProperties; }
public PhysicalConnectionRequirements getPhysicalConnectionRequirements() { return physicalConnectionRequirements; }
public void setPhysicalConnectionRequirements(PhysicalConnectionRequirements physicalConnectionRequirements) {
this.physicalConnectionRequirements = physicalConnectionRequirements;
}
public AuthenticationConfiguration getAuthenticationConfiguration() { return authenticationConfiguration; }
public void setAuthenticationConfiguration(AuthenticationConfiguration authenticationConfiguration) {
this.authenticationConfiguration = authenticationConfiguration;
}
public Boolean getValidateCredentials() { return validateCredentials; }
public void setValidateCredentials(Boolean validateCredentials) { this.validateCredentials = validateCredentials; }
public List<String> getValidateForComputeEnvironments() { return validateForComputeEnvironments; }
public void setValidateForComputeEnvironments(List<String> validateForComputeEnvironments) {
this.validateForComputeEnvironments = validateForComputeEnvironments;
}
}
@@ -0,0 +1,25 @@
package io.github.hectorvent.floci.services.glue.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.quarkus.runtime.annotations.RegisterForReflection;
@RegisterForReflection
@JsonInclude(JsonInclude.Include.NON_NULL)
public class OAuth2ClientApplication {
@JsonProperty("UserManagedClientApplicationClientId")
private String userManagedClientApplicationClientId;
@JsonProperty("AWSManagedClientApplicationReference")
private String awsManagedClientApplicationReference;
public String getUserManagedClientApplicationClientId() { return userManagedClientApplicationClientId; }
public void setUserManagedClientApplicationClientId(String userManagedClientApplicationClientId) {
this.userManagedClientApplicationClientId = userManagedClientApplicationClientId;
}
public String getAwsManagedClientApplicationReference() { return awsManagedClientApplicationReference; }
public void setAwsManagedClientApplicationReference(String awsManagedClientApplicationReference) {
this.awsManagedClientApplicationReference = awsManagedClientApplicationReference;
}
}
@@ -0,0 +1,69 @@
package io.github.hectorvent.floci.services.glue.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonNode;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.Map;
/**
* OAuth2 settings of a connection. The two credential-bearing members,
* {@code AuthorizationCodeProperties} and {@code OAuth2Credentials}, exist only on the input
* shape: AWS accepts them on Create and Update and never returns them, so {@link Connection}
* is built through {@link #toOutput()}, which leaves them behind.
*/
@RegisterForReflection
@JsonInclude(JsonInclude.Include.NON_NULL)
public class OAuth2Properties {
@JsonProperty("OAuth2GrantType")
private String oAuth2GrantType;
@JsonProperty("OAuth2ClientApplication")
private OAuth2ClientApplication oAuth2ClientApplication;
@JsonProperty("TokenUrl")
private String tokenUrl;
@JsonProperty("TokenUrlParametersMap")
private Map<String, String> tokenUrlParametersMap;
@JsonProperty("AuthorizationCodeProperties")
private JsonNode authorizationCodeProperties;
@JsonProperty("OAuth2Credentials")
private JsonNode oAuth2Credentials;
public OAuth2Properties toOutput() {
OAuth2Properties output = new OAuth2Properties();
output.oAuth2GrantType = oAuth2GrantType;
output.oAuth2ClientApplication = oAuth2ClientApplication;
output.tokenUrl = tokenUrl;
output.tokenUrlParametersMap = tokenUrlParametersMap;
return output;
}
public String getOAuth2GrantType() { return oAuth2GrantType; }
public void setOAuth2GrantType(String oAuth2GrantType) { this.oAuth2GrantType = oAuth2GrantType; }
public OAuth2ClientApplication getOAuth2ClientApplication() { return oAuth2ClientApplication; }
public void setOAuth2ClientApplication(OAuth2ClientApplication oAuth2ClientApplication) {
this.oAuth2ClientApplication = oAuth2ClientApplication;
}
public String getTokenUrl() { return tokenUrl; }
public void setTokenUrl(String tokenUrl) { this.tokenUrl = tokenUrl; }
public Map<String, String> getTokenUrlParametersMap() { return tokenUrlParametersMap; }
public void setTokenUrlParametersMap(Map<String, String> tokenUrlParametersMap) {
this.tokenUrlParametersMap = tokenUrlParametersMap;
}
public JsonNode getAuthorizationCodeProperties() { return authorizationCodeProperties; }
public void setAuthorizationCodeProperties(JsonNode authorizationCodeProperties) {
this.authorizationCodeProperties = authorizationCodeProperties;
}
public JsonNode getOAuth2Credentials() { return oAuth2Credentials; }
public void setOAuth2Credentials(JsonNode oAuth2Credentials) { this.oAuth2Credentials = oAuth2Credentials; }
}
@@ -0,0 +1,30 @@
package io.github.hectorvent.floci.services.glue.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
/** The VPC placement a job or crawler needs to reach a connection's data store. */
@RegisterForReflection
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PhysicalConnectionRequirements {
@JsonProperty("SubnetId")
private String subnetId;
@JsonProperty("SecurityGroupIdList")
private List<String> securityGroupIdList;
@JsonProperty("AvailabilityZone")
private String availabilityZone;
public String getSubnetId() { return subnetId; }
public void setSubnetId(String subnetId) { this.subnetId = subnetId; }
public List<String> getSecurityGroupIdList() { return securityGroupIdList; }
public void setSecurityGroupIdList(List<String> securityGroupIdList) { this.securityGroupIdList = securityGroupIdList; }
public String getAvailabilityZone() { return availabilityZone; }
public void setAvailabilityZone(String availabilityZone) { this.availabilityZone = availabilityZone; }
}