createGrantVersion method

Future<CreateGrantVersionResponse> createGrantVersion({
  1. required String clientToken,
  2. required String grantArn,
  3. List<AllowedOperation>? allowedOperations,
  4. String? grantName,
  5. String? sourceVersion,
  6. GrantStatus? status,
})

Creates a new version of the specified grant.

May throw ValidationException. May throw InvalidParameterValueException. May throw ResourceLimitExceededException. May throw ServerInternalException. May throw AuthorizationException. May throw AccessDeniedException. May throw RateLimitExceededException.

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

Parameter grantArn : Amazon Resource Name (ARN) of the grant.

Parameter allowedOperations : Allowed operations for the grant.

Parameter grantName : Grant name.

Parameter sourceVersion : Current version of the grant.

Parameter status : Grant status.

Implementation

Future<CreateGrantVersionResponse> createGrantVersion({
  required String clientToken,
  required String grantArn,
  List<AllowedOperation>? allowedOperations,
  String? grantName,
  String? sourceVersion,
  GrantStatus? status,
}) async {
  ArgumentError.checkNotNull(clientToken, 'clientToken');
  ArgumentError.checkNotNull(grantArn, 'grantArn');
  _s.validateStringLength(
    'grantArn',
    grantArn,
    0,
    2048,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSLicenseManager.CreateGrantVersion'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ClientToken': clientToken,
      'GrantArn': grantArn,
      if (allowedOperations != null)
        'AllowedOperations':
            allowedOperations.map((e) => e.toValue()).toList(),
      if (grantName != null) 'GrantName': grantName,
      if (sourceVersion != null) 'SourceVersion': sourceVersion,
      if (status != null) 'Status': status.toValue(),
    },
  );

  return CreateGrantVersionResponse.fromJson(jsonResponse.body);
}