listVirtualMachines method

Future<ListVirtualMachinesOutput> listVirtualMachines({
  1. String? hypervisorArn,
  2. int? maxResults,
  3. String? nextToken,
})

Lists your virtual machines.

Parameter hypervisorArn : The Amazon Resource Name (ARN) of the hypervisor connected to your virtual machine.

Parameter maxResults : The maximum number of virtual machines to list.

Parameter nextToken : The next item following a partial list of returned resources. For example, if a request is made to return maxResults number of resources, NextToken allows you to return more items in your list starting at the location pointed to by the next token.

Implementation

Future<ListVirtualMachinesOutput> listVirtualMachines({
  String? hypervisorArn,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'BackupOnPremises_v20210101.ListVirtualMachines'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (hypervisorArn != null) 'HypervisorArn': hypervisorArn,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListVirtualMachinesOutput.fromJson(jsonResponse.body);
}