- release_tracks: [ALPHA]

  help_text:
    brief: Describe the compliance states for OS policies that are applied to a VM.
    description: |
      Describe the compliance states for OS policies that are applied to a VM.
    examples: |
      To report the compliance state of an instance `my-instance`
      that has the instance ID `5678` in the current project
      and location `us-central1-a`, run:

      $ {command} 5678 --location=us-central1-a

  request:
    collection: osconfig.projects.locations.instanceOSPoliciesCompliances
    # 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
    modify_request_hooks:
    - googlecloudsdk.command_lib.compute.os_config.instance_os_policies_compliances.declarative:SetNameOnDescribeRequestHook
    ALPHA:
      api_version: v1alpha

  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 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: |
      default(
        detailedState,
        detailedStateReason,
        instance,
        lastComplianceCheckTime.date("%Y-%m-%dT%H:%M:%SZ"),
        lastComplianceRunId,
        name,
        osPolicyCompliances,
        state
      )
