createComputeQuota method

Future<CreateComputeQuotaResponse> createComputeQuota({
  1. required String clusterArn,
  2. required ComputeQuotaConfig computeQuotaConfig,
  3. required ComputeQuotaTarget computeQuotaTarget,
  4. required String name,
  5. ActivationState? activationState,
  6. String? description,
  7. List<Tag>? tags,
})

Create compute allocation definition. This defines how compute is allocated, shared, and borrowed for specified entities. Specifically, how to lend and borrow idle compute and assign a fair-share weight to the specified entities.

May throw ConflictException. May throw ResourceLimitExceeded.

Parameter clusterArn : ARN of the cluster.

Parameter computeQuotaConfig : Configuration of the compute allocation definition. This includes the resource sharing option, and the setting to preempt low priority tasks.

Parameter computeQuotaTarget : The target entity to allocate compute resources to.

Parameter name : Name to the compute allocation definition.

Parameter activationState : The state of the compute allocation being described. Use to enable or disable compute allocation.

Default is Enabled.

Parameter description : Description of the compute allocation definition.

Parameter tags : Tags of the compute allocation definition.

Implementation

Future<CreateComputeQuotaResponse> createComputeQuota({
  required String clusterArn,
  required ComputeQuotaConfig computeQuotaConfig,
  required ComputeQuotaTarget computeQuotaTarget,
  required String name,
  ActivationState? activationState,
  String? description,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.CreateComputeQuota'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ClusterArn': clusterArn,
      'ComputeQuotaConfig': computeQuotaConfig,
      'ComputeQuotaTarget': computeQuotaTarget,
      'Name': name,
      if (activationState != null) 'ActivationState': activationState.value,
      if (description != null) 'Description': description,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateComputeQuotaResponse.fromJson(jsonResponse.body);
}