Skip to content

confirm_product_instance

confirm_product_instance(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    instance_id: Optional[InstanceId] = None,
    product_code: Optional[String] = None,
    dry_run: Optional[Boolean] = None,
) -> ConfirmProductInstanceResult

Determines whether a product code is associated with an instance. This action can only be used by the owner of the product code. It is useful when a product code owner must verify whether another user's instance is eligible for support.

Parameters:

  • instance_id (Optional[InstanceId], default: None ) –

    The ID of the instance.

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

    The product code. This must be a product code that you own.

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

    Checks whether you have the required permissions for the operation, 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 confirm the product instance This example determines whether the specified product code is associated with the specified instance.

>>> client.confirm_product_instance(product_code='774F4FF8', instance_id='i-1234567890abcdef0')
Source code in docs_src/capo_ec2/_services/ec2.py
def confirm_product_instance(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    instance_id: Optional["capo_ec2.types.instance_id.InstanceId"] = None,
    product_code: Optional["capo_ec2.types.string.String"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.confirm_product_instance_result.ConfirmProductInstanceResult":
    """<p>Determines whether a product code is associated with an instance. This action can only be used by the owner of the product code. It is useful when a product code owner must verify whether another user's instance is eligible for support.</p>

    Args:
        instance_id: <p>The ID of the instance.</p>
        product_code: <p>The product code. This must be a product code that you own.</p>
        dry_run: <p>Checks whether you have the required permissions for the operation, 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 confirm the product instance
        This example determines whether the specified product code is associated with the specified instance.

        >>> client.confirm_product_instance(product_code='774F4FF8', instance_id='i-1234567890abcdef0')
    """

    def _handler(
        req: "OperationRequest[capo_ec2.types.confirm_product_instance_request.ConfirmProductInstanceRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.confirm_product_instance_result.ConfirmProductInstanceResult"
    ]:
        import capo_ec2._operations.amazon_ec2.confirm_product_instance

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ConfirmProductInstance")
    )
    input_: capo_ec2.types.confirm_product_instance_request.ConfirmProductInstanceRequest = {}
    if instance_id is not None:
        input_["instance_id"] = instance_id
    if product_code is not None:
        input_["product_code"] = product_code
    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