Updates a consumable resource.
Parameters:
-
consumable_resource
(Optional[String], default:
None
)
–
The name or ARN of the consumable resource to be updated.
-
operation
(Optional[String], default:
None
)
–
Indicates how the quantity of the consumable resource will be updated. Must be one of:
-
SET
Sets the quantity of the resource to the value specified by the quantity parameter.
-
ADD
Increases the quantity of the resource by the value specified by the quantity parameter.
-
REMOVE
Reduces the quantity of the resource by the value specified by the quantity parameter.
-
quantity
(Optional[Long], default:
None
)
–
The change in the total quantity of the consumable resource. The operation parameter determines whether the value specified here will be the new total quantity, or the amount by which the total quantity will be increased or reduced. Must be a non-negative value.
-
client_token
(Optional[ClientRequestToken], default:
None
)
–
If this parameter is specified and two update requests with identical payloads and clientTokens are received, these requests are considered the same request. Both requests will succeed, but the update will only happen once. A clientToken is valid for 8 hours.
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 update a consumable resource
Updates a consumable resource.
>>> client.update_consumable_resource(consumable_resource='myConsumableResource', operation='ADD', quantity=12)
Source code in docs_src/capo_batch/_services/batch.py
| def update_consumable_resource(
self,
*,
config_overrides: Optional[BatchClientConfig] = None,
consumable_resource: Optional["capo_batch.types.string.String"] = None,
operation: Optional["capo_batch.types.string.String"] = None,
quantity: Optional["capo_batch.types.long.Long"] = None,
client_token: Optional[
"capo_batch.types.client_request_token.ClientRequestToken"
] = None,
) -> "capo_batch.types.update_consumable_resource_response.UpdateConsumableResourceResponse":
"""<p>Updates a consumable resource.</p>
Args:
consumable_resource: <p>The name or ARN of the consumable resource to be updated.</p>
operation: <p>Indicates how the quantity of the consumable resource will be updated. Must be one of:</p> <ul> <li> <p> <code>SET</code> </p> <p>Sets the quantity of the resource to the value specified by the <code>quantity</code> parameter.</p> </li> <li> <p> <code>ADD</code> </p> <p>Increases the quantity of the resource by the value specified by the <code>quantity</code> parameter.</p> </li> <li> <p> <code>REMOVE</code> </p> <p>Reduces the quantity of the resource by the value specified by the <code>quantity</code> parameter.</p> </li> </ul>
quantity: <p>The change in the total quantity of the consumable resource. The <code>operation</code> parameter determines whether the value specified here will be the new total quantity, or the amount by which the total quantity will be increased or reduced. Must be a non-negative value.</p>
client_token: <p>If this parameter is specified and two update requests with identical payloads and <code>clientToken</code>s are received, these requests are considered the same request. Both requests will succeed, but the update will only happen once. A <code>clientToken</code> is valid for 8 hours.</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 update a consumable resource
Updates a consumable resource.
>>> client.update_consumable_resource(consumable_resource='myConsumableResource', operation='ADD', quantity=12)
"""
def _handler(
req: "OperationRequest[capo_batch.types.update_consumable_resource_request.UpdateConsumableResourceRequest]",
) -> OperationResponse[
"capo_batch.types.update_consumable_resource_response.UpdateConsumableResourceResponse"
]:
import capo_batch._operations.aws_batch_v20160810.update_consumable_resource
output, http_response = (
capo_batch._operations.aws_batch_v20160810.update_consumable_resource.update_consumable_resource(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("UpdateConsumableResource")
)
input_: capo_batch.types.update_consumable_resource_request.UpdateConsumableResourceRequest = {}
if consumable_resource is not None:
input_["consumable_resource"] = consumable_resource
if operation is not None:
input_["operation"] = operation
if quantity is not None:
input_["quantity"] = quantity
if client_token is None:
client_token = str(uuid.uuid4())
input_["client_token"] = client_token
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|