Creates an Batch consumable resource.
Parameters:
-
consumable_resource_name
(Optional[String], default:
None
)
–
The name of the consumable resource. Must be unique.
-
total_quantity
(Optional[Long], default:
None
)
–
The total amount of the consumable resource that is available. Must be non-negative.
-
resource_type
(Optional[String], default:
None
)
–
Indicates whether the resource is available to be re-used after a job completes. Can be one of:
-
REPLENISHABLE (default)
-
NON_REPLENISHABLE
-
tags
(Optional[TagrisTagsMap], default:
None
)
–
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.
Raises:
-
ClientException
–
These errors are usually caused by a client action. One example cause is using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Another cause is specifying an identifier that's not valid.
-
ServerException
–
These errors are usually caused by a server issue.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
To create a consumable resource
Creates a Batch consumable resource.
>>> await client.create_consumable_resource(consumable_resource_name='myConsumableResource', total_quantity=123, resource_type='REPLENISHABLE', tags={'Department': 'Engineering', 'User': 'JaneDoe'})
Source code in docs_src/capo_batch/_services/async_batch.py
| async def create_consumable_resource(
self,
*,
config_overrides: Optional[AsyncBatchClientConfig] = None,
consumable_resource_name: Optional["capo_batch.types.string.String"] = None,
total_quantity: Optional["capo_batch.types.long.Long"] = None,
resource_type: Optional["capo_batch.types.string.String"] = None,
tags: Optional["capo_batch.types.tagris_tags_map.TagrisTagsMap"] = None,
) -> "capo_batch.types.create_consumable_resource_response.CreateConsumableResourceResponse":
"""<p>Creates an Batch consumable resource.</p>
Args:
consumable_resource_name: <p>The name of the consumable resource. Must be unique.</p>
total_quantity: <p>The total amount of the consumable resource that is available. Must be non-negative.</p>
resource_type: <p>Indicates whether the resource is available to be re-used after a job completes. Can be one of: </p> <ul> <li> <p> <code>REPLENISHABLE</code> (default)</p> </li> <li> <p> <code>NON_REPLENISHABLE</code> </p> </li> </ul>
tags: <p>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 <a href="https://docs.aws.amazon.com/batch/latest/userguide/using-tags.html">Tagging your Batch resources</a>.</p>
Raises:
capo_batch.errors.client_exception.ClientException: <p>These errors are usually caused by a client action. One example cause is using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Another cause is specifying an identifier that's not valid.</p>
capo_batch.errors.server_exception.ServerException: <p>These errors are usually caused by a server issue.</p>
capo_batch.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To create a consumable resource
Creates a Batch consumable resource.
>>> await client.create_consumable_resource(consumable_resource_name='myConsumableResource', total_quantity=123, resource_type='REPLENISHABLE', tags={'Department': 'Engineering', 'User': 'JaneDoe'})
"""
async def _handler(
req: "AsyncOperationRequest[capo_batch.types.create_consumable_resource_request.CreateConsumableResourceRequest]",
) -> AsyncOperationResponse[
"capo_batch.types.create_consumable_resource_response.CreateConsumableResourceResponse"
]:
import capo_batch._operations.aws_batch_v20160810.create_consumable_resource
(
output,
http_response,
) = await capo_batch._operations.aws_batch_v20160810.create_consumable_resource.async_create_consumable_resource(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateConsumableResource")
)
input_: capo_batch.types.create_consumable_resource_request.CreateConsumableResourceRequest = {}
if consumable_resource_name is not None:
input_["consumable_resource_name"] = consumable_resource_name
if total_quantity is not None:
input_["total_quantity"] = total_quantity
if resource_type is not None:
input_["resource_type"] = resource_type
if tags is not None:
input_["tags"] = tags
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|