createLicenseConfiguration method

Future<CreateLicenseConfigurationResponse> createLicenseConfiguration({
  1. required LicenseCountingType licenseCountingType,
  2. required String name,
  3. String? description,
  4. bool? disassociateWhenNotFound,
  5. int? licenseCount,
  6. bool? licenseCountHardLimit,
  7. List<String>? licenseRules,
  8. List<ProductInformation>? productInformationList,
  9. List<Tag>? tags,
})

Creates a license configuration.

A license configuration is an abstraction of a customer license agreement that can be consumed and enforced by License Manager. Components include specifications for the license type (licensing by instance, socket, CPU, or vCPU), allowed tenancy (shared tenancy, Dedicated Instance, Dedicated Host, or all of these), license affinity to host (how long a license must be associated with a host), and the number of licenses purchased and used.

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

Parameter licenseCountingType : Dimension used to track the license inventory.

Parameter name : Name of the license configuration.

Parameter description : Description of the license configuration.

Parameter disassociateWhenNotFound : When true, disassociates a resource when software is uninstalled.

Parameter licenseCount : Number of licenses managed by the license configuration.

Parameter licenseCountHardLimit : Indicates whether hard or soft license enforcement is used. Exceeding a hard limit blocks the launch of new instances.

Parameter licenseRules : License rules. The syntax is #name=value (for example, #allowedTenancy=EC2-DedicatedHost). The available rules vary by dimension, as follows.

  • Cores dimension: allowedTenancy | licenseAffinityToHost | maximumCores | minimumCores
  • Instances dimension: allowedTenancy | maximumCores | minimumCores | maximumSockets | minimumSockets | maximumVcpus | minimumVcpus
  • Sockets dimension: allowedTenancy | licenseAffinityToHost | maximumSockets | minimumSockets
  • vCPUs dimension: allowedTenancy | honorVcpuOptimization | maximumVcpus | minimumVcpus
The unit for licenseAffinityToHost is days and the range is 1 to 180. The possible values for allowedTenancy are EC2-Default, EC2-DedicatedHost, and EC2-DedicatedInstance. The possible values for honorVcpuOptimization are True and False.

Parameter productInformationList : Product information.

Parameter tags : Tags to add to the license configuration.

Implementation

Future<CreateLicenseConfigurationResponse> createLicenseConfiguration({
  required LicenseCountingType licenseCountingType,
  required String name,
  String? description,
  bool? disassociateWhenNotFound,
  int? licenseCount,
  bool? licenseCountHardLimit,
  List<String>? licenseRules,
  List<ProductInformation>? productInformationList,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(licenseCountingType, 'licenseCountingType');
  ArgumentError.checkNotNull(name, 'name');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSLicenseManager.CreateLicenseConfiguration'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'LicenseCountingType': licenseCountingType.toValue(),
      'Name': name,
      if (description != null) 'Description': description,
      if (disassociateWhenNotFound != null)
        'DisassociateWhenNotFound': disassociateWhenNotFound,
      if (licenseCount != null) 'LicenseCount': licenseCount,
      if (licenseCountHardLimit != null)
        'LicenseCountHardLimit': licenseCountHardLimit,
      if (licenseRules != null) 'LicenseRules': licenseRules,
      if (productInformationList != null)
        'ProductInformationList': productInformationList,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateLicenseConfigurationResponse.fromJson(jsonResponse.body);
}