get method

Future<Inventory> get(
  1. String name, {
  2. String? view,
  3. String? $fields,
})

Get inventory data for the specified VM instance.

If the VM has no associated inventory, the message NOT_FOUND is returned.

Request parameters:

name - Required. API resource name for inventory resource. Format: projects/{project}/locations/{location}/instances/{instance}/inventory For {project}, either project-number or project-id can be provided. For {instance}, either Compute Engine instance-id or instance-name can be provided. Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/instances/\[^/\]+/inventory$.

view - Inventory view indicating what information should be included in the inventory resource. If unspecified, the default view is BASIC. Possible string values are:

  • "INVENTORY_VIEW_UNSPECIFIED" : The default value. The API defaults to the BASIC view.
  • "BASIC" : Returns the basic inventory information that includes os_info.
  • "FULL" : Returns all fields.

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

Completes with a Inventory.

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<Inventory> get(
  core.String name, {
  core.String? view,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (view != null) 'view': [view],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/' + core.Uri.encodeFull('$name');

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