createModelQualityJobDefinition method

Future<CreateModelQualityJobDefinitionResponse> createModelQualityJobDefinition({
  1. required String jobDefinitionName,
  2. required MonitoringResources jobResources,
  3. required ModelQualityAppSpecification modelQualityAppSpecification,
  4. required ModelQualityJobInput modelQualityJobInput,
  5. required MonitoringOutputConfig modelQualityJobOutputConfig,
  6. required String roleArn,
  7. ModelQualityBaselineConfig? modelQualityBaselineConfig,
  8. MonitoringNetworkConfig? networkConfig,
  9. MonitoringStoppingCondition? stoppingCondition,
  10. List<Tag>? tags,
})

Creates a definition for a job that monitors model quality and drift. For information about model monitor, see Amazon SageMaker Model Monitor.

May throw ResourceLimitExceeded. May throw ResourceInUse.

Parameter jobDefinitionName : The name of the monitoring job definition.

Parameter modelQualityAppSpecification : The container that runs the monitoring job.

Parameter modelQualityJobInput : A list of the inputs that are monitored. Currently endpoints are supported.

Parameter roleArn : The Amazon Resource Name (ARN) of an IAM role that Amazon SageMaker can assume to perform tasks on your behalf.

Parameter modelQualityBaselineConfig : Specifies the constraints and baselines for the monitoring job.

Parameter networkConfig : Specifies the network configuration for the monitoring job.

Parameter tags : (Optional) An array of key-value pairs. For more information, see Using Cost Allocation Tags in the AWS Billing and Cost Management User Guide.

Implementation

Future<CreateModelQualityJobDefinitionResponse>
    createModelQualityJobDefinition({
  required String jobDefinitionName,
  required MonitoringResources jobResources,
  required ModelQualityAppSpecification modelQualityAppSpecification,
  required ModelQualityJobInput modelQualityJobInput,
  required MonitoringOutputConfig modelQualityJobOutputConfig,
  required String roleArn,
  ModelQualityBaselineConfig? modelQualityBaselineConfig,
  MonitoringNetworkConfig? networkConfig,
  MonitoringStoppingCondition? stoppingCondition,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(jobDefinitionName, 'jobDefinitionName');
  _s.validateStringLength(
    'jobDefinitionName',
    jobDefinitionName,
    1,
    63,
    isRequired: true,
  );
  ArgumentError.checkNotNull(jobResources, 'jobResources');
  ArgumentError.checkNotNull(
      modelQualityAppSpecification, 'modelQualityAppSpecification');
  ArgumentError.checkNotNull(modelQualityJobInput, 'modelQualityJobInput');
  ArgumentError.checkNotNull(
      modelQualityJobOutputConfig, 'modelQualityJobOutputConfig');
  ArgumentError.checkNotNull(roleArn, 'roleArn');
  _s.validateStringLength(
    'roleArn',
    roleArn,
    20,
    2048,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.CreateModelQualityJobDefinition'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'JobDefinitionName': jobDefinitionName,
      'JobResources': jobResources,
      'ModelQualityAppSpecification': modelQualityAppSpecification,
      'ModelQualityJobInput': modelQualityJobInput,
      'ModelQualityJobOutputConfig': modelQualityJobOutputConfig,
      'RoleArn': roleArn,
      if (modelQualityBaselineConfig != null)
        'ModelQualityBaselineConfig': modelQualityBaselineConfig,
      if (networkConfig != null) 'NetworkConfig': networkConfig,
      if (stoppingCondition != null) 'StoppingCondition': stoppingCondition,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateModelQualityJobDefinitionResponse.fromJson(jsonResponse.body);
}