createSchema method
Creates an Amazon Personalize schema from the specified schema string. The schema you create must be in Avro JSON format.
Amazon Personalize recognizes three schema variants. Each schema is associated with a dataset type and has a set of required field and keywords. You specify a schema when you call CreateDataset.
Related APIs
May throw InvalidInputException. May throw ResourceAlreadyExistsException. May throw LimitExceededException.
Parameter name
:
The name for the schema.
Parameter schema
:
A schema in Avro JSON format.
Implementation
Future<CreateSchemaResponse> createSchema({
required String name,
required String schema,
}) async {
ArgumentError.checkNotNull(name, 'name');
_s.validateStringLength(
'name',
name,
1,
63,
isRequired: true,
);
ArgumentError.checkNotNull(schema, 'schema');
_s.validateStringLength(
'schema',
schema,
0,
10000,
isRequired: true,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonPersonalize.CreateSchema'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'name': name,
'schema': schema,
},
);
return CreateSchemaResponse.fromJson(jsonResponse.body);
}