purchaseOffering method
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 aws-devicefarm-support@amazon.com.
May throw ArgumentException. May throw NotFoundException. May throw NotEligibleException. May throw LimitExceededException. May throw ServiceAccountException.
Parameter offeringId
:
The ID of the offering.
Parameter offeringPromotionId
:
The ID of the offering promotion to be applied to the purchase.
Parameter quantity
:
The number of device slots to purchase in an offering request.
Implementation
Future<PurchaseOfferingResult> purchaseOffering({
String? offeringId,
String? offeringPromotionId,
int? quantity,
}) async {
_s.validateStringLength(
'offeringId',
offeringId,
32,
1152921504606846976,
);
_s.validateStringLength(
'offeringPromotionId',
offeringPromotionId,
4,
1152921504606846976,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'DeviceFarm_20150623.PurchaseOffering'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
if (offeringId != null) 'offeringId': offeringId,
if (offeringPromotionId != null)
'offeringPromotionId': offeringPromotionId,
if (quantity != null) 'quantity': quantity,
},
);
return PurchaseOfferingResult.fromJson(jsonResponse.body);
}