putKey method

Future<PutKeyResponse> putKey({
  1. required String ifMatch,
  2. required String key,
  3. required String kvsARN,
  4. required String value,
})

Creates a new key value pair or replaces the value of an existing key.

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 putting keys into, which you can get using DescribeKeyValueStore.

Parameter key : The key to put.

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

Parameter value : The value to put.

Implementation

Future<PutKeyResponse> putKey({
  required String ifMatch,
  required String key,
  required String kvsARN,
  required String value,
}) async {
  final headers = <String, String>{
    'If-Match': ifMatch.toString(),
  };
  final $payload = <String, dynamic>{
    'Value': value,
  };
  final response = await _protocol.sendRaw(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/key-value-stores/${Uri.encodeComponent(kvsARN)}/keys/${Uri.encodeComponent(key)}',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return PutKeyResponse(
    itemCount: ($json['ItemCount'] as int?) ?? 0,
    totalSizeInBytes: ($json['TotalSizeInBytes'] as int?) ?? 0,
    eTag: _s.extractHeaderStringValue(response.headers, 'ETag')!,
  );
}