createProject method

Future<CreateProjectResponse> createProject({
  1. required String projectName,
  2. ProjectAutoUpdate? autoUpdate,
  3. CustomizationFeature? feature,
  4. Map<String, String>? tags,
})

Creates a new Amazon Rekognition project. A project is a group of resources (datasets, model versions) that you use to create and manage a Amazon Rekognition Custom Labels Model or custom adapter. You can specify a feature to create the project with, if no feature is specified then Custom Labels is used by default. For adapters, you can also choose whether or not to have the project auto update by using the AutoUpdate argument. This operation requires permissions to perform the rekognition:CreateProject action.

May throw AccessDeniedException. May throw InternalServerError. May throw InvalidParameterException. May throw LimitExceededException. May throw ProvisionedThroughputExceededException. May throw ResourceInUseException. May throw ThrottlingException.

Parameter projectName : The name of the project to create.

Parameter autoUpdate : Specifies whether automatic retraining should be attempted for the versions of the project. Automatic retraining is done as a best effort. Required argument for Content Moderation. Applicable only to adapters.

Parameter feature : Specifies feature that is being customized. If no value is provided CUSTOM_LABELS is used as a default.

Parameter tags : A set of tags (key-value pairs) that you want to attach to the project.

Implementation

Future<CreateProjectResponse> createProject({
  required String projectName,
  ProjectAutoUpdate? autoUpdate,
  CustomizationFeature? feature,
  Map<String, String>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'RekognitionService.CreateProject'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ProjectName': projectName,
      if (autoUpdate != null) 'AutoUpdate': autoUpdate.value,
      if (feature != null) 'Feature': feature.value,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateProjectResponse.fromJson(jsonResponse.body);
}