- release_tracks: [ALPHA, BETA, GA]

  help_text:
    brief: Create a Game Server Config.
    description: |
      Create a Cloud Game Server Config for a Game Server Deployment.

      ## EXAMPLES

      To create Game Server Config 'my-config' in project 'my-project', deployment 'my-deployment', and location in 'global'(configs only support the 'global' location) run:

        $ {command} my-config --project=my-project --deployment=my-deployment --location=global \
            --deployment=my-deployment --description=description --labels=a=x,b=y \
            --fleet-configs-file=fleet_configs.json

    help_text: |
      Config resource - Cloud Game Server Config to create. The arguments in this group can be used
      to specify the attributes of this resource.
      In order to start a new rollout, you should first
      create a game server config that includes the fleet spec that will be sent to Agones during
      rollout. The fleet spec file argument is a path to a JSON or YAML file that follows the format
      of the spec field in Agones Fleet custom resource. Please see
      https://agones.dev/site/docs/reference/fleet/ for more details. Game Server Config also has
      optinal Scaling Config definitions which can be used to define the scaling configs, which
      include fleet auto scaler spec that wil lbe sent to Agones during rollout. The fleet auto
      scaler file is a path to a JSON or YAML that follows the format of the spec field in Agones
      Fleet Autoscaler custom resource. Please see Autoscaler
      https://agones.dev/site/docs/reference/fleetautoscaler/ for more details. The scaling config
      object can have schedule definitions that can be used to apply different scaling configs based
      on the specified schedule.

  request:
    collection: gameservices.projects.locations.gameServerDeployments.configs
    ALPHA:
      api_version: v1alpha
    BETA:
      api_version: v1beta
    GA:
      api_version: v1

    modify_request_hooks:
    - googlecloudsdk.command_lib.game.servers.configs.create_hooks:ProcessConfigsFiles

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

    params:
    - arg_name: description
      api_field: gameServerConfig.description
      help_text: |
        Game server config description.
    - _REF_: googlecloudsdk.command_lib.game.servers.flags:fleet_configs_file
      help_text: |
        Path to a JSON or YAML file that contains fleet configs. The fleet spec
        field in configs file follows Agones Fleet custom resource. Please see
        https://github.com/googleforgames/agones/blob/master/examples/simple-udp/fleet.yaml
        for example and
        https://agones.dev/site/docs/reference/fleet/
        for Fleet Spec definition.
    - _REF_: googlecloudsdk.command_lib.game.servers.flags:scaling_configs_file
      help_text: |
        Path to a JSON or YAML file that contains scaling configs. The fleet autoscaler spec
        field in configs file follows Agones Fleet Autoscaler custom resource. Please see
        https://github.com/googleforgames/agones/blob/master/examples/simple-udp/fleetautoscaler.yaml
        for example and
        https://agones.dev/site/docs/reference/fleetautoscaler/
        for Fleet Autoscaler Spec definition. Scaling config file can also specifies schedules.
        Contents of a sample yaml file:

              ```
                - fleetAutoscalerSpec:
                    policy:
                      type: Buffer
                      buffer:
                        bufferSize: 10
                        minReplicas: 10
                        maxReplicas: 20
                  name: scaling-config-2
                  schedules:
                  - startTime: '2020-01-01T01:00:00Z'
                    endTime: '2020-01-02T01:00:00Z'
                    cronSpec: '0 9 * * *'
                    cronJobDuration: 3600s
                - fleetAutoscalerSpec:
                    policy:
                      type: Buffer
                      buffer:
                        bufferSize: 2
                        minReplicas: 2
                        maxReplicas: 4
                  name: scaling-config-1
              ```
    labels:
      api_field: gameServerConfig.labels

  async:
    collection: gameservices.projects.locations.operations
