- release_tracks: [ALPHA, BETA]

  help_text:
    brief: Update a backup.
    description: |
      Update a Backup for GKE backup.

      ## EXAMPLES

      To update a backup ``my-backup'' in project ``my-project'' in location ``us-central1'' under backup plan ``my-backup-plan'' to add new description, run:

        $ {command} 'my-backup' --backup-plan=my-backup-plan --project=my-project --location=us-central1 --description="New description"

  request:
    collection: gkebackup.projects.locations.backupPlans.backups
    api_version: v1

  async:
    collection: gkebackup.projects.locations.operations

  arguments:
    resource:
      help_text: |
        Name of the backup to update. The name may be provided either as a relative name, e.g.
        `projects/<project>/locations/<location>/backupPlans/<backupPlan>/backups/<backup>`
        or as a single ID name (with the parent resources provided via options or through
        properties), e.g.
        `BACKUP --project=<project> --location=<location> --backup-plan=<backupPlan>`.
      spec: !REF googlecloudsdk.command_lib.container.backup_restore.resources:backup

    params:
    - _REF_: googlecloudsdk.command_lib.container.backup_restore.flags:backup_etag
    - arg_name: description
      api_field: backup.description
      type: str
      help_text: |
        Optional text description for the backup.
    - arg_name: retain-days
      api_field: backup.retainDays
      type: int
      help_text: |
        Retain days specifies the desired number of days from the createTime of
        this backup after which it will be automatically deleted.
        If not specified or set to 0, it means the backup will NOT be
        automatically deleted.
        Manual creation of a backup with this field unspecified causes the
        service to use the value of backupPlan.retentionPolicy.backupRetainDays.
        Creation of a backup with this field set to a value SMALLER than
        deleteLockDays results in an invalid response from the service.
        This field may ONLY be increased in an Update command, or an invalid
        response will be returned by the service immediately.
        Default to 0.
    - arg_name: delete-lock-days
      api_field: backup.deleteLockDays
      type: int
      help_text: |
        Delete lock days specifies the number of days from the createTime of this
        Backup before which deletion will be blocked. Must be >= the value in
        the backup plan. If not specified, inherited from the backup plan.
        Manual creation of a backup with this field unspecified causes the service
        to use the value of backupPlan.RetentionPolicy.backupDeleteBlockDays.
        Creation of a backup with this field set to a value SMALLER than
        backupPlan.RetentionPolicy.backupDeleteBlockDays results in an invalid
        response from the service.
        This field MUST be an int value between 0-90(inclusive).
        This field may only be INCREASED in an update command, or an invalid
        response will be returned by the service.

    labels:
      api_field: backup.labels

  update:
    read_modify_update: true
