getSchemaByDefinition method
Retrieves a schema by the SchemaDefinition
. The schema
definition is sent to the Schema Registry, canonicalized, and hashed. If
the hash is matched within the scope of the SchemaName
or ARN
(or the default registry, if none is supplied), that schema’s metadata is
returned. Otherwise, a 404 or NotFound error is returned. Schema versions
in Deleted
statuses will not be included in the results.
May throw InvalidInputException. May throw AccessDeniedException. May throw EntityNotFoundException. May throw InternalServiceException.
Parameter schemaDefinition
:
The definition of the schema for which schema details are required.
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
orSchemaName
has to be provided. -
SchemaId$SchemaName: The name of the schema. One of
SchemaArn
orSchemaName
has to be provided.
Implementation
Future<GetSchemaByDefinitionResponse> getSchemaByDefinition({
required String schemaDefinition,
required SchemaId schemaId,
}) async {
ArgumentError.checkNotNull(schemaDefinition, 'schemaDefinition');
_s.validateStringLength(
'schemaDefinition',
schemaDefinition,
1,
170000,
isRequired: true,
);
ArgumentError.checkNotNull(schemaId, 'schemaId');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSGlue.GetSchemaByDefinition'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'SchemaDefinition': schemaDefinition,
'SchemaId': schemaId,
},
);
return GetSchemaByDefinitionResponse.fromJson(jsonResponse.body);
}