checkoutLicense method
Future<CheckoutLicenseResponse>
checkoutLicense({
- required CheckoutType checkoutType,
- required String clientToken,
- required List<
EntitlementData> entitlements, - required String keyFingerprint,
- required String productSKU,
- String? beneficiary,
- String? nodeId,
Checks out the specified license.
May throw ValidationException. May throw ResourceNotFoundException. May throw NoEntitlementsAllowedException. May throw UnsupportedDigitalSignatureMethodException. May throw RedirectException. May throw AuthorizationException. May throw AccessDeniedException. May throw RateLimitExceededException. May throw ServerInternalException.
Parameter checkoutType
:
Checkout type.
Parameter clientToken
:
Unique, case-sensitive identifier that you provide to ensure the
idempotency of the request.
Parameter entitlements
:
License entitlements.
Parameter keyFingerprint
:
Key fingerprint identifying the license.
Parameter productSKU
:
Product SKU.
Parameter beneficiary
:
License beneficiary.
Parameter nodeId
:
Node ID.
Implementation
Future<CheckoutLicenseResponse> checkoutLicense({
required CheckoutType checkoutType,
required String clientToken,
required List<EntitlementData> entitlements,
required String keyFingerprint,
required String productSKU,
String? beneficiary,
String? nodeId,
}) async {
ArgumentError.checkNotNull(checkoutType, 'checkoutType');
ArgumentError.checkNotNull(clientToken, 'clientToken');
_s.validateStringLength(
'clientToken',
clientToken,
0,
64,
isRequired: true,
);
ArgumentError.checkNotNull(entitlements, 'entitlements');
ArgumentError.checkNotNull(keyFingerprint, 'keyFingerprint');
ArgumentError.checkNotNull(productSKU, 'productSKU');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSLicenseManager.CheckoutLicense'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'CheckoutType': checkoutType.toValue(),
'ClientToken': clientToken,
'Entitlements': entitlements,
'KeyFingerprint': keyFingerprint,
'ProductSKU': productSKU,
if (beneficiary != null) 'Beneficiary': beneficiary,
if (nodeId != null) 'NodeId': nodeId,
},
);
return CheckoutLicenseResponse.fromJson(jsonResponse.body);
}