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 ValidationException. May throw ResourceNotFoundException. May throw NoEntitlementsAllowedException. May throw EntitlementNotAllowedException. May throw UnsupportedDigitalSignatureMethodException. May throw RedirectException. May throw AuthorizationException. May throw AccessDeniedException. May throw RateLimitExceededException. May throw ServerInternalException.

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 {
  ArgumentError.checkNotNull(clientToken, 'clientToken');
  _s.validateStringLength(
    'clientToken',
    clientToken,
    0,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(
      digitalSignatureMethod, 'digitalSignatureMethod');
  ArgumentError.checkNotNull(entitlements, 'entitlements');
  ArgumentError.checkNotNull(licenseArn, 'licenseArn');
  _s.validateStringLength(
    'licenseArn',
    licenseArn,
    0,
    2048,
    isRequired: true,
  );
  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.toValue(),
      'Entitlements': entitlements,
      'LicenseArn': licenseArn,
      if (checkoutMetadata != null) 'CheckoutMetadata': checkoutMetadata,
      if (nodeId != null) 'NodeId': nodeId,
    },
  );

  return CheckoutBorrowLicenseResponse.fromJson(jsonResponse.body);
}