- release_tracks: [ALPHA, BETA, GA]

  help_text:
    brief: Create a Game Server Cluster.
    description: |
      Create a Cloud Game Server Cluster.

      ## EXAMPLES

      To create Game Server Cluster 'my-cluster' in project 'my-project', realm 'my-realm', and location in 'my-location' run:

        $ {command} my-cluster --project=my-project --realm=my-realm --location=my-location \
            --gke-cluster=projects/my-project/locations/my-location/clusters/my-gke-cluster \
            --namespace=default --labels=a=x,b=y --no-dry-run

      To preview Game Server Cluster creation for 'my-cluster' in project 'my-project', realm 'my-realm', and location in 'my-location' run:

        $ {command} my-cluster --project=my-project --realm=my-realm --location=my-location \
            --gke-cluster=projects/my-project/locations/my-location/clusters/my-gke-cluster \
            --namespace=default --labels=a=x,b=y --dry-run


  request:
    collection: gameservices.projects.locations.realms.gameServerClusters
    method: previewCreate
    modify_method_hook:
      googlecloudsdk.command_lib.game.servers.clusters.update_hooks:ChooseCreateOrPreviewMethod
    ALPHA:
      api_version: v1alpha
    BETA:
      api_version: v1beta
    GA:
      api_version: v1

  arguments:
    resource:
      help_text: Cloud Game Server Cluster to create.
      spec: !REF googlecloudsdk.command_lib.game.resources:cluster

    params:
    - arg_name: gke-cluster
      api_field: gameServerCluster.connectionInfo.gkeClusterReference.cluster
      required: true
      help_text: |
        Full or partial name of a cluster in Google Kubernetes Engine (GKE) where the game server
        cluster is installed, using the format:
        'projects/{project_id}/locations/{location_id}/clusters/{cluster_id}'.
        Note, the location of the GKE cluster can be either a region or a zone.
        Example: 'projects/my-project/locations/us-central1/clusters/test'. If project and location
        are not specified, the project and location of the Game Server Cluster resource are used to
        generate the full name of the GKE cluster.
    - arg_name: description
      api_field: gameServerCluster.description
      help_text: |
        Game server cluster description.
    - arg_name: namespace
      api_field: gameServerCluster.connectionInfo.namespace
      required: true
      help_text: |
        Namespace for Kubernetes API server endpoint.
    - arg_name: dry-run
      type: bool
      required: true
      help_text: |
        Validate the creation, 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.
    - arg_name: allocation-weight
      release_tracks: [ALPHA]
      api_field: gameServerCluster.allocationWeight
      hidden: true
      help_text: |
        The Allocation weight assigned to the game server cluster.
        Allocation weight is used to control a single cluster's allocation load
        ratio, from 0 (allocation disabled) to 100 (its full expected load).

        For example, if there are two clusters in a realm where each expects to
        receive 500 units of allocations eventually. The ratio does not represent
        the load ratio across the realm (1000), but the percentage of traffic of
        the cluster (500). Any overflow is load balanced across the clusters
        according to the weight.
    labels:
      api_field: gameServerCluster.labels

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