updateKeys method

Future<UpdateKeysResponse> updateKeys({
  1. required String ifMatch,
  2. required String kvsARN,
  3. List<DeleteKeyRequestListItem>? deletes,
  4. List<PutKeyRequestListItem>? puts,
})

Puts or Deletes multiple key value pairs in a single, all-or-nothing operation.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ValidationException.

Parameter ifMatch : The current version (ETag) of the Key Value Store that you are updating keys of, which you can get using DescribeKeyValueStore.

Parameter kvsARN : The Amazon Resource Name (ARN) of the Key Value Store.

Parameter deletes : List of keys to delete.

Parameter puts : List of key value pairs to put.

Implementation

Future<UpdateKeysResponse> updateKeys({
  required String ifMatch,
  required String kvsARN,
  List<DeleteKeyRequestListItem>? deletes,
  List<PutKeyRequestListItem>? puts,
}) async {
  final headers = <String, String>{
    'If-Match': ifMatch.toString(),
  };
  final $payload = <String, dynamic>{
    if (deletes != null) 'Deletes': deletes,
    if (puts != null) 'Puts': puts,
  };
  final response = await _protocol.sendRaw(
    payload: $payload,
    method: 'POST',
    requestUri: '/key-value-stores/${Uri.encodeComponent(kvsARN)}/keys',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return UpdateKeysResponse(
    itemCount: ($json['ItemCount'] as int?) ?? 0,
    totalSizeInBytes: ($json['TotalSizeInBytes'] as int?) ?? 0,
    eTag: _s.extractHeaderStringValue(response.headers, 'ETag')!,
  );
}