Skip to content

get_container_recipe_policy

get_container_recipe_policy(
    container_recipe_arn: ContainerRecipeArn,
    *,
    config_overrides: Optional[imagebuilderClientConfig] = None,
) -> GetContainerRecipePolicyResponse

Retrieves the policy for a container recipe.

Parameters:

  • container_recipe_arn (ContainerRecipeArn) –

    The Amazon Resource Name (ARN) of the container recipe for the policy being requested.

Raises:

  • CallRateLimitExceededException –

    You have exceeded the permitted request rate for the Amazon EC2 APIs that Image Builder calls on your behalf. Retry with an increasing or variable delay between requests.

  • ForbiddenException –

    You are not authorized to perform the requested operation.

  • InvalidRequestException –

    The request is malformed or otherwise invalid. Verify the request and try again.

  • ResourceNotFoundException –

    At least one of the resources referenced by your request does not exist.

  • ServiceException –

    An internal server error occurred while Image Builder processed the request. Retrying the request may succeed.

  • ServiceUnavailableException –

    The service is unable to process your request at this time.

  • UnknownServiceError –

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

Examples:

Get the policy attached to a container recipe The following example retrieves the resource policy for a container recipe that you shared with another AWS account. The policy property contains the resource-based policy document as a JSON-encoded string.

>>> client.get_container_recipe_policy(container_recipe_arn='arn:aws:imagebuilder:us-west-2:111122223333:container-recipe/my-example-container-recipe-shared/1.0.0')
Source code in docs_src/capo_imagebuilder/_services/imagebuilder.py
def get_container_recipe_policy(
    self,
    container_recipe_arn: "capo_imagebuilder.types.container_recipe_arn.ContainerRecipeArn",
    *,
    config_overrides: Optional[imagebuilderClientConfig] = None,
) -> "capo_imagebuilder.types.get_container_recipe_policy_response.GetContainerRecipePolicyResponse":
    """<p>Retrieves the policy for a container recipe.</p>

    Args:
        container_recipe_arn: <p>The Amazon Resource Name (ARN) of the container recipe for the policy being requested.</p>

    Raises:
        capo_imagebuilder.errors.call_rate_limit_exceeded_exception.CallRateLimitExceededException: <p>You have exceeded the permitted request rate for the Amazon EC2 APIs that Image Builder calls on your behalf. Retry with an increasing or variable delay between requests.</p>
        capo_imagebuilder.errors.forbidden_exception.ForbiddenException: <p>You are not authorized to perform the requested operation.</p>
        capo_imagebuilder.errors.invalid_request_exception.InvalidRequestException: <p>The request is malformed or otherwise invalid. Verify the request and try again.</p>
        capo_imagebuilder.errors.resource_not_found_exception.ResourceNotFoundException: <p>At least one of the resources referenced by your request does not exist.</p>
        capo_imagebuilder.errors.service_exception.ServiceException: <p>An internal server error occurred while Image Builder processed the request. Retrying the request may succeed.</p>
        capo_imagebuilder.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is unable to process your request at this time.</p>
        capo_imagebuilder.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Get the policy attached to a container recipe
        The following example retrieves the resource policy for a container recipe that you shared with another AWS account. The policy property contains the resource-based policy document as a JSON-encoded string.

        >>> client.get_container_recipe_policy(container_recipe_arn='arn:aws:imagebuilder:us-west-2:111122223333:container-recipe/my-example-container-recipe-shared/1.0.0')
    """

    def _handler(
        req: "OperationRequest[capo_imagebuilder.types.get_container_recipe_policy_request.GetContainerRecipePolicyRequest]",
    ) -> OperationResponse[
        "capo_imagebuilder.types.get_container_recipe_policy_response.GetContainerRecipePolicyResponse"
    ]:
        import capo_imagebuilder._operations.imagebuilder.get_container_recipe_policy

        output, http_response = (
            capo_imagebuilder._operations.imagebuilder.get_container_recipe_policy.get_container_recipe_policy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetContainerRecipePolicy")
    )
    input_: capo_imagebuilder.types.get_container_recipe_policy_request.GetContainerRecipePolicyRequest = {
        "container_recipe_arn": container_recipe_arn
    }

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