Skip to content

purchase_offering async

purchase_offering(
    offering_id: OfferingIdentifier,
    quantity: Integer,
    *,
    config_overrides: Optional[AsyncDeviceFarmClientConfig] = None,
    offering_promotion_id: Optional[OfferingPromotionIdentifier] = None,
) -> PurchaseOfferingResult

Immediately purchases offerings for an AWS account. Offerings renew with the latest total purchased quantity for an offering, unless the renewal was overridden. The API returns a NotEligible error if the user is not permitted to invoke the operation. If you must be able to invoke this operation, contact [email protected].

Parameters:

Raises:

Source code in docs_src/capo_device_farm/_services/async_device_farm.py
async def purchase_offering(
    self,
    offering_id: "capo_device_farm.types.offering_identifier.OfferingIdentifier",
    quantity: "capo_device_farm.types.integer.Integer",
    *,
    config_overrides: Optional[AsyncDeviceFarmClientConfig] = None,
    offering_promotion_id: Optional[
        "capo_device_farm.types.offering_promotion_identifier.OfferingPromotionIdentifier"
    ] = None,
) -> "capo_device_farm.types.purchase_offering_result.PurchaseOfferingResult":
    """<p>Immediately purchases offerings for an AWS account. Offerings renew with the latest total purchased quantity for an offering, unless the renewal was overridden. The API returns a <code>NotEligible</code> error if the user is not permitted to invoke the operation. If you must be able to invoke this operation, contact <a href="mailto:[email protected]">[email protected]</a>.</p>

    Args:
        offering_id: <p>The ID of the offering.</p>
        quantity: <p>The number of device slots to purchase in an offering request.</p>
        offering_promotion_id: <p>The ID of the offering promotion to be applied to the purchase.</p>

    Raises:
        capo_device_farm.errors.argument_exception.ArgumentException: <p>An invalid argument was specified.</p>
        capo_device_farm.errors.limit_exceeded_exception.LimitExceededException: <p>A limit was exceeded.</p>
        capo_device_farm.errors.not_eligible_exception.NotEligibleException: <p>Exception gets thrown when a user is not eligible to perform the specified transaction.</p>
        capo_device_farm.errors.not_found_exception.NotFoundException: <p>The specified entity was not found.</p>
        capo_device_farm.errors.service_account_exception.ServiceAccountException: <p>There was a problem with the service account.</p>
        capo_device_farm.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_device_farm.types.purchase_offering_request.PurchaseOfferingRequest]",
    ) -> AsyncOperationResponse[
        "capo_device_farm.types.purchase_offering_result.PurchaseOfferingResult"
    ]:
        import capo_device_farm._operations.device_farm_20150623.purchase_offering

        (
            output,
            http_response,
        ) = await capo_device_farm._operations.device_farm_20150623.purchase_offering.async_purchase_offering(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PurchaseOffering")
    )
    input_: capo_device_farm.types.purchase_offering_request.PurchaseOfferingRequest = {
        "offering_id": offering_id,
        "quantity": quantity,
    }
    if offering_promotion_id is not None:
        input_["offering_promotion_id"] = offering_promotion_id

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