createUserDefinedFunction method

Future<void> createUserDefinedFunction({
  1. required String databaseName,
  2. required UserDefinedFunctionInput functionInput,
  3. String? catalogId,
})

Creates a new function definition in the Data Catalog.

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

Parameter databaseName : The name of the catalog database in which to create the function.

Parameter functionInput : A FunctionInput object that defines the function to create in the Data Catalog.

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

Implementation

Future<void> createUserDefinedFunction({
  required String databaseName,
  required UserDefinedFunctionInput functionInput,
  String? catalogId,
}) async {
  ArgumentError.checkNotNull(databaseName, 'databaseName');
  _s.validateStringLength(
    'databaseName',
    databaseName,
    1,
    255,
    isRequired: true,
  );
  ArgumentError.checkNotNull(functionInput, 'functionInput');
  _s.validateStringLength(
    'catalogId',
    catalogId,
    1,
    255,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSGlue.CreateUserDefinedFunction'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DatabaseName': databaseName,
      'FunctionInput': functionInput,
      if (catalogId != null) 'CatalogId': catalogId,
    },
  );
}