- release_tracks: [ALPHA, BETA, GA]
  help_text:
    brief: |
      List Dataproc Metastore operations.
    description: |
      List all Metastore operations under the specified location.

      To specify the maximum number of operations to list, use the --limit flag.
    examples: |
      To list up to five operations in location
      `us-central1`, run:

        $ {command} --location=us-central1 --limit=5

      To list all operations in all locations,
      run:

        $ {command} --location=-

  arguments:
    resource:
      spec: !REF googlecloudsdk.command_lib.metastore.resources:location
      help_text: |
        The location of the operations to display.

  request:
    ALPHA:
      api_version: v1alpha
    BETA:
      api_version: v1beta
    GA:
      api_version: v1
    collection: metastore.projects.locations.operations

  response:
    id_field: name

  output:
    format: |
     table(
        name.basename():label=OPERATION_NAME,
        name.segment(3):label=LOCATION,
        metadata.verb:label=TYPE,
        metadata.target.basename(),
        done,
        metadata.createTime.date():sort=1,
        duration(start=metadata.createTime,end=metadata.endTime,precision=0,calendar=false).slice(2:).join("").yesno(no="<1S"):label=DURATION
      )
