Skip to content

describe_image_attribute async

describe_image_attribute(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    attribute: Optional[ImageAttributeName] = None,
    image_id: Optional[ImageId] = None,
    dry_run: Optional[Boolean] = None,
) -> ImageAttribute

Describes the specified attribute of the specified AMI. You can specify only one attribute at a time.

The order of the elements in the response, including those within nested structures, might vary. Applications should not assume the elements appear in a particular order.

Parameters:

  • attribute (Optional[ImageAttributeName], default: None ) –

    The AMI attribute.

    Note: The blockDeviceMapping attribute is deprecated. Using this attribute returns the Client.AuthFailure error. To get information about the block device mappings for an AMI, describe the image instead.

  • image_id (Optional[ImageId], default: None ) –

    The ID of the AMI.

  • 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.

Raises:

Examples:

To describe the launch permissions for an AMI This example describes the launch permissions for the specified AMI.

>>> await client.describe_image_attribute(attribute='launchPermission', image_id='ami-5731123e')
Source code in docs_src/capo_ec2/_services/async_ec2.py
async def describe_image_attribute(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    attribute: Optional[
        "capo_ec2.types.image_attribute_name.ImageAttributeName"
    ] = None,
    image_id: Optional["capo_ec2.types.image_id.ImageId"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.image_attribute.ImageAttribute":
    """<p>Describes the specified attribute of the specified AMI. You can specify only one attribute at a time.</p> <note> <p>The order of the elements in the response, including those within nested structures, might vary. Applications should not assume the elements appear in a particular order.</p> </note>

    Args:
        attribute: <p>The AMI attribute.</p> <p> <b>Note</b>: The <code>blockDeviceMapping</code> attribute is deprecated. Using this attribute returns the <code>Client.AuthFailure</code> error. To get information about the block device mappings for an AMI, describe the image instead.</p>
        image_id: <p>The ID of the AMI.</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>

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

    Examples:
        To describe the launch permissions for an AMI
        This example describes the launch permissions for the specified AMI.

        >>> await client.describe_image_attribute(attribute='launchPermission', image_id='ami-5731123e')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.describe_image_attribute_request.DescribeImageAttributeRequest]",
    ) -> AsyncOperationResponse["capo_ec2.types.image_attribute.ImageAttribute"]:
        import capo_ec2._operations.amazon_ec2.describe_image_attribute

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.describe_image_attribute.async_describe_image_attribute(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeImageAttribute")
    )
    input_: capo_ec2.types.describe_image_attribute_request.DescribeImageAttributeRequest = {}
    if attribute is not None:
        input_["attribute"] = attribute
    if image_id is not None:
        input_["image_id"] = image_id
    if dry_run is not None:
        input_["dry_run"] = dry_run

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