updateSchema method

Future<UpdateSchemaResponse> updateSchema({
  1. required SchemaId schemaId,
  2. Compatibility? compatibility,
  3. String? description,
  4. SchemaVersionNumber? schemaVersionNumber,
})

Updates the description, compatibility setting, or version checkpoint for a schema set.

For updating the compatibility setting, the call will not validate compatibility for the entire set of schema versions with the new compatibility setting. If the value for Compatibility is provided, the VersionNumber (a checkpoint) is also required. The API will validate the checkpoint version number for consistency.

If the value for the VersionNumber (checkpoint) is provided, Compatibility is optional and this can be used to set/reset a checkpoint for the schema.

This update will happen only if the schema is in the AVAILABLE state.

May throw InvalidInputException. May throw AccessDeniedException. May throw EntityNotFoundException. May throw ConcurrentModificationException. May throw InternalServiceException.

Parameter schemaId : This is a wrapper structure to contain schema identity fields. The structure contains:

  • SchemaId$SchemaArn: The Amazon Resource Name (ARN) of the schema. One of SchemaArn or SchemaName has to be provided.
  • SchemaId$SchemaName: The name of the schema. One of SchemaArn or SchemaName has to be provided.

Parameter compatibility : The new compatibility setting for the schema.

Parameter description : The new description for the schema.

Parameter schemaVersionNumber : Version number required for check pointing. One of VersionNumber or Compatibility has to be provided.

Implementation

Future<UpdateSchemaResponse> updateSchema({
  required SchemaId schemaId,
  Compatibility? compatibility,
  String? description,
  SchemaVersionNumber? schemaVersionNumber,
}) async {
  ArgumentError.checkNotNull(schemaId, 'schemaId');
  _s.validateStringLength(
    'description',
    description,
    0,
    2048,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSGlue.UpdateSchema'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'SchemaId': schemaId,
      if (compatibility != null) 'Compatibility': compatibility.toValue(),
      if (description != null) 'Description': description,
      if (schemaVersionNumber != null)
        'SchemaVersionNumber': schemaVersionNumber,
    },
  );

  return UpdateSchemaResponse.fromJson(jsonResponse.body);
}