Skip to content

get_api_key async

get_api_key(
    branch_arn: BranchArn,
    api_key_id: ApiKeyId,
    *,
    config_overrides: Optional[AsyncAmplifyGen3ClientConfig] = None,
) -> GetApiKeyResponse

Returns an API key for a branch, including the key value. The key value is a credential. Store it securely and don't log it.

Parameters:

  • branch_arn (BranchArn) –

    The Amazon Resource Name (ARN) of the branch that the API key belongs to.

  • api_key_id (ApiKeyId) –

    The ID of the API key to return.

Raises:

Source code in docs_src/capo_amplifygen3/_services/async_amplify_gen3.py
async def get_api_key(
    self,
    branch_arn: "capo_amplifygen3.types.branch_arn.BranchArn",
    api_key_id: "capo_amplifygen3.types.api_key_id.ApiKeyId",
    *,
    config_overrides: Optional[AsyncAmplifyGen3ClientConfig] = None,
) -> "capo_amplifygen3.types.get_api_key_response.GetApiKeyResponse":
    """<p>Returns an API key for a branch, including the key value. The key value is a credential. Store it securely and don't log it.</p>

    Args:
        branch_arn: <p>The Amazon Resource Name (ARN) of the branch that the API key belongs to.</p>
        api_key_id: <p>The ID of the API key to return.</p>

    Raises:
        capo_amplifygen3.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action.</p>
        capo_amplifygen3.errors.internal_server_exception.InternalServerException: <p>An internal error occurred. Retry the request.</p>
        capo_amplifygen3.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource was not found.</p>
        capo_amplifygen3.errors.throttling_exception.ThrottlingException: <p>The request was denied because the request rate exceeds the allowed limit.</p>
        capo_amplifygen3.errors.validation_exception.ValidationException: <p>The request contains invalid parameters or is otherwise malformed.</p>
        capo_amplifygen3.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_amplifygen3.types.get_api_key_request.GetApiKeyRequest]",
    ) -> AsyncOperationResponse[
        "capo_amplifygen3.types.get_api_key_response.GetApiKeyResponse"
    ]:
        import capo_amplifygen3._operations.omega.get_api_key

        (
            output,
            http_response,
        ) = await capo_amplifygen3._operations.omega.get_api_key.async_get_api_key(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_amplifygen3.types.get_api_key_response.GetApiKeyResponse",
    ) -> dict[str, Any]:
        import capo_amplifygen3.types.get_api_key_response

        return capo_amplifygen3.types.get_api_key_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("GetApiKey", redact_output=_redact_output),
    )
    input_: capo_amplifygen3.types.get_api_key_request.GetApiKeyRequest = {
        "branch_arn": branch_arn,
        "api_key_id": api_key_id,
    }

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