createModel method

Future<void> createModel({
  1. required String eventTypeName,
  2. required String modelId,
  3. required ModelTypeEnum modelType,
  4. String? description,
  5. List<Tag>? tags,
})

Creates a model using the specified model type.

May throw ValidationException. May throw InternalServerException. May throw AccessDeniedException.

Parameter eventTypeName : The name of the event type.

Parameter modelId : The model ID.

Parameter modelType : The model type.

Parameter description : The model description.

Parameter tags : A collection of key and value pairs.

Implementation

Future<void> createModel({
  required String eventTypeName,
  required String modelId,
  required ModelTypeEnum modelType,
  String? description,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(eventTypeName, 'eventTypeName');
  ArgumentError.checkNotNull(modelId, 'modelId');
  _s.validateStringLength(
    'modelId',
    modelId,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(modelType, 'modelType');
  _s.validateStringLength(
    'description',
    description,
    1,
    128,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSHawksNestServiceFacade.CreateModel'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'eventTypeName': eventTypeName,
      'modelId': modelId,
      'modelType': modelType.toValue(),
      if (description != null) 'description': description,
      if (tags != null) 'tags': tags,
    },
  );
}