createConsumableResource method

Future<CreateConsumableResourceResponse> createConsumableResource({
  1. required String consumableResourceName,
  2. String? resourceType,
  3. Map<String, String>? tags,
  4. int? totalQuantity,
})

Creates an Batch consumable resource.

May throw ClientException. May throw ServerException.

Parameter consumableResourceName : The name of the consumable resource. Must be unique.

Parameter resourceType : Indicates whether the resource is available to be re-used after a job completes. Can be one of:

  • REPLENISHABLE (default)
  • NON_REPLENISHABLE

Parameter tags : The tags that you apply to the consumable resource to help you categorize and organize your resources. Each tag consists of a key and an optional value. For more information, see Tagging your Batch resources.

Parameter totalQuantity : The total amount of the consumable resource that is available. Must be non-negative.

Implementation

Future<CreateConsumableResourceResponse> createConsumableResource({
  required String consumableResourceName,
  String? resourceType,
  Map<String, String>? tags,
  int? totalQuantity,
}) async {
  final $payload = <String, dynamic>{
    'consumableResourceName': consumableResourceName,
    if (resourceType != null) 'resourceType': resourceType,
    if (tags != null) 'tags': tags,
    if (totalQuantity != null) 'totalQuantity': totalQuantity,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v1/createconsumableresource',
    exceptionFnMap: _exceptionFns,
  );
  return CreateConsumableResourceResponse.fromJson(response);
}