addCache method

Future<AddCacheOutput> addCache({
  1. required List<String> diskIds,
  2. required String gatewayARN,
})

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 AWS 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.

May throw InvalidGatewayRequestException. May throw InternalServerError.

Parameter 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.

Implementation

Future<AddCacheOutput> addCache({
  required List<String> diskIds,
  required String gatewayARN,
}) async {
  ArgumentError.checkNotNull(diskIds, 'diskIds');
  ArgumentError.checkNotNull(gatewayARN, 'gatewayARN');
  _s.validateStringLength(
    'gatewayARN',
    gatewayARN,
    50,
    500,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'StorageGateway_20130630.AddCache'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DiskIds': diskIds,
      'GatewayARN': gatewayARN,
    },
  );

  return AddCacheOutput.fromJson(jsonResponse.body);
}