Skip to content

get_origin_request_policy async

get_origin_request_policy(
    id: string, *, config_overrides: Optional[AsyncCloudFrontClientConfig] = None
) -> GetOriginRequestPolicyResult

Gets an origin request policy, including the following metadata:

  • The policy's identifier.

  • The date and time when the policy was last modified.

To get an origin request policy, you must provide the policy's identifier. If the origin request policy is attached to a distribution's cache behavior, you can get the policy's identifier using ListDistributions or GetDistribution. If the origin request policy is not attached to a cache behavior, you can get the identifier using ListOriginRequestPolicies.

Parameters:

  • id (string) –

    The unique identifier for the origin request policy. If the origin request policy is attached to a distribution's cache behavior, you can get the policy's identifier using ListDistributions or GetDistribution. If the origin request policy is not attached to a cache behavior, you can get the identifier using ListOriginRequestPolicies.

Raises:

Source code in docs_src/capo_cloudfront/_services/async_cloud_front.py
async def get_origin_request_policy(
    self,
    id: "capo_cloudfront.types.string.string",
    *,
    config_overrides: Optional[AsyncCloudFrontClientConfig] = None,
) -> "capo_cloudfront.types.get_origin_request_policy_result.GetOriginRequestPolicyResult":
    """<p>Gets an origin request policy, including the following metadata:</p> <ul> <li> <p>The policy's identifier.</p> </li> <li> <p>The date and time when the policy was last modified.</p> </li> </ul> <p>To get an origin request policy, you must provide the policy's identifier. If the origin request policy is attached to a distribution's cache behavior, you can get the policy's identifier using <code>ListDistributions</code> or <code>GetDistribution</code>. If the origin request policy is not attached to a cache behavior, you can get the identifier using <code>ListOriginRequestPolicies</code>.</p>

    Args:
        id: <p>The unique identifier for the origin request policy. If the origin request policy is attached to a distribution's cache behavior, you can get the policy's identifier using <code>ListDistributions</code> or <code>GetDistribution</code>. If the origin request policy is not attached to a cache behavior, you can get the identifier using <code>ListOriginRequestPolicies</code>.</p>

    Raises:
        capo_cloudfront.errors.access_denied.AccessDenied: <p>Access denied.</p>
        capo_cloudfront.errors.no_such_origin_request_policy.NoSuchOriginRequestPolicy: <p>The origin request policy does not exist.</p>
        capo_cloudfront.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudfront.types.get_origin_request_policy_request.GetOriginRequestPolicyRequest]",
    ) -> AsyncOperationResponse[
        "capo_cloudfront.types.get_origin_request_policy_result.GetOriginRequestPolicyResult"
    ]:
        import capo_cloudfront._operations.cloudfront2020_05_31.get_origin_request_policy

        (
            output,
            http_response,
        ) = await capo_cloudfront._operations.cloudfront2020_05_31.get_origin_request_policy.async_get_origin_request_policy(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetOriginRequestPolicy")
    )
    input_: capo_cloudfront.types.get_origin_request_policy_request.GetOriginRequestPolicyRequest = {
        "id": id
    }

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