diff --git a/site/content/en/docs/Guides/Client SDKs/local.md b/site/content/en/docs/Guides/Client SDKs/local.md index 7e622f5332..be524ccbd4 100644 --- a/site/content/en/docs/Guides/Client SDKs/local.md +++ b/site/content/en/docs/Guides/Client SDKs/local.md @@ -58,6 +58,22 @@ You should see output similar to the following: {"message":"gameserver update received","severity":"info","time":"2019-10-30T21:46:18.179459+03:00"} ``` +### Enabling Feature Gates + +For development and testing purposes, you might want to enable specific [features gates]({{% ref "/docs/Guides/feature-stages.md#feature-gates" %}}) in the local SDK Server. + +To do this, you can either set the `FEATURE_GATES` environment variable or use the `--feature-gates` command line parameter like so, with the same format as utilised when [configuring it on a Helm install]({{< ref "/docs/Installation/Install Agones/helm.md#configuration" >}}). + +For example: + +```bash +./sdk-server.linux.amd64 --local --feature-gates Example=true +``` +or +```bash +FEATURE_GATES=Example=true ./sdk-server.linux.amd64 --local +``` + ## Providing your own `GameServer` configuration for local development By default, the local sdk-server will create a default `GameServer` configuration that is used for `GameServer()` @@ -207,6 +223,7 @@ go run cmd/sdk-server/main.go --local Commandline flags (e.g. `--local`) are exactly the same as command line flags when utilising a pre-built binary. + ## Next Steps: - Learn how to connect your local development game server binary into a running Agones Kubernetes cluster for even more live development options with an [out of cluster dev server]({{< ref "/docs/Advanced/out-of-cluster-dev-server.md" >}}). diff --git a/site/content/en/docs/Guides/Client SDKs/rest.md b/site/content/en/docs/Guides/Client SDKs/rest.md index 26861484f7..31d6bcfba9 100644 --- a/site/content/en/docs/Guides/Client SDKs/rest.md +++ b/site/content/en/docs/Guides/Client SDKs/rest.md @@ -238,6 +238,105 @@ Apply an Annotation with the prefix "agones.dev/sdk-" to the backing `GameServer curl -d '{"key": "foo", "value": "bar"}' -H "Content-Type: application/json" -X PUT http://localhost:${AGONES_SDK_HTTP_PORT}/metadata/annotation ``` +### Counters and Lists + +{{< alpha title="Counters and Lists" gate="CountsAndLists" >}} + +#### Counters + +In all the Counter examples, we retrieve the counter under the key `rooms` as if it was previously defined in [`GameServer.Spec.counters[room]`]({{< ref "/docs/Reference/agones_crd_api_reference.html#agones.dev/v1.GameServerSpec" >}}). + +For your own Counter REST requests, replace the value `rooms` with your own key in the path. + +##### Alpha: GetCounter +This function retrieves a specified counter by its key, `rooms`, and returns its information. + +###### Example + +```bash +curl -H "Content-Type: application/json" -X GET http://localhost:${AGONES_SDK_HTTP_PORT}/v1alpha1/counters/rooms +``` + +Response: +```json +{"name":"rooms", "count":"1", "capacity":"10"} +``` + +##### Alpha: UpdateCounter +This function updates the properties of the counter with the key `rooms`, such as its count and capacity, and returns the updated counter details. + +###### Example + +```bash +curl -d '{"count": "5", "capacity": "11"}' -H "Content-Type: application/json" -X PATCH http://localhost:${AGONES_SDK_HTTP_PORT}/v1alpha1/counters/rooms +``` + +Response: +```json +{"name":"rooms", "count":"5", "capacity":"11"} +``` + +#### Lists + +In all the List examples, we retrieve the list under the key `players` as if it was previously defined in [`GameServer.Spec.lists[players]`]({{< ref "/docs/Reference/agones_crd_api_reference.html#agones.dev/v1.GameServerSpec" >}}). + +For your own List REST based requests, replace the value `players` with your own key in the path. + +##### Alpha: GetList +This function retrieves the list's properties with the key `players`, returns the list's information. + +###### Example +```bash +curl -H "Content-Type: application/json" -X GET http://localhost:${AGONES_SDK_HTTP_PORT}/v1alpha1/lists/players +``` + +Response: +```json +{"name":"players", "capacity":"100", "values":["player0", "player1", "player2"]} +``` + +##### Alpha: UpdateList +This function updates the list's properties with the key `players`, such as its capacity and values, returns the updated list details. This will overwrite all existing List.Values with the update list request values. Use addValue or removeValue for modifying the List.Values field. + +###### Example + +```bash +curl -d '{"capacity": "120", "values": ["player3", "player4"]}' -H "Content-Type: application/json" -X PATCH http://localhost:${AGONES_SDK_HTTP_PORT}/v1alpha1/lists/players +``` + +Response: +```json +{"name":"players", "capacity":"120", "values":["player3", "player4"]} +``` + +##### Alpha: AddListValue +This function adds a new value to a list with the key `players` and returns the list with this addition. + +###### Example + +```bash +curl -d '{"value": "player9"}' -H "Content-Type: application/json" -X POST http://localhost:${AGONES_SDK_HTTP_PORT}/v1alpha1/lists/players:addValue +``` + +Response: +```json +{"name":"players", "capacity":"120", "values":["player3", "player4", "player9"]} +``` + +##### Alpha: RemoveListValue +This function removes a value from the list with the key `players` and returns updated list. + +###### Example + +```bash +curl -d '{"value": "player3"}' -H "Content-Type: application/json" -X POST http://localhost:${AGONES_SDK_HTTP_PORT}/v1alpha1/lists/players:removeValue +``` + +Response: +```json +{"name":"players", "capacity":"120", "values":["player4", "player9"]} +``` + ### Player Tracking {{< alpha title="Player Tracking" gate="PlayerTracking" >}} @@ -305,6 +404,8 @@ Response: This function retrieves the current player count. This is always accurate from what has been set through this SDK, even if the value has yet to be updated on the GameServer status resource. +##### Example + ```bash curl -H "Content-Type: application/json" -X GET http://localhost:${AGONES_SDK_HTTP_PORT}/alpha/player/count ``` @@ -314,8 +415,6 @@ Response: {"count":"2"} ``` -##### Example - #### Alpha: IsPlayerConnected This function returns if the playerID is currently connected to the GameServer. This is always accurate from what has