- release_tracks: [ALPHA, BETA, GA]

  help_text:
    brief:
      Upgrade a Memorystore for Redis instance to a specified Redis version.
    description: |
      Upgrade a Memorystore for Redis instance to a specified Redis version.
    examples: |
      To upgrade an instance with the name `my-redis-instance` in region
      `us-central1` to Redis version 4.0 run:

        $ {command} my-redis-instance --region=us-central1 --redis-version=redis_4_0

  arguments:
    resource:
      spec: !REF googlecloudsdk.command_lib.redis.resources:instance
      help_text: |
        Arguments and flags that specify the Memorystore for Redis instance you want
        to upgrade.
    params:
    - arg_name: redis-version
      api_field: upgradeInstanceRequest.redisVersion
      required: true
      metavar: VERSION
      help_text: Target version of Redis software.
      choices:
      - enum_value: REDIS_4_0
        arg_value: redis_4_0
        help_text: Redis 4.0 compatibility
      - enum_value: REDIS_5_0
        arg_value: redis_5_0
        help_text: Redis 5.0 compatibility
      - enum_value: REDIS_6_X
        arg_value: redis_6_x
        help_text: Redis 6.x compatibility
      - enum_value: REDIS_7_0
        arg_value: redis_7_0
        help_text: Redis 7.0 compatibility
      - enum_value: REDIS_7_2
        arg_value: redis_7_2
        help_text: Redis 7.2 compatibility

  input:
    confirmation_prompt: |-
      WARNING: Upgrading will cause connection reset for Basic Tier instances and a failover for Standard Tier instances. The instance will also be temporarily unavailable. To prevent data loss, back up your instance before continuing. For more information, see "Behavior during version upgrade" section in the official Memorystore for Redis documentation.

  async:
    collection: redis.projects.locations.operations

  request:
    collection: redis.projects.locations.instances
    api_version: v1
    method: upgrade
