Skip to content

update_keys

update_keys(
    kvs_arn: KvsARN,
    if_match: Etag,
    *,
    config_overrides: Optional[CloudFrontKeyValueStoreClientConfig] = None,
    puts: Optional[PutKeyRequestsList] = None,
    deletes: Optional[DeleteKeyRequestsList] = None,
) -> UpdateKeysResponse

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

Parameters:

  • kvs_arn (KvsARN) –

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

  • if_match (Etag) –

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

  • puts (Optional[PutKeyRequestsList], default: None ) –

    List of key value pairs to put.

  • deletes (Optional[DeleteKeyRequestsList], default: None ) –

    List of keys to delete.

Raises:

Examples:

Put 2 keys into the key value store with ARN 'arn:aws:cloudfront::123456789012:key-value-store/327284aa-bcd5-499f-a3ff-26b9a9d31b58'

>>> client.update_keys(kvs_arn='arn:aws:cloudfront::123456789012:key-value-store/327284aa-bcd5-499f-a3ff-26b9a9d31b58', if_match='KV0AB12C3DEF456', puts=[{'Key': 'key1', 'Value': 'value1'}, {'Key': 'key2', 'Value': 'value2'}])
Delete 2 keys from the key value store with ARN 'arn:aws:cloudfront::123456789012:key-value-store/327284aa-bcd5-499f-a3ff-26b9a9d31b58'
>>> client.update_keys(kvs_arn='arn:aws:cloudfront::123456789012:key-value-store/327284aa-bcd5-499f-a3ff-26b9a9d31b58', if_match='KV0AB12C3DEF456', deletes=[{'Key': 'key1'}, {'Key': 'key2'}])
Put 2 keys into and delete 1 key from the key value store with ARN 'arn:aws:cloudfront::123456789012:key-value-store/327284aa-bcd5-499f-a3ff-26b9a9d31b58'
>>> client.update_keys(kvs_arn='arn:aws:cloudfront::123456789012:key-value-store/327284aa-bcd5-499f-a3ff-26b9a9d31b58', if_match='KV0AB12C3DEF456', puts=[{'Key': 'key1', 'Value': 'value1'}, {'Key': 'key2', 'Value': 'value2'}], deletes=[{'Key': 'key3'}, {'Key': 'key4'}])
Source code in docs_src/capo_cloudfront_keyvaluestore/_services/cloud_front_key_value_store.py
def update_keys(
    self,
    kvs_arn: "capo_cloudfront_keyvaluestore.types.kvs_arn.KvsARN",
    if_match: "capo_cloudfront_keyvaluestore.types.etag.Etag",
    *,
    config_overrides: Optional[CloudFrontKeyValueStoreClientConfig] = None,
    puts: Optional[
        "capo_cloudfront_keyvaluestore.types.put_key_requests_list.PutKeyRequestsList"
    ] = None,
    deletes: Optional[
        "capo_cloudfront_keyvaluestore.types.delete_key_requests_list.DeleteKeyRequestsList"
    ] = None,
) -> "capo_cloudfront_keyvaluestore.types.update_keys_response.UpdateKeysResponse":
    """<p>Puts or Deletes multiple key value pairs in a single, all-or-nothing operation.</p>

    Args:
        kvs_arn: <p>The Amazon Resource Name (ARN) of the Key Value Store.</p>
        if_match: <p>The current version (ETag) of the Key Value Store that you are updating keys of, which you can get using DescribeKeyValueStore.</p>
        puts: <p>List of key value pairs to put.</p>
        deletes: <p>List of keys to delete.</p>

    Raises:
        capo_cloudfront_keyvaluestore.errors.access_denied_exception.AccessDeniedException: <p>Access denied.</p>
        capo_cloudfront_keyvaluestore.errors.conflict_exception.ConflictException: <p>Resource is not in expected state.</p>
        capo_cloudfront_keyvaluestore.errors.internal_server_exception.InternalServerException: <p>Internal server error.</p>
        capo_cloudfront_keyvaluestore.errors.resource_not_found_exception.ResourceNotFoundException: <p>Resource was not found.</p>
        capo_cloudfront_keyvaluestore.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Limit exceeded.</p>
        capo_cloudfront_keyvaluestore.errors.validation_exception.ValidationException: <p>Validation failed.</p>
        capo_cloudfront_keyvaluestore.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Put 2 keys into the key value store with ARN 'arn:aws:cloudfront::123456789012:key-value-store/327284aa-bcd5-499f-a3ff-26b9a9d31b58'

        >>> client.update_keys(kvs_arn='arn:aws:cloudfront::123456789012:key-value-store/327284aa-bcd5-499f-a3ff-26b9a9d31b58', if_match='KV0AB12C3DEF456', puts=[{'Key': 'key1', 'Value': 'value1'}, {'Key': 'key2', 'Value': 'value2'}])
        Delete 2 keys from the key value store with ARN 'arn:aws:cloudfront::123456789012:key-value-store/327284aa-bcd5-499f-a3ff-26b9a9d31b58'

        >>> client.update_keys(kvs_arn='arn:aws:cloudfront::123456789012:key-value-store/327284aa-bcd5-499f-a3ff-26b9a9d31b58', if_match='KV0AB12C3DEF456', deletes=[{'Key': 'key1'}, {'Key': 'key2'}])
        Put 2 keys into and delete 1 key from the key value store with ARN 'arn:aws:cloudfront::123456789012:key-value-store/327284aa-bcd5-499f-a3ff-26b9a9d31b58'

        >>> client.update_keys(kvs_arn='arn:aws:cloudfront::123456789012:key-value-store/327284aa-bcd5-499f-a3ff-26b9a9d31b58', if_match='KV0AB12C3DEF456', puts=[{'Key': 'key1', 'Value': 'value1'}, {'Key': 'key2', 'Value': 'value2'}], deletes=[{'Key': 'key3'}, {'Key': 'key4'}])
    """

    def _handler(
        req: "OperationRequest[capo_cloudfront_keyvaluestore.types.update_keys_request.UpdateKeysRequest]",
    ) -> OperationResponse[
        "capo_cloudfront_keyvaluestore.types.update_keys_response.UpdateKeysResponse"
    ]:
        import capo_cloudfront_keyvaluestore._operations.cloud_front_key_value_store.update_keys

        output, http_response = (
            capo_cloudfront_keyvaluestore._operations.cloud_front_key_value_store.update_keys.update_keys(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_cloudfront_keyvaluestore.types.update_keys_request.UpdateKeysRequest",
    ) -> dict[str, Any]:
        import capo_cloudfront_keyvaluestore.types.update_keys_request

        return capo_cloudfront_keyvaluestore.types.update_keys_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateKeys", redact_input=_redact_input)
    )
    input_: capo_cloudfront_keyvaluestore.types.update_keys_request.UpdateKeysRequest = {
        "kvs_arn": kvs_arn,
        "if_match": if_match,
    }
    if puts is not None:
        input_["puts"] = puts
    if deletes is not None:
        input_["deletes"] = deletes

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output