listUsageForLicenseConfiguration method

Future<ListUsageForLicenseConfigurationResponse> listUsageForLicenseConfiguration({
  1. required String licenseConfigurationArn,
  2. List<Filter>? filters,
  3. int? maxResults,
  4. String? nextToken,
})

Lists all license usage records for a license configuration, displaying license consumption details by resource at a selected point in time. Use this action to audit the current license consumption for any license inventory and configuration.

May throw InvalidParameterValueException. May throw FilterLimitExceededException. May throw ServerInternalException. May throw AuthorizationException. May throw AccessDeniedException. May throw RateLimitExceededException.

Parameter licenseConfigurationArn : Amazon Resource Name (ARN) of the license configuration.

Parameter filters : Filters to scope the results. The following filters and logical operators are supported:

  • resourceArn - The ARN of the license configuration resource. Logical operators are EQUALS | NOT_EQUALS.
  • resourceType - The resource type (EC2_INSTANCE | EC2_HOST | EC2_AMI | SYSTEMS_MANAGER_MANAGED_INSTANCE). Logical operators are EQUALS | NOT_EQUALS.
  • resourceAccount - The ID of the account that owns the resource. Logical operators are EQUALS | NOT_EQUALS.

Parameter maxResults : Maximum number of results to return in a single call.

Parameter nextToken : Token for the next set of results.

Implementation

Future<ListUsageForLicenseConfigurationResponse>
    listUsageForLicenseConfiguration({
  required String licenseConfigurationArn,
  List<Filter>? filters,
  int? maxResults,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(
      licenseConfigurationArn, 'licenseConfigurationArn');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSLicenseManager.ListUsageForLicenseConfiguration'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'LicenseConfigurationArn': licenseConfigurationArn,
      if (filters != null) 'Filters': filters,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListUsageForLicenseConfigurationResponse.fromJson(jsonResponse.body);
}