release_tracks: [ALPHA, BETA, GA]
help_text:
  brief: Seek a Pub/Sub Lite subscription.
  description: |
    Initiate an out-of-band seek operation for a Pub/Sub Lite subscription to a specified target,
    which may be timestamps or named locations within the message backlog.

    The seek operation will complete once subscriber clients react to the seek for all partitions of
    the topic. Note that the seek operation will not complete until subscribers are online. It may
    take some time (usually within 30 seconds) for the seek to propagate if subscribers are online.
    Use the --async flag if it's not necessary to wait for completion.
  examples: |
    To seek a Pub/Sub Lite subscription to the beginning of the message backlog, run:

        $ {command} mysubscription \
            --location=us-central1-a \
            --starting-offset=beginning

    To seek a Pub/Sub Lite subscription to a publish time without waiting for the operation to
    complete, run:

        $ {command} mysubscription \
            --location=us-central1-a \
            --publish-time="2021-01-01T12:00:00Z"
            --async

request:
  collection: pubsublite.admin.projects.locations.subscriptions
  method: seek
  modify_request_hooks:
  - googlecloudsdk.command_lib.pubsub.lite_util:UpdateAdminRequest
  - googlecloudsdk.command_lib.pubsub.lite_util:SetSeekTarget

async:
  collection: pubsublite.admin.projects.locations.operations
  # The response does not contain a resource. Print operation metadata instead.
  extract_resource_result: false

arguments:
  resource:
    help_text: Subscription to seek.
    spec: !REF googlecloudsdk.command_lib.pubsub.resources:lite_subscription

  params:
  - group:
      mutex: true
      required: true
      params:
      - _REF_: googlecloudsdk.command_lib.pubsub.flags:starting-offset
      - _REF_: googlecloudsdk.command_lib.pubsub.flags:publish-time
      - _REF_: googlecloudsdk.command_lib.pubsub.flags:event-time
