checkoutBorrowLicense method

Future<CheckoutBorrowLicenseResponse> checkoutBorrowLicense({
  1. required String clientToken,
  2. required DigitalSignatureMethod digitalSignatureMethod,
  3. required List<EntitlementData> entitlements,
  4. required String licenseArn,
  5. List<Metadata>? checkoutMetadata,
  6. String? nodeId,
})

Checks out the specified license for offline use.

May throw AccessDeniedException. May throw AuthorizationException. May throw EntitlementNotAllowedException. May throw InvalidParameterValueException. May throw NoEntitlementsAllowedException. May throw RateLimitExceededException. May throw RedirectException. May throw ResourceNotFoundException. May throw ServerInternalException. May throw UnsupportedDigitalSignatureMethodException. May throw ValidationException.

Parameter clientToken : Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

Parameter digitalSignatureMethod : Digital signature method. The possible value is JSON Web Signature (JWS) algorithm PS384. For more information, see RFC 7518 Digital Signature with RSASSA-PSS.

Parameter entitlements : License entitlements. Partial checkouts are not supported.

Parameter licenseArn : Amazon Resource Name (ARN) of the license. The license must use the borrow consumption configuration.

Parameter checkoutMetadata : Information about constraints.

Parameter nodeId : Node ID.

Implementation

Future<CheckoutBorrowLicenseResponse> checkoutBorrowLicense({
  required String clientToken,
  required DigitalSignatureMethod digitalSignatureMethod,
  required List<EntitlementData> entitlements,
  required String licenseArn,
  List<Metadata>? checkoutMetadata,
  String? nodeId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSLicenseManager.CheckoutBorrowLicense'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ClientToken': clientToken,
      'DigitalSignatureMethod': digitalSignatureMethod.value,
      'Entitlements': entitlements,
      'LicenseArn': licenseArn,
      if (checkoutMetadata != null) 'CheckoutMetadata': checkoutMetadata,
      if (nodeId != null) 'NodeId': nodeId,
    },
  );

  return CheckoutBorrowLicenseResponse.fromJson(jsonResponse.body);
}