- release_tracks: [ALPHA, BETA, GA]

  help_text:
    brief: Update a Realm.
    description: |
      Update a Cloud Game Server Realm.

      ## EXAMPLES

      To update Realm 'my-realm' in project 'my-project' and location in 'my-location' with a new time-zone run:

        $ {command} my-realm --project=my-project --location=my-location --time-zone=EST --no-dry-run

      To preview Realm update for 'my-realm' in project 'my-project' and location in 'my-location' with a new time-zone run:

        $ {command} my-realm --project=my-project --location=my-location --time-zone=EST --dry-run

      To update labels for Realm 'my-realm' in project 'my-project' and location in 'my-location' run:

        $ {command} my-realm --project=my-project --location=my-location --update-labels="key1=val1" --no-dry-run

  request:
    collection: gameservices.projects.locations.realms
    ALPHA:
      api_version: v1alpha
    BETA:
      api_version: v1beta
    GA:
      api_version: v1
    method: previewUpdate
    modify_method_hook:
      googlecloudsdk.command_lib.game.servers.realms.update_hooks:ChooseUpdateOrPreviewMethod
    modify_request_hooks:
    - googlecloudsdk.command_lib.game.servers.realms.update_hooks:SetUpdateMask

  arguments:
    resource:
      help_text: Cloud Game Server Realm to update.
      spec: !REF googlecloudsdk.command_lib.game.resources:realm

    params:
    - arg_name: time-zone
      api_field: realm.timeZone
      help_text: |
        Time zone where all realm-specific policies are evaluated. The value of this field must be
        from the IANA time zone database: https://www.iana.org/time-zones.
    - arg_name: description
      api_field: realm.description
      help_text: |
        Description for the realm.
    - arg_name: dry-run
      type: bool
      required: true
      help_text: |
        Validate the changes, but do not execute it.
    - arg_name: preview-time
      api_field: previewTime
      help_text: |
        This attribute is only relevant for preview (--dry-run). It is used to validate
        the state for a future time.
    labels:
      api_field: realm.labels

  response:
    modify_response_hooks:
    - googlecloudsdk.command_lib.game.servers.realms.update_hooks:ConvertOutput

  update:
    read_modify_update: true
