createConnection method

Future<CreateConnectionResponse> createConnection({
  1. required ConnectionInput connectionInput,
  2. String? catalogId,
  3. Map<String, String>? tags,
})

Creates a connection definition in the Data Catalog.

Connections used for creating federated resources require the IAM glue:PassConnection permission.

May throw AlreadyExistsException. May throw GlueEncryptionException. May throw InvalidInputException. May throw OperationTimeoutException. May throw ResourceNumberLimitExceededException.

Parameter connectionInput : A ConnectionInput object defining the connection to create.

Parameter catalogId : The ID of the Data Catalog in which to create the connection. If none is provided, the Amazon Web Services account ID is used by default.

Parameter tags : The tags you assign to the connection.

Implementation

Future<CreateConnectionResponse> createConnection({
  required ConnectionInput connectionInput,
  String? catalogId,
  Map<String, String>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSGlue.CreateConnection'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ConnectionInput': connectionInput,
      if (catalogId != null) 'CatalogId': catalogId,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateConnectionResponse.fromJson(jsonResponse.body);
}