- release_tracks: [ALPHA, GA]

  help_text:
    brief: Update an Edge Container cluster.
    description: |
      Update an Edge Container cluster.
    examples: |
      To update the maintenance window recurrence rule of a cluster called
      'my-cluster' in region us-central1, run:

        $ {command} my-cluster --location=us-central1 --maintenance-window-recurrence="FREQ=WEEKLY"

  request:
    collection: edgecontainer.projects.locations.clusters
    ALPHA:
      api_version: v1alpha
    GA:
      api_version: v1
    modify_request_hooks:
    - googlecloudsdk.command_lib.edge_cloud.container.container_runtime:UpdateContainerRuntimeclass
    - googlecloudsdk.command_lib.edge_cloud.container.cluster_isolation:UpdateClusterIsolation
    - googlecloudsdk.command_lib.edge_cloud.container.maintenance_policy:AddMaintenanceExclusionWindow
    - googlecloudsdk.command_lib.edge_cloud.container.maintenance_policy:RemoveMaintenanceExclusionWindow
    - googlecloudsdk.command_lib.edge_cloud.container.maintenance_policy:ClearMaintenanceWindow
    - googlecloudsdk.command_lib.edge_cloud.container.max_unavailable:ClearMaxUnavailable
    - googlecloudsdk.command_lib.edge_cloud.container.kms:UseGoogleManagedKey
    - googlecloudsdk.command_lib.edge_cloud.container.kms:UpdateKmsKey
    - googlecloudsdk.command_lib.edge_cloud.container.kms:UseGoogleManagedZoneKey
    - googlecloudsdk.command_lib.edge_cloud.container.kms:UpdateZoneKmsKey
    - googlecloudsdk.command_lib.edge_cloud.container.robin:HandleEnableRobinCNSUpdate

  arguments:
    resource:
      help_text: Edge Container cluster to update.
      spec: !REF googlecloudsdk.command_lib.edge_cloud.container.resources:cluster

    params:
    - group:
        mutex: true
        params:
        - arg_name: clear-maintenance-window
          action: store_true
          help_text: |
            If set, removes the maintenance window setting from the cluster. If any exclusion windows exist, they must be removed beforehand as a maintenance policy cannot exist without a maintenance window.
        - group:
            help_text: Updates cluster maintenance window setting (more than one flags can be specified from this group)
            mutex: false
            params:
            - arg_name: maintenance-window-start
              api_field: cluster.maintenancePolicy.window.recurringWindow.window.startTime
              repeated: false
              help_text: |
                Start time of the recurring cluster maintenance window in the [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339.txt)
                format. E.g. "2021-01-01T00:00:00Z" or "2021-01-01T00:00:00-05:00"
            - arg_name: maintenance-window-end
              api_field: cluster.maintenancePolicy.window.recurringWindow.window.endTime
              repeated: false
              help_text: |
                End time of the recurring cluster maintenance window in the [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339.txt)
                format. E.g. "2021-01-01T00:00:00Z" or "2021-01-01T00:00:00-05:00"
            - arg_name: maintenance-window-recurrence
              api_field: cluster.maintenancePolicy.window.recurringWindow.recurrence
              repeated: false
              help_text: |
                An [RFC 5545](https://tools.ietf.org/html/rfc5545#section-3.8.5.3)
                recurrence rule for how the cluster maintenance window recurs. They go
                on for the span of time between the start and the end time. E.g. FREQ=WEEKLY;BYDAY=SU.
        - arg_name: remove-maintenance-exclusion-window
          help_text: |
            Name of the maintenance exclusion to remove.
        - group:
            help_text: Add a maintenance exclusion window (all flags must be specified to add a valid maintenance exclusion window). There can be a maximum of 3 exclusion windows set at a given time. A maintenance exclusion window cannot be added in the absence of a maintenance window.
            mutex: false
            params:
            - arg_name: add-maintenance-exclusion-name
              repeated: false
              help_text: |
                Unique name (per cluster) of the maintenance exclusion window that can be used to remove it.
            - arg_name: add-maintenance-exclusion-start
              repeated: false
              help_text: |
                Start time of the maintenance exclusion window (can occur in the past) in the RFC 3339
                (https://www.rfc-editor.org/rfc/rfc3339.txt) format. E.g.
                "2021-01-01T00:00:00Z" or "2021-01-01T00:00:00-05:00".
            - arg_name: add-maintenance-exclusion-end
              repeated: false
              help_text: |
                End time of the maintenance exclusion window in the RFC 3339
                (https://www.rfc-editor.org/rfc/rfc3339.txt) format. E.g.
                "2021-01-01T00:00:00Z" or "2021-01-01T00:00:00-05:00".
    - arg_name: release-channel
      api_field: cluster.releaseChannel
      repeated: false
      help_text: |
        Release channel a cluster is subscribed to. It supports two values, NONE and REGULAR. NONE
        is used to opt out of any release channel. Clusters subscribed to the REGULAR channel will
        be automatically upgraded to versions that are considered GA quality, and cannot be manually
        upgraded.
    - arg_name: offline-reboot-ttl
      type: googlecloudsdk.core.util.times:ParseDuration
      processor: googlecloudsdk.core.util.times:FormatDurationForJson
      api_field: cluster.survivabilityConfig.offlineRebootTtl
      required: false
      help_text: |
        Specifies the maximum duration a node can reboot offline (without connection to Google) and
        then rejoin its cluster to resume its designated workloads. This duration is relative to the
        machine's most recent connection to Google. The maximum allowed duration is 7 days. If left
        unspecified, the default 0 means not allowed. The parameter should be an ISO 8601 duration
        string, for example, "P1DT1H2M3S".
    - group:
        release_tracks: [ALPHA]
        mutex: true
        params:
        - arg_name: clear-max-unavailable-worker-nodes
          action: store_true
          help_text: |
            Clear the worker node upgrade parallelism, which will default to the upgrade stage size.
        - arg_name: max-unavailable-worker-nodes
          api_field: cluster.upgradeSettings.maxUnavailableWorkerNodes
          help_text: |
            Set the worker node upgrade parallelism. The value must be between 1 and the worker node
            upgrade stage size, inclusively. If unset, the worker node upgrade parallelism defaults
            to the upgrade stage size. This value does not affect the control plane node upgrade
            parallelism.
    - group:
        mutex: true
        params:
        - arg_name: use-google-managed-key
          action: store_true
          help_text: |
            If set, use Google managed key for the cluster control plane nodes encryption.
        - arg_name: control-plane-kms-key
          repeated: false
          help_text: |
            If set, use the specified KMS key for the cluster control plane nodes encryption.
    - group:
        mutex: true
        params:
        - arg_name: use-google-managed-zone-key
          action: store_true
          help_text: |
            If set, use Google managed key for zone storage encryption.
        - arg_name: zone-storage-kms-key
          repeated: false
          help_text: |
            If set, use the specified KMS key for zone storage encryption.
    - arg_name: container-default-runtime-class
      repeated: false
      help_text: |
        If set, use the specified default container runtime class for the cluster.
    - arg_name: enable-robin-cns
      release_tracks: [ALPHA]
      hidden: true
      action: store_true
      help_text: |
        If set, Robin CNS will be enabled on the cluster.

        WARNING:
        Enabling Robin CNS is irreversible. Once enabled, it cannot be disabled.
        Enabling Robin CNS will take over all unused local Persistent Volumes (PVs)
        in the cluster. Any data on these PVs will be permanently lost.
    - arg_name: enable-cluster-isolation
      release_tracks: [ALPHA]
      repeated: false
      help_text: |
        If set to true, the cluster will be created in a secure cluster isolation mode.

  response:
    modify_response_hooks:
    - googlecloudsdk.command_lib.edge_cloud.container.print_warning:PrintWarning

  async:
    collection: edgecontainer.projects.locations.operations
    extract_resource_result: false

  update:
    read_modify_update: true
