createModelBiasJobDefinition method

Future<CreateModelBiasJobDefinitionResponse> createModelBiasJobDefinition({
  1. required String jobDefinitionName,
  2. required MonitoringResources jobResources,
  3. required ModelBiasAppSpecification modelBiasAppSpecification,
  4. required ModelBiasJobInput modelBiasJobInput,
  5. required MonitoringOutputConfig modelBiasJobOutputConfig,
  6. required String roleArn,
  7. ModelBiasBaselineConfig? modelBiasBaselineConfig,
  8. MonitoringNetworkConfig? networkConfig,
  9. MonitoringStoppingCondition? stoppingCondition,
  10. List<Tag>? tags,
})

Creates the definition for a model bias job.

May throw ResourceLimitExceeded. May throw ResourceInUse.

Parameter jobDefinitionName : The name of the bias job definition. The name must be unique within an AWS Region in the AWS account.

Parameter modelBiasAppSpecification : Configures the model bias job to run a specified Docker container image.

Parameter modelBiasJobInput : Inputs for the model bias job.

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

Parameter modelBiasBaselineConfig : The baseline configuration for a model bias job.

Parameter networkConfig : Networking options for a model bias 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<CreateModelBiasJobDefinitionResponse> createModelBiasJobDefinition({
  required String jobDefinitionName,
  required MonitoringResources jobResources,
  required ModelBiasAppSpecification modelBiasAppSpecification,
  required ModelBiasJobInput modelBiasJobInput,
  required MonitoringOutputConfig modelBiasJobOutputConfig,
  required String roleArn,
  ModelBiasBaselineConfig? modelBiasBaselineConfig,
  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(
      modelBiasAppSpecification, 'modelBiasAppSpecification');
  ArgumentError.checkNotNull(modelBiasJobInput, 'modelBiasJobInput');
  ArgumentError.checkNotNull(
      modelBiasJobOutputConfig, 'modelBiasJobOutputConfig');
  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.CreateModelBiasJobDefinition'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'JobDefinitionName': jobDefinitionName,
      'JobResources': jobResources,
      'ModelBiasAppSpecification': modelBiasAppSpecification,
      'ModelBiasJobInput': modelBiasJobInput,
      'ModelBiasJobOutputConfig': modelBiasJobOutputConfig,
      'RoleArn': roleArn,
      if (modelBiasBaselineConfig != null)
        'ModelBiasBaselineConfig': modelBiasBaselineConfig,
      if (networkConfig != null) 'NetworkConfig': networkConfig,
      if (stoppingCondition != null) 'StoppingCondition': stoppingCondition,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateModelBiasJobDefinitionResponse.fromJson(jsonResponse.body);
}