topic-name:
  api_field: topicId
  arg_name: topic
  required: true
  is_positional: true
  help_text: |
    Topic ID.

subscription-name:
  api_field: subscriptionId
  arg_name: subscription
  is_positional: true
  required: true
  help_text: |
    Subscription ID.

reservation-name:
  api_field: reservationId
  arg_name: reservation
  required: true
  is_positional: true
  help_text: |
    Reservation ID.

subscription-topic-name:
  api_field: subscription.topic
  arg_name: topic
  required: true
  help_text: |
    Topic ID associated with the subscription.

topic-throughput-reservation-name:
  api_field: topic.reservationConfig.throughputReservation
  arg_name: throughput-reservation
  is_positional: false
  help_text: |
    Reservation ID to use for topic throughput.

partitions:
  api_field: topic.partitionConfig.count
  arg_name: partitions
  help_text: |
    Number of partitions in the topic.

per-partition-publish-mib:
  api_field: topic.partitionConfig.capacity.publishMibPerSec
  arg_name: per-partition-publish-mib
  help_text: |
    Topic partition publish throughput capacity in MiB/s. Must be between 4 and 16.

per-partition-subscribe-mib:
  api_field: topic.partitionConfig.capacity.subscribeMibPerSec
  arg_name: per-partition-subscribe-mib
  help_text: |
    Topic partition subscribe throughput capacity in MiB/s. Must be between 4 and 32.

per-partition-bytes:
  api_field: topic.retentionConfig.perPartitionBytes
  arg_name: per-partition-bytes
  type: googlecloudsdk.core.util.scaled_integer:ParseInteger
  help_text: |
    Provisioned storage, in bytes, per partition. If the number of bytes
    stored in any of the topic's partitions exceeds this value, older
    messages will be dropped to make room for newer ones, regardless of the
    value of `message-retention-period`.
    A valid example value of this flag would be `per-partition-bytes=30GiB`.

message-retention-period:
  api_field: topic.retentionConfig.period
  arg_name: message-retention-period
  type: googlecloudsdk.core.util.times:ParseDuration
  processor: googlecloudsdk.command_lib.pubsub.lite_util:DurationToSeconds
  help_text: |
    How long a published message is retained. If unset, messages will only be
    dropped to make space for new ones once the `per-partition-bytes` limit is
    reached.
    A valid example value of this flag would be `message-retention-period="2w"`.

delivery-requirement:
  api_field: subscription.deliveryConfig.deliveryRequirement
  arg_name: delivery-requirement
  choices:
  - arg_value: deliver-immediately
    enum_value: DELIVER_IMMEDIATELY
  - arg_value: deliver-after-stored
    enum_value: DELIVER_AFTER_STORED
  help_text: |
    When this subscription should send messages to subscribers relative to
    messages persistence in storage.
    See https://cloud.google.com/pubsub/lite/docs/subscriptions#creating_lite_subscriptions
    for more info.

throughput-capacity:
  api_field: reservation.throughputCapacity
  arg_name: throughput-capacity
  help_text: |
    Reservation throughput capacity. Every unit of throughput capacity is equivalent to 1 MiB/s of
    published messages or 2 MiB/s of subscribed messages.


starting-offset:
  arg_name: starting-offset
  choices:
  - arg_value: beginning
  - arg_value: end
  type: googlecloudsdk.command_lib.util.hooks.types:LowerCaseType
  help_text: |
    The offset at which a newly created or seeked subscription starts receiving messages. A
    subscription can be initialized at the offset of the oldest retained message (`beginning`), or
    at the current HEAD offset (`end`).

publish-time:
  arg_name: publish-time
  type: googlecloudsdk.calliope.arg_parsers:Datetime.Parse
  help_text: |
    The publish time to which you seek a subscription. Messages with publish time greater than or
    equal to the specified time are delivered after the seek operation.
    Run $ gcloud topic datetimes for information on time formats.

event-time:
  arg_name: event-time
  type: googlecloudsdk.calliope.arg_parsers:Datetime.Parse
  help_text: |
    The event time to which you seek a subscription. The subscription seeks to the first message
    with event time greater than or equal to the specified event time. Messages missing an event
    time use publish time as a fallback. As event times are user supplied, subsequent messages may
    have event times less than the specified event time and must be filtered by the client, if
    necessary.
    Run $ gcloud topic datetimes for information on time formats.

operation-done:
  arg_name: done
  # Not a bool type to allow one of: true|false|unspecified
  choices:
  - arg_value: 'true'
  - arg_value: 'false'
  type: googlecloudsdk.command_lib.util.hooks.types:LowerCaseType
  help_text: |
    Filter operations by completion status. This flag is ignored if `--filter` is set.

operation-subscription:
  arg_name: subscription
  help_text: |
    Filter operations by target subscription. This flag is ignored if `--filter` is set.

partition:
  api_field: commitCursorRequest.partition
  arg_name: partition
  required: true
  help_text: |
    The topic partition. Partitions are zero indexed, so the partition must be in the range
    [0, topic.num_partitions). If you do not know your topic.num_partitions, run `gcloud pubsub
    lite-topic describe TOPIC --location=ZONE`.

offset:
  api_field: commitCursorRequest.cursor.offset
  arg_name: offset
  required: true
  help_text: |
    The offset of a message within a topic partition. Must be greater than or equal to 0.

export-pubsub-topic:
  api_field: subscription.exportConfig.pubsubConfig.topic
  arg_name: export-pubsub-topic
  help_text: |
    The name of the destination Pub/Sub topic to which messages are exported. Must be the topic's
    fully specified path if it is not in the same project as the subscription to be created.

export-desired-state:
  api_field: subscription.exportConfig.desiredState
  arg_name: export-desired-state
  choices:
  - arg_value: active
    enum_value: ACTIVE
  - arg_value: paused
    enum_value: PAUSED
  type: googlecloudsdk.command_lib.util.hooks.types:LowerCaseType
  help_text: |
    The desired state of the export. Process messages by setting the value to ACTIVE or pause
    message processing by setting the value to PAUSED.

export-dead-letter-topic:
  api_field: subscription.exportConfig.deadLetterTopic
  arg_name: export-dead-letter-topic
  help_text: |
    The name of the Pub/Sub Lite topic to write messages that cannot be exported. Must be in the
    same project and location as the subscription to be created. Note that this is a Lite topic.


# Deprecated flag, do not use
zone:
  arg_name: zone
  hidden: true
  help_text: |
    ID of the location of the Pub/Sub Lite resource.
  action:
    deprecated:
      removed: false
      warn: |
        zone is deprecated and will be removed in an upcoming release. Please use --location instead.
