Skip to content

describe_image_references

describe_image_references(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    image_ids: Optional[DescribeImageReferencesImageIdStringList] = None,
    include_all_resource_types: Optional[Boolean] = None,
    resource_types: Optional[ResourceTypeRequestList] = None,
    next_token: Optional[String] = None,
    dry_run: Optional[Boolean] = None,
    max_results: Optional[DescribeImageReferencesMaxResults] = None,
) -> DescribeImageReferencesResult

Describes your Amazon Web Services resources that are referencing the specified images.

For more information, see Identify your resources referencing specified AMIs in the Amazon EC2 User Guide.

Parameters:

  • image_ids (Optional[DescribeImageReferencesImageIdStringList], default: None ) –

    The IDs of the images to check for resource references.

  • include_all_resource_types (Optional[Boolean], default: None ) –

    Specifies whether to check all supported Amazon Web Services resource types for image references. When specified, default values are applied for ResourceTypeOptions. For the default values, see How AMI reference checks work in the Amazon EC2 User Guide. If you also specify ResourceTypes with ResourceTypeOptions, your specified values override the default values.

    Supported resource types: ec2:Instance | ec2:LaunchTemplate | ssm:Parameter | imagebuilder:ImageRecipe | imagebuilder:ContainerRecipe

    Either IncludeAllResourceTypes or ResourceTypes must be specified.

  • resource_types (Optional[ResourceTypeRequestList], default: None ) –

    The Amazon Web Services resource types to check for image references.

    Either IncludeAllResourceTypes or ResourceTypes must be specified.

  • next_token (Optional[String], default: None ) –

    The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • max_results (Optional[DescribeImageReferencesMaxResults], default: None ) –

    The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see Pagination.

Raises:

Source code in docs_src/capo_ec2/_services/ec2.py
def describe_image_references(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    image_ids: Optional[
        "capo_ec2.types.describe_image_references_image_id_string_list.DescribeImageReferencesImageIdStringList"
    ] = None,
    include_all_resource_types: Optional["capo_ec2.types.boolean.Boolean"] = None,
    resource_types: Optional[
        "capo_ec2.types.resource_type_request_list.ResourceTypeRequestList"
    ] = None,
    next_token: Optional["capo_ec2.types.string.String"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    max_results: Optional[
        "capo_ec2.types.describe_image_references_max_results.DescribeImageReferencesMaxResults"
    ] = None,
) -> (
    "capo_ec2.types.describe_image_references_result.DescribeImageReferencesResult"
):
    """<p>Describes your Amazon Web Services resources that are referencing the specified images.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-ami-references.html">Identify your resources referencing specified AMIs</a> in the <i>Amazon EC2 User Guide</i>.</p>

    Args:
        image_ids: <p>The IDs of the images to check for resource references.</p>
        include_all_resource_types: <p>Specifies whether to check all supported Amazon Web Services resource types for image references. When specified, default values are applied for <code>ResourceTypeOptions</code>. For the default values, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-ami-references.html#how-ami-references-works">How AMI reference checks work</a> in the <i>Amazon EC2 User Guide</i>. If you also specify <code>ResourceTypes</code> with <code>ResourceTypeOptions</code>, your specified values override the default values.</p> <p>Supported resource types: <code>ec2:Instance</code> | <code>ec2:LaunchTemplate</code> | <code>ssm:Parameter</code> | <code>imagebuilder:ImageRecipe</code> | <code>imagebuilder:ContainerRecipe</code> </p> <p>Either <code>IncludeAllResourceTypes</code> or <code>ResourceTypes</code> must be specified.</p>
        resource_types: <p>The Amazon Web Services resource types to check for image references.</p> <p>Either <code>IncludeAllResourceTypes</code> or <code>ResourceTypes</code> must be specified.</p>
        next_token: <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
        max_results: <p> The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>. </p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ec2.types.describe_image_references_request.DescribeImageReferencesRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.describe_image_references_result.DescribeImageReferencesResult"
    ]:
        import capo_ec2._operations.amazon_ec2.describe_image_references

        output, http_response = (
            capo_ec2._operations.amazon_ec2.describe_image_references.describe_image_references(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeImageReferences")
    )
    input_: capo_ec2.types.describe_image_references_request.DescribeImageReferencesRequest = {}
    if image_ids is not None:
        input_["image_ids"] = image_ids
    if include_all_resource_types is not None:
        input_["include_all_resource_types"] = include_all_resource_types
    if resource_types is not None:
        input_["resource_types"] = resource_types
    if next_token is not None:
        input_["next_token"] = next_token
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if max_results is not None:
        input_["max_results"] = max_results

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