Skip to content

list_api_keys async

list_api_keys(
    scope: Scope,
    *,
    config_overrides: Optional[AsyncWAFV2ClientConfig] = None,
    next_marker: Optional[NextMarker] = None,
    limit: Optional[PaginationLimit] = None,
) -> ListAPIKeysResponse

Retrieves a list of the API keys that you've defined for the specified scope.

API keys are required for the integration of the CAPTCHA API in your JavaScript client applications. The API lets you customize the placement and characteristics of the CAPTCHA puzzle for your end users. For more information about the CAPTCHA JavaScript integration, see WAF client application integration in the WAF Developer Guide.

Parameters:

  • scope (Scope) –

    Specifies whether this is for a global resource type, such as a Amazon CloudFront distribution. For an Amplify application, use CLOUDFRONT.

    To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows:

    • CLI - Specify the Region when you use the CloudFront scope: --scope=CLOUDFRONT --region=us-east-1.

    • API and SDKs - For all calls, use the Region endpoint us-east-1.

  • next_marker (Optional[NextMarker], default: None ) –

    When you request a list of objects with a Limit setting, if the number of objects that are still available for retrieval exceeds the limit, WAF returns a NextMarker value in the response. To retrieve the next batch of objects, provide the marker from the prior call in your next request.

  • limit (Optional[PaginationLimit], default: None ) –

    The maximum number of objects that you want WAF to return for this request. If more objects are available, in the response, WAF provides a NextMarker value that you can use in a subsequent call to get the next batch of objects.

Raises:

  • WAFInternalErrorException –

    Your request is valid, but WAF couldn’t perform the operation because of a system problem. Retry your request.

  • WAFInvalidOperationException –

    The operation isn't valid.

  • WAFInvalidParameterException –

    The operation failed because WAF didn't recognize a parameter in the request. For example:

    • You specified a parameter name or value that isn't valid.

    • Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.

    • You tried to update a WebACL with a DefaultAction that isn't among the types available at DefaultAction.

    • Your request references an ARN that is malformed, or corresponds to a resource with which a web ACL can't be associated.

  • WAFInvalidResourceException –

    WAF couldn’t perform the operation because the resource that you requested isn’t valid. Check the resource, and try again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_wafv2/_services/async_wafv2.py
async def list_api_keys(
    self,
    scope: "capo_wafv2.types.scope.Scope",
    *,
    config_overrides: Optional[AsyncWAFV2ClientConfig] = None,
    next_marker: Optional["capo_wafv2.types.next_marker.NextMarker"] = None,
    limit: Optional["capo_wafv2.types.pagination_limit.PaginationLimit"] = None,
) -> "capo_wafv2.types.list_api_keys_response.ListAPIKeysResponse":
    """<p>Retrieves a list of the API keys that you've defined for the specified scope. </p> <p>API keys are required for the integration of the CAPTCHA API in your JavaScript client applications. The API lets you customize the placement and characteristics of the CAPTCHA puzzle for your end users. For more information about the CAPTCHA JavaScript integration, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-application-integration.html">WAF client application integration</a> in the <i>WAF Developer Guide</i>.</p>

    Args:
        scope: <p>Specifies whether this is for a global resource type, such as a Amazon CloudFront distribution. For an Amplify application, use <code>CLOUDFRONT</code>.</p> <p>To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows: </p> <ul> <li> <p>CLI - Specify the Region when you use the CloudFront scope: <code>--scope=CLOUDFRONT --region=us-east-1</code>. </p> </li> <li> <p>API and SDKs - For all calls, use the Region endpoint us-east-1. </p> </li> </ul>
        next_marker: <p>When you request a list of objects with a <code>Limit</code> setting, if the number of objects that are still available for retrieval exceeds the limit, WAF returns a <code>NextMarker</code> value in the response. To retrieve the next batch of objects, provide the marker from the prior call in your next request.</p>
        limit: <p>The maximum number of objects that you want WAF to return for this request. If more objects are available, in the response, WAF provides a <code>NextMarker</code> value that you can use in a subsequent call to get the next batch of objects.</p>

    Raises:
        capo_wafv2.errors.waf_internal_error_exception.WAFInternalErrorException: <p>Your request is valid, but WAF couldn’t perform the operation because of a system problem. Retry your request. </p>
        capo_wafv2.errors.waf_invalid_operation_exception.WAFInvalidOperationException: <p>The operation isn't valid. </p>
        capo_wafv2.errors.waf_invalid_parameter_exception.WAFInvalidParameterException: <p>The operation failed because WAF didn't recognize a parameter in the request. For example: </p> <ul> <li> <p>You specified a parameter name or value that isn't valid.</p> </li> <li> <p>Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested. </p> </li> <li> <p>You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't among the types available at <a>DefaultAction</a>.</p> </li> <li> <p>Your request references an ARN that is malformed, or corresponds to a resource with which a web ACL can't be associated.</p> </li> </ul>
        capo_wafv2.errors.waf_invalid_resource_exception.WAFInvalidResourceException: <p>WAF couldn’t perform the operation because the resource that you requested isn’t valid. Check the resource, and try again.</p>
        capo_wafv2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_wafv2.types.list_api_keys_request.ListAPIKeysRequest]",
    ) -> AsyncOperationResponse[
        "capo_wafv2.types.list_api_keys_response.ListAPIKeysResponse"
    ]:
        import capo_wafv2._operations.awswaf_20190729.list_api_keys

        (
            output,
            http_response,
        ) = await capo_wafv2._operations.awswaf_20190729.list_api_keys.async_list_api_keys(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListAPIKeys")
    )
    input_: capo_wafv2.types.list_api_keys_request.ListAPIKeysRequest = {
        "scope": scope
    }
    if next_marker is not None:
        input_["next_marker"] = next_marker
    if limit is not None:
        input_["limit"] = limit

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