updateLicenseSpecificationsForResource method

Future<void> updateLicenseSpecificationsForResource({
  1. required String resourceArn,
  2. List<LicenseSpecification>? addLicenseSpecifications,
  3. List<LicenseSpecification>? removeLicenseSpecifications,
})

Adds or removes the specified license configurations for the specified AWS resource.

You can update the license specifications of AMIs, instances, and hosts. You cannot update the license specifications for launch templates and AWS CloudFormation templates, as they send license configurations to the operation that creates the resource.

May throw InvalidParameterValueException. May throw InvalidResourceStateException. May throw LicenseUsageException. May throw ServerInternalException. May throw AuthorizationException. May throw AccessDeniedException. May throw RateLimitExceededException.

Parameter resourceArn : Amazon Resource Name (ARN) of the AWS resource.

Parameter addLicenseSpecifications : ARNs of the license configurations to add.

Parameter removeLicenseSpecifications : ARNs of the license configurations to remove.

Implementation

Future<void> updateLicenseSpecificationsForResource({
  required String resourceArn,
  List<LicenseSpecification>? addLicenseSpecifications,
  List<LicenseSpecification>? removeLicenseSpecifications,
}) async {
  ArgumentError.checkNotNull(resourceArn, 'resourceArn');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSLicenseManager.UpdateLicenseSpecificationsForResource'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ResourceArn': resourceArn,
      if (addLicenseSpecifications != null)
        'AddLicenseSpecifications': addLicenseSpecifications,
      if (removeLicenseSpecifications != null)
        'RemoveLicenseSpecifications': removeLicenseSpecifications,
    },
  );
}