Skip to content

attach_image_watermark

attach_image_watermark(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    image_id: Optional[ImageId] = None,
    watermark_name: Optional[ImageWatermarkNameRequest] = None,
    dry_run: Optional[Boolean] = None,
) -> AttachImageWatermarkResult

Attaches a watermark to a non-public AMI. The watermark is a structured identifier that automatically propagates to all derivative images created through CreateImage, and CopyImage.

Only the AMI owner can attach watermarks. Watermarks cannot be added to public AMIs.

Parameters:

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

    The ID of the AMI.

  • watermark_name (Optional[ImageWatermarkNameRequest], default: None ) –

    The name for the watermark. Combined with the caller's account ID to form the WatermarkKey (accountId:watermarkName).

    Constraints: 3-128 alphanumeric characters, parentheses (()), square brackets ([]), spaces ( ), periods (.), slashes (/), dashes (-), single quotes ('), at-signs (@), or underscores(_)

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

Source code in docs_src/capo_ec2/_services/ec2.py
def attach_image_watermark(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    image_id: Optional["capo_ec2.types.image_id.ImageId"] = None,
    watermark_name: Optional[
        "capo_ec2.types.image_watermark_name_request.ImageWatermarkNameRequest"
    ] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.attach_image_watermark_result.AttachImageWatermarkResult":
    """<p>Attaches a watermark to a non-public AMI. The watermark is a structured identifier that automatically propagates to all derivative images created through <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateImage.html">CreateImage</a>, and <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CopyImage.html">CopyImage</a>.</p> <p>Only the AMI owner can attach watermarks. Watermarks cannot be added to public AMIs.</p>

    Args:
        image_id: <p>The ID of the AMI.</p>
        watermark_name: <p>The name for the watermark. Combined with the caller's account ID to form the <code>WatermarkKey</code> (<code>accountId:watermarkName</code>).</p> <p>Constraints: 3-128 alphanumeric characters, parentheses (()), square brackets ([]), spaces ( ), periods (.), slashes (/), dashes (-), single quotes ('), at-signs (@), or underscores(_)</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.
    """

    def _handler(
        req: "OperationRequest[capo_ec2.types.attach_image_watermark_request.AttachImageWatermarkRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.attach_image_watermark_result.AttachImageWatermarkResult"
    ]:
        import capo_ec2._operations.amazon_ec2.attach_image_watermark

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AttachImageWatermark")
    )
    input_: capo_ec2.types.attach_image_watermark_request.AttachImageWatermarkRequest = {}
    if image_id is not None:
        input_["image_id"] = image_id
    if watermark_name is not None:
        input_["watermark_name"] = watermark_name
    if dry_run is not None:
        input_["dry_run"] = dry_run

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