getConnection method

Future<GetConnectionResponse> getConnection({
  1. required String name,
  2. String? catalogId,
  3. bool? hidePassword,
})

Retrieves a connection definition from the Data Catalog.

May throw EntityNotFoundException. May throw OperationTimeoutException. May throw InvalidInputException. May throw GlueEncryptionException.

Parameter name : The name of the connection definition to retrieve.

Parameter catalogId : The ID of the Data Catalog in which the connection resides. If none is provided, the AWS account ID is used by default.

Parameter hidePassword : Allows you to retrieve the connection metadata without returning the password. For instance, the AWS Glue console uses this flag to retrieve the connection, and does not display the password. Set this parameter when the caller might not have permission to use the AWS KMS key to decrypt the password, but it does have permission to access the rest of the connection properties.

Implementation

Future<GetConnectionResponse> getConnection({
  required String name,
  String? catalogId,
  bool? hidePassword,
}) async {
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    255,
    isRequired: true,
  );
  _s.validateStringLength(
    'catalogId',
    catalogId,
    1,
    255,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSGlue.GetConnection'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Name': name,
      if (catalogId != null) 'CatalogId': catalogId,
      if (hidePassword != null) 'HidePassword': hidePassword,
    },
  );

  return GetConnectionResponse.fromJson(jsonResponse.body);
}