createEntitlement method

Future<CreateEntitlementResponse> createEntitlement({
  1. required String connectorId,
  2. required EntitlementType entitlementType,
  3. required String environmentId,
  4. required List<String> vmIds,
  5. String? clientToken,
})

Creates a Windows Server License entitlement for virtual machines in an Amazon EVS environment using the provided vCenter Server connector. This is an asynchronous operation. Amazon EVS validates the specified virtual machines before starting usage tracking.

May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter connectorId : A unique ID for the connector associated with the entitlement.

Parameter entitlementType : The type of entitlement to create.

Parameter environmentId : A unique ID for the environment to create the entitlement in.

Parameter vmIds : The list of VMware vSphere virtual machine managed object IDs to create entitlements for.

Parameter clientToken : A unique, case-sensitive identifier that you provide to ensure the idempotency of the entitlement creation request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency.

Implementation

Future<CreateEntitlementResponse> createEntitlement({
  required String connectorId,
  required EntitlementType entitlementType,
  required String environmentId,
  required List<String> vmIds,
  String? clientToken,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AmazonElasticVMwareService.CreateEntitlement'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'connectorId': connectorId,
      'entitlementType': entitlementType.value,
      'environmentId': environmentId,
      'vmIds': vmIds,
      'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    },
  );

  return CreateEntitlementResponse.fromJson(jsonResponse.body);
}