Skip to content

associate_capacity_reservation_billing_owner

associate_capacity_reservation_billing_owner(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    capacity_reservation_id: Optional[CapacityReservationId] = None,
    unused_reservation_billing_owner_id: Optional[AccountID] = None,
) -> AssociateCapacityReservationBillingOwnerResult

Initiates a request to assign billing of the unused capacity of a shared Capacity Reservation to a consumer account that is consolidated under the same Amazon Web Services organizations payer account. For more information, see Billing assignment for shared Amazon EC2 Capacity Reservations.

Parameters:

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

  • capacity_reservation_id (Optional[CapacityReservationId], default: None ) –

    The ID of the Capacity Reservation.

  • unused_reservation_billing_owner_id (Optional[AccountID], default: None ) –

    The ID of the consumer account to which to assign billing.

Raises:

Source code in docs_src/capo_ec2/_services/ec2.py
def associate_capacity_reservation_billing_owner(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    capacity_reservation_id: Optional[
        "capo_ec2.types.capacity_reservation_id.CapacityReservationId"
    ] = None,
    unused_reservation_billing_owner_id: Optional[
        "capo_ec2.types.account_id.AccountID"
    ] = None,
) -> "capo_ec2.types.associate_capacity_reservation_billing_owner_result.AssociateCapacityReservationBillingOwnerResult":
    """<p>Initiates a request to assign billing of the unused capacity of a shared Capacity Reservation to a consumer account that is consolidated under the same Amazon Web Services organizations payer account. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/assign-billing.html">Billing assignment for shared Amazon EC2 Capacity Reservations</a>.</p>

    Args:
        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>
        capacity_reservation_id: <p>The ID of the Capacity Reservation.</p>
        unused_reservation_billing_owner_id: <p>The ID of the consumer account to which to assign billing.</p>

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

    def _handler(
        req: "OperationRequest[capo_ec2.types.associate_capacity_reservation_billing_owner_request.AssociateCapacityReservationBillingOwnerRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.associate_capacity_reservation_billing_owner_result.AssociateCapacityReservationBillingOwnerResult"
    ]:
        import capo_ec2._operations.amazon_ec2.associate_capacity_reservation_billing_owner

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

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("AssociateCapacityReservationBillingOwner"),
    )
    input_: capo_ec2.types.associate_capacity_reservation_billing_owner_request.AssociateCapacityReservationBillingOwnerRequest = {}
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if capacity_reservation_id is not None:
        input_["capacity_reservation_id"] = capacity_reservation_id
    if unused_reservation_billing_owner_id is not None:
        input_["unused_reservation_billing_owner_id"] = (
            unused_reservation_billing_owner_id
        )

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