createEndpoint method

Future<CreateEndpointResponse> createEndpoint({
  1. required int desiredInferenceUnits,
  2. required String endpointName,
  3. String? clientRequestToken,
  4. String? dataAccessRoleArn,
  5. String? flywheelArn,
  6. String? modelArn,
  7. List<Tag>? tags,
})

Creates a model-specific endpoint for synchronous inference for a previously trained custom model For information about endpoints, see Managing endpoints.

May throw InternalServerException. May throw InvalidRequestException. May throw ResourceInUseException. May throw ResourceLimitExceededException. May throw ResourceNotFoundException. May throw ResourceUnavailableException. May throw TooManyRequestsException. May throw TooManyTagsException.

Parameter desiredInferenceUnits : The desired number of inference units to be used by the model using this endpoint. Each inference unit represents of a throughput of 100 characters per second.

Parameter endpointName : This is the descriptive suffix that becomes part of the EndpointArn used for all subsequent requests to this resource.

Parameter clientRequestToken : An idempotency token provided by the customer. If this token matches a previous endpoint creation request, Amazon Comprehend will not return a ResourceInUseException.

Parameter dataAccessRoleArn : The Amazon Resource Name (ARN) of the IAM role that grants Amazon Comprehend read access to trained custom models encrypted with a customer managed key (ModelKmsKeyId).

Parameter flywheelArn : The Amazon Resource Number (ARN) of the flywheel to which the endpoint will be attached.

Parameter modelArn : The Amazon Resource Number (ARN) of the model to which the endpoint will be attached.

Parameter tags : Tags to associate with the endpoint. A tag is a key-value pair that adds metadata to the endpoint. For example, a tag with "Sales" as the key might be added to an endpoint to indicate its use by the sales department.

Implementation

Future<CreateEndpointResponse> createEndpoint({
  required int desiredInferenceUnits,
  required String endpointName,
  String? clientRequestToken,
  String? dataAccessRoleArn,
  String? flywheelArn,
  String? modelArn,
  List<Tag>? tags,
}) async {
  _s.validateNumRange(
    'desiredInferenceUnits',
    desiredInferenceUnits,
    1,
    1152921504606846976,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Comprehend_20171127.CreateEndpoint'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DesiredInferenceUnits': desiredInferenceUnits,
      'EndpointName': endpointName,
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
      if (dataAccessRoleArn != null) 'DataAccessRoleArn': dataAccessRoleArn,
      if (flywheelArn != null) 'FlywheelArn': flywheelArn,
      if (modelArn != null) 'ModelArn': modelArn,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateEndpointResponse.fromJson(jsonResponse.body);
}