Configures one or more gateway local disks as cache for a gateway. This operation is only supported in the cached volume, tape, and file gateway type (see How Storage Gateway works (architecture).
In the request, you specify the gateway Amazon Resource Name (ARN) to which you want to add cache, and one or more disk IDs that you want to configure as cache.
Parameters:
-
disk_ids
(DiskIds)
–
An array of strings that identify disks that are to be configured as working storage. Each string has a minimum length of 1 and maximum length of 300. You can get the disk IDs from the ListLocalDisks API.
Raises:
-
InternalServerError
–
An internal server error has occurred during the request. For more information, see the error and message fields.
-
InvalidGatewayRequestException
–
An exception occurred because an invalid gateway request was issued to the service. For more information, see the error and message fields.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
To add a cache
The following example shows a request that activates a gateway-stored volume.
>>> await client.add_cache(gateway_arn='arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B', disk_ids=['pci-0000:03:00.0-scsi-0:0:0:0', 'pci-0000:03:00.0-scsi-0:0:1:0'])
Source code in docs_src/capo_storage_gateway/_services/async_storage_gateway.py
| async def add_cache(
self,
gateway_arn: "capo_storage_gateway.types.gateway_arn.GatewayARN",
disk_ids: "capo_storage_gateway.types.disk_ids.DiskIds",
*,
config_overrides: Optional[AsyncStorageGatewayClientConfig] = None,
) -> "capo_storage_gateway.types.add_cache_output.AddCacheOutput":
"""<p>Configures one or more gateway local disks as cache for a gateway. This operation is only supported in the cached volume, tape, and file gateway type (see <a href="https://docs.aws.amazon.com/storagegateway/latest/userguide/StorageGatewayConcepts.html">How Storage Gateway works (architecture)</a>.</p> <p>In the request, you specify the gateway Amazon Resource Name (ARN) to which you want to add cache, and one or more disk IDs that you want to configure as cache.</p>
Args:
disk_ids: <p>An array of strings that identify disks that are to be configured as working storage. Each string has a minimum length of 1 and maximum length of 300. You can get the disk IDs from the <a>ListLocalDisks</a> API.</p>
Raises:
capo_storage_gateway.errors.internal_server_error.InternalServerError: <p>An internal server error has occurred during the request. For more information, see the error and message fields.</p>
capo_storage_gateway.errors.invalid_gateway_request_exception.InvalidGatewayRequestException: <p>An exception occurred because an invalid gateway request was issued to the service. For more information, see the error and message fields.</p>
capo_storage_gateway.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To add a cache
The following example shows a request that activates a gateway-stored volume.
>>> await client.add_cache(gateway_arn='arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B', disk_ids=['pci-0000:03:00.0-scsi-0:0:0:0', 'pci-0000:03:00.0-scsi-0:0:1:0'])
"""
async def _handler(
req: "AsyncOperationRequest[capo_storage_gateway.types.add_cache_input.AddCacheInput]",
) -> AsyncOperationResponse[
"capo_storage_gateway.types.add_cache_output.AddCacheOutput"
]:
import capo_storage_gateway._operations.storage_gateway_20130630.add_cache
(
output,
http_response,
) = await capo_storage_gateway._operations.storage_gateway_20130630.add_cache.async_add_cache(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("AddCache")
)
input_: capo_storage_gateway.types.add_cache_input.AddCacheInput = {
"gateway_arn": gateway_arn,
"disk_ids": disk_ids,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|