- release_tracks: [GA, ALPHA]

  help_text:
    brief: Describe the inventory data for a Compute Engine VM instance.
    description: |
      Describe the inventory data for a Compute Engine VM instance.
    examples: |
      To describe the inventory of an instance `my-instance`
      that has the instance ID `5678` in the current project
      and location 'us-central1-a', run:

      $ {command} my-instance --location=us-central1-a

  request:
    collection: osconfig.projects.locations.instances.inventories
    # This command is implemented manually (without resources) so that
    # its help documentation specifically allows instance IDs as the first
    # positional paramater.
    #
    # Without this, a presubmit check will block this yaml file.
    disable_resource_check: true
    ALPHA:
      api_version: v1alpha
    GA:
      api_version: v1
    modify_request_hooks:
    - googlecloudsdk.command_lib.compute.os_config.inventories.declarative:SetNameOnDescribeRequestHook

  response:
    id_field: name
    modify_response_hooks:
    - googlecloudsdk.command_lib.compute.os_config.inventories.declarative:CreateDescribeTableViewResponseHook

  arguments:
    params:
    - arg_name: instance
      is_positional: true
      help_text: |
        ID or name of the Compute Engine VM instance to describe. For details on valid instance IDs,
        refer to the criteria documented under the field `id` at:
        https://cloud.google.com/compute/docs/reference/rest/v1/instances
    - arg_name: location
      help_text: |
        Location of the Compute Engine VM instance to describe. If not specified, the property
        `compute/zone` is used. For details on setting properties,
        see: https://cloud.google.com/sdk/docs/properties
    - api_field: view
      help_text: |
        Specifies what information should be included in the
        output. If unspecified, the default view is `basic`.
      choices:
      - arg_value: basic
        enum_value: BASIC
        help_text: Output is limited to operating system details.
      - arg_value: full
        enum_value: FULL
        help_text: Output includes operating system details and package information.
  output:
    format: |
      multi(
        installed_packages.yumPackage:format=
          "table[box,title='Installed Packages (Yum)']
            (package_name:sort=1,architecture,version)",
        installed_packages.aptPackage:format=
          "table[box,title='Installed Packages (Apt)']
            (package_name:sort=1,architecture,version)",
        installed_packages.zypperPackage:format=
          "table[box,title='Installed Packages (Zypper)']
            (package_name:sort=1,architecture,version)",
        installed_packages.googetPackage:format=
          "table[box,title='Installed Packages (GooGet)']
            (package_name:sort=1,architecture,version)",
        installed_packages.cosPackage:format=
          "table[box,title='Installed Packages (COS)']
            (package_name:sort=1,architecture,version)",
        installed_packages.zypperPatch:format=
          "table[box,title='Installed Patches (Zypper Patch)']
            (patch_name:sort=1,category,severity,summary)",
        installed_packages.wuaPackage:format=
          "table[all-box,title='Installed Packages (Windows Update Agent)']
            (title:sort=1:wrap,categories.extract(name).flatten(separator=', '):wrap,kb_article_ids.list(),support_url)",
        installed_packages.qfePackage:format=
          "table[box,title='Installed Packages (Quick Fix Engineering)']
            (caption:sort=1,description,hot_fix_id,install_time)",
        installed_packages.windowsApplication:format=
          "table[box,title='Installed Packages (Windows Application)']
            (displayName:sort=1,displayVersion,publisher,installDate.date('%Y-%m-%d'))",
        updatedable_packages.yumPackage:format=
          "table[box,title='Package Updates Available (Yum)']
            (package_name:sort=1,architecture,version)",
        updatedable_packages.aptPackage:format=
          "table[box,title='Package Updates Available (Apt)']
            (package_name:sort=1,architecture,version)",
        updatedable_packages.zypperPackage:format=
          "table[box,title='Package Updates Available (Zypper)']
            (package_name:sort=1,architecture,version)",
        updatedable_packages.googetPackage:format=
          "table[box,title='Package Updates Available (GooGet)']
            (package_name:sort=1,architecture,version)",
        updatedable_packages.cosPackage:format=
          "table[box,title='Package Updates Available (COS)']
            (package_name:sort=1,architecture,version)",
        updatedable_packages.zypperPatch:format=
          "table[box,title='Patches Available (Zypper Patch)']
            (patch_name:sort=1,category,severity,summary)",
        updatedable_packages.wuaPackage:format=
          "table[all-box,title='Package Updates Available (Windows Update Agent)']
            (title:sort=1:wrap,categories.extract(name).flatten(separator=', '):wrap,kb_article_ids.list(),support_url)",
        updatedable_packages.qfePackage:format=
          "table[box,title='Package Updates Available (Quick Fix Engineering)']
            (caption:sort=1,description,hot_fix_id,install_time)",
        system_information:format="default
          (architecture,hostname,kernelRelease,kernelVersion,longName,osconfigAgentVersion,shortName,updateTime.date('%Y-%m-%dT%H:%M:%SZ'),version)"
      )
