fetchInventory method

Future<FetchInventoryResponse> fetchInventory(
  1. String source, {
  2. bool? forceRefresh,
  3. int? pageSize,
  4. String? pageToken,
  5. String? $fields,
})

List remote source's inventory of VMs.

The remote source is the onprem vCenter (remote in the sense it's not in Compute Engine). The inventory describes the list of existing VMs in that source. Note that this operation lists the VMs on the remote source, as opposed to listing the MigratingVms resources in the vmmigration service.

Request parameters:

source - Required. The name of the Source. Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/sources/\[^/\]+$.

forceRefresh - If this flag is set to true, the source will be queried instead of using cached results. Using this flag will make the call slower.

pageSize - The maximum number of VMs to return. The service may return fewer than this value. For AWS source: If unspecified, at most 500 VMs will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. For VMWare source: If unspecified, all VMs will be returned. There is no limit for maximum value.

pageToken - A page token, received from a previous FetchInventory call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to FetchInventory must match the call that provided the page token.

$fields - Selector specifying which fields to include in a partial response.

Completes with a FetchInventoryResponse.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<FetchInventoryResponse> fetchInventory(
  core.String source, {
  core.bool? forceRefresh,
  core.int? pageSize,
  core.String? pageToken,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (forceRefresh != null) 'forceRefresh': ['${forceRefresh}'],
    if (pageSize != null) 'pageSize': ['${pageSize}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/' + core.Uri.encodeFull('$source') + ':fetchInventory';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return FetchInventoryResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}