Skip to content

get_distribution

get_distribution(
    id: string, *, config_overrides: Optional[CloudFrontClientConfig] = None
) -> GetDistributionResult

Get the information about a distribution.

Parameters:

  • id (string) –

    The distribution's ID. If the ID is empty, an empty distribution configuration is returned.

Raises:

Source code in docs_src/capo_cloudfront/_services/cloud_front.py
def get_distribution(
    self,
    id: "capo_cloudfront.types.string.string",
    *,
    config_overrides: Optional[CloudFrontClientConfig] = None,
) -> "capo_cloudfront.types.get_distribution_result.GetDistributionResult":
    """<p>Get the information about a distribution.</p>

    Args:
        id: <p>The distribution's ID. If the ID is empty, an empty distribution configuration is returned.</p>

    Raises:
        capo_cloudfront.errors.access_denied.AccessDenied: <p>Access denied.</p>
        capo_cloudfront.errors.no_such_distribution.NoSuchDistribution: <p>The specified distribution does not exist.</p>
        capo_cloudfront.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudfront.types.get_distribution_request.GetDistributionRequest]",
    ) -> OperationResponse[
        "capo_cloudfront.types.get_distribution_result.GetDistributionResult"
    ]:
        import capo_cloudfront._operations.cloudfront2020_05_31.get_distribution

        output, http_response = (
            capo_cloudfront._operations.cloudfront2020_05_31.get_distribution.get_distribution(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_cloudfront.types.get_distribution_result.GetDistributionResult",
    ) -> dict[str, Any]:
        import capo_cloudfront.types.get_distribution_result

        return capo_cloudfront.types.get_distribution_result.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("GetDistribution", redact_output=_redact_output),
    )
    input_: capo_cloudfront.types.get_distribution_request.GetDistributionRequest = {
        "id": id
    }

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