- release_tracks: [ALPHA, BETA, GA]
  GA:
    hidden: true
  help_text:
    brief: |
      Apply software update to nodes in a Memorystore Memcached instance.
    description: |
      Apply a software update to nodes in a Memcached instance to the latest available software
      version.

      To check if a Memcache instance and its nodes have a new software update available, run:

        $ gcloud beta memcache instances describe my-memcache-instance --format="table(updateAvailable.yesno(),memcacheNodes:format='table(nodeId,updateAvailable.yesno())')" --region=us-central1

      Applying a software update to a node causes a full cache flush on that node.
    examples: |
      To apply software update to nodes 'node-1' and 'node-2' of a Memcached
      instance named 'my-memcache-instance' in region 'us-central1', run:

        $ {command} my-memcache-instance --node-ids=node-1,node-2 --region=us-central1

      To apply software update to all nodes of a Memcached instance named 'my-memcache-instance'
      in region 'us-central1', run:

        $ {command} my-memcache-instance --apply-all --region=us-central1

  arguments:
    resource:
      spec: !REF googlecloudsdk.command_lib.memcache.resources:instance
      help_text: |
        Arguments and flags that specify the Memcached instance on which to apply software update.
    params:
    - group:
        mutex: true
        required: true
        params:
        - arg_name: node-ids
          api_field: applySoftwareUpdateRequest.nodeIds
          type: arg_list
          help_text: |
            Nodes on which to apply the software update.
        - arg_name: apply-all
          api_field: applySoftwareUpdateRequest.applyAll
          help_text: |
            Apply the software update onto all nodes.

  async:
    collection: memcache.projects.locations.operations

  input:
    confirmation_prompt: |
      WARNING: Applying software update will cause a full cache flush to the selected nodes in
      instance [{__name__}] in [{locationsId}].

  request:
    api_version: v1beta2
    collection: memcache.projects.locations.instances
    method: applySoftwareUpdate
