- release_tracks: [GA, ALPHA]

  help_text:
    brief: Describe the vulnerability report data for a Compute Engine VM instance.
    description: |
      Describe the vulnerability report data for a Compute Engine VM instance.
    examples: |
      To describe the vulnerability report 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.vulnerabilityReports
    # 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.vulnerability_reports.declarative:SetNameOnDescribeRequestHook

  response:
    id_field: name
    modify_response_hooks:
    - googlecloudsdk.command_lib.compute.os_config.vulnerability_reports.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

  output:
    format: |
      multi(
        vulnerabilities:format=
          "table[box,title='Vulnerabilities']
            (details.cve:sort=1,details.severity,details.cvssV3.baseScore:label=CVSS_V3_SCORE,createTime.date('%Y-%m-%dT%H:%M:%SZ'))",
        report_information:format="default(name, updateTime.date('%Y-%m-%dT%H:%M:%SZ'))"
      )
