Skip to content

get_key async

get_key(
    kvs_arn: KvsARN,
    key: Key,
    *,
    config_overrides: Optional[AsyncCloudFrontKeyValueStoreClientConfig] = None,
) -> GetKeyResponse

Returns a key value pair.

Parameters:

  • kvs_arn (KvsARN) –

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

  • key (Key) –

    The key to get.

Raises:

Examples:

Get 'key1' from the key value store with ARN 'arn:aws:cloudfront::123456789012:key-value-store/327284aa-bcd5-499f-a3ff-26b9a9d31b58'

>>> await client.get_key(key='key1', kvs_arn='arn:aws:cloudfront::123456789012:key-value-store/327284aa-bcd5-499f-a3ff-26b9a9d31b58')
Source code in docs_src/capo_cloudfront_keyvaluestore/_services/async_cloud_front_key_value_store.py
async def get_key(
    self,
    kvs_arn: "capo_cloudfront_keyvaluestore.types.kvs_arn.KvsARN",
    key: "capo_cloudfront_keyvaluestore.types.key.Key",
    *,
    config_overrides: Optional[AsyncCloudFrontKeyValueStoreClientConfig] = None,
) -> "capo_cloudfront_keyvaluestore.types.get_key_response.GetKeyResponse":
    """<p>Returns a key value pair.</p>

    Args:
        kvs_arn: <p>The Amazon Resource Name (ARN) of the Key Value Store.</p>
        key: <p>The key to get.</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.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Get 'key1' from the key value store with ARN 'arn:aws:cloudfront::123456789012:key-value-store/327284aa-bcd5-499f-a3ff-26b9a9d31b58'

        >>> await client.get_key(key='key1', kvs_arn='arn:aws:cloudfront::123456789012:key-value-store/327284aa-bcd5-499f-a3ff-26b9a9d31b58')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudfront_keyvaluestore.types.get_key_request.GetKeyRequest]",
    ) -> AsyncOperationResponse[
        "capo_cloudfront_keyvaluestore.types.get_key_response.GetKeyResponse"
    ]:
        import capo_cloudfront_keyvaluestore._operations.cloud_front_key_value_store.get_key

        (
            output,
            http_response,
        ) = await capo_cloudfront_keyvaluestore._operations.cloud_front_key_value_store.get_key.async_get_key(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_cloudfront_keyvaluestore.types.get_key_response.GetKeyResponse",
    ) -> dict[str, Any]:
        import capo_cloudfront_keyvaluestore.types.get_key_response

        return (
            capo_cloudfront_keyvaluestore.types.get_key_response.redact_sensitive(
                output
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetKey", redact_output=_redact_output)
    )
    input_: capo_cloudfront_keyvaluestore.types.get_key_request.GetKeyRequest = {
        "kvs_arn": kvs_arn,
        "key": key,
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output