diff --git a/docs/FAQ.md b/docs/FAQ.md index 4b692e42..8ab6240a 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -1,7 +1,7 @@ --- layout: default title: Frequently Asked Questions -nav_order: 14 +nav_order: 15 --- # Frequently Asked Questions diff --git a/docs/contributing.md b/docs/contributing.md index e639ec98..ffe211f5 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -1,7 +1,7 @@ --- layout: default title: Contributing -nav_order: 12 +nav_order: 13 --- # Contributing Guide diff --git a/docs/development.md b/docs/development.md index 25e5fcea..53e87506 100644 --- a/docs/development.md +++ b/docs/development.md @@ -1,7 +1,7 @@ --- layout: default title: Development -nav_order: 13 +nav_order: 14 --- # Development diff --git a/docs/gameserverapi/README.md b/docs/gameserverapi/README.md new file mode 100644 index 00000000..6c1f469d --- /dev/null +++ b/docs/gameserverapi/README.md @@ -0,0 +1,16 @@ +--- +layout: default +title: GameServer API +nav_order: 9 +has_children: true +--- + +# GameServer API + +The GameServer API is a RESTful API service that facilitates access to Thundernetes' Custom Resources: GameServerBuilds, GameServers, and GameServerDetails. It is an alternative for people who don't want to use tools like [kubectl](https://kubernetes.io/docs/reference/kubectl/kubectl/), and an easy way to integrate Thundernetes to your own applications. It also allows you to use our [Thundernetes UI](../thundernetesui/README.md). + +## How to install the GameServer API + +We provide a [Docker image](https://github.com/PlayFab/thundernetes/pkgs/container/thundernetes-gameserverapi) with the API, you have to deploy it into your cluster along with Thundernetes. We also have an [example YAML file](https://github.com/PlayFab/thundernetes/blob/main/cmd/gameserverapi/deployment/default/deploy.yaml) for the deployment, all you have to do is change the name of the container image for the latest version and run ```kubectl apply -f deploy.yaml```. This example uses a LoadBalancer to expose the application, so it will be assigned an external IP (this doesn't work locally unless you have a local implementation of a LoadBalancer, you can use [port forwarding](https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/) instead). + +> **_NOTE_**: The GameServer API provides direct access to your Thundernetes resources, we delegate the securing of the service to the user, for example, you can [use an Ingress](../howtos/serviceingress.md). diff --git a/docs/gameserverapi/apidocs.md b/docs/gameserverapi/apidocs.md new file mode 100644 index 00000000..a171f5e4 --- /dev/null +++ b/docs/gameserverapi/apidocs.md @@ -0,0 +1,775 @@ +--- +layout: default +title: GameServer API documentation +parent: GameServer API +nav_order: 1 +--- + +# GameServer API documentation + +## Game Server Builds + +### Create Game Server Build + +```POST /api/v1/gameserverbuilds/``` + +
+ + Create a Game Server Build in the cluster. + + * **URL Params** + + None + + * **Body** + + ```js + { + apiVersion: "mps.playfab.com/v1alpha1", + kind: "GameServerBuild", + metadata: { + name: string, + namespace: string | undefined, + }, + spec: { + buildID: string, + standingBy: number, + max: number, + portsToExpose: Array, + crashesToMarkUnhealthy: number | undefined, + template: any + }, + status: { + currentActive: number, + currentStandingBy: number, + crashesCount: number, + currentPending: number, + currentInitializing: number, + health: string, + currentStandingByReadyDesired: string, + } + } + ``` + + * **Success Response** + + * **Code:** 200 + + **Body:** + + ```js + { + apiVersion: "mps.playfab.com/v1alpha1", + kind: "GameServerBuild", + metadata: { + name: string, + namespace: string, + }, + spec: { + buildID: string, + standingBy: number, + max: number, + portsToExpose: Array, + crashesToMarkUnhealthy: number | undefined, + template: any + }, + status: { + currentActive: number, + currentStandingBy: number, + crashesCount: number, + currentPending: number, + currentInitializing: number, + health: string, + currentStandingByReadyDesired: string, + } + } + ``` + + * **Error Response** + + * **Code:** 400 + + **Body:** + + ```js + {"error": error message} + ``` + + OR + + * **Code:** 500 + + **Body:** + + ```js + {"error": error message} + ``` + +
+ +
+ +### List Game Server Builds + +```GET /api/v1/gameserverbuilds/``` + +
+ + List all the Game Server Builds in the cluster. + + * **URL Params** + + None + + * **Body** + + None + + * **Success Response** + + * **Code:** 200 + + **Body:** + + ```js + [ + { + apiVersion: "mps.playfab.com/v1alpha1", + kind: "GameServerBuild", + metadata: { + name: string, + namespace: string, + }, + spec: { + buildID: string, + standingBy: number, + max: number, + portsToExpose: Array, + crashesToMarkUnhealthy: number | undefined, + template: any + }, + status: { + currentActive: number, + currentStandingBy: number, + crashesCount: number, + currentPending: number, + currentInitializing: number, + health: string, + currentStandingByReadyDesired: string, + } + }, + ... + ] + ``` + + * **Error Response** + + * **Code:** 500 + + **Body:** + + ```js + {"error": error message} + ``` + +
+ +
+ +### Get a Game Server Build + +```GET /api/v1/gameserverbuilds/:namespace/:buildName``` + +
+ + Get a single Game Server Build from the cluster. + + * **URL Params** + + * ```namespace```: the Kubernetes namespace of the Game Server Build + + * ```buildName```: the name of the Game Server Build + + * **Body** + + None + + * **Success Response** + + * **Code:** 200 + + **Body:** + + ```js + { + apiVersion: "mps.playfab.com/v1alpha1", + kind: "GameServerBuild", + metadata: { + name: string, + namespace: string, + }, + spec: { + buildID: string, + standingBy: number, + max: number, + portsToExpose: Array, + crashesToMarkUnhealthy: number | undefined, + template: any + }, + status: { + currentActive: number, + currentStandingBy: number, + crashesCount: number, + currentPending: number, + currentInitializing: number, + health: string, + currentStandingByReadyDesired: string, + } + } + ``` + + * **Error Response** + + * **Code:** 404 + + **Body:** + + ```js + {"error": error message} + ``` + + OR + + * **Code:** 500 + + **Body:** + + ```js + {"error": error message} + ``` + +
+ +
+ +### Patch a Game Server Build + +```PATCH /api/v1/gameserverbuilds/:namespace/:buildName``` + +
+ + Patch the standingBy and max values of a Game Server Build from the cluster. + + * **URL Params** + + * ```namespace```: the Kubernetes namespace of the Game Server Build + + * ```buildName```: the name of the Game Server Build + + * **Body** + + ```js + { + "standingBy": int, + "max": int + } + ``` + + * **Success Response** + + * **Code:** 200 + + **Body:** + + ```js + { + apiVersion: "mps.playfab.com/v1alpha1", + kind: "GameServerBuild", + metadata: { + name: string, + namespace: string, + }, + spec: { + buildID: string, + standingBy: number, + max: number, + portsToExpose: Array, + crashesToMarkUnhealthy: number | undefined, + template: any + }, + status: { + currentActive: number, + currentStandingBy: number, + crashesCount: number, + currentPending: number, + currentInitializing: number, + health: string, + currentStandingByReadyDesired: string, + } + } + ``` + + * **Error Response** + + * **Code:** 400 + + **Body:** + + ```js + {"error": error message} + ``` + + OR + + * **Code:** 404 + + **Body:** + + ```js + {"error": error message} + ``` + + OR + + * **Code:** 500 + + **Body:** + + ```js + {"error": error message} + ``` + +
+ +
+ +### Delete a Game Server Build + +```DELETE /api/v1/gameserverbuilds/:namespace/:buildName``` + +
+ + Delete a Game Server Build from the cluster. + + * **URL Params** + + * ```namespace```: the Kubernetes namespace of the Game Server Build + + * ```buildName```: the name of the Game Server Build + + * **Body** + + None + + * **Success Response** + + * **Code:** 200 + + **Body:** + + ```js + {"message": "Game server build deleted"} + ``` + + * **Error Response** + + * **Code:** 404 + + **Body:** + + ```js + {"error": error message} + ``` + + OR + + * **Code:** 500 + + **Body:** + + ```js + {"error": error message} + ``` + +
+ +
+ +
+ +## Game Servers + +### List Game Servers + +```GET /api/v1/gameservers/``` + +
+ + List all the Game Servers in the cluster. + + * **URL Params** + + None + + * **Body** + + None + + * **Success Response** + + * **Code:** 200 + + **Body:** + + ```js + [ + { + apiVersion: "mps.playfab.com/v1alpha1", + kind: "GameServer", + metadata: { + name: string, + namespace: string + }, + status: { + state: string, + health: string, + publicIP: string, + ports: string, + nodeName: string + } + }, + ... + ] + ``` + + * **Error Response** + + * **Code:** 500 + + **Body:** + + ```js + {"error": error message} + ``` + +
+ +
+ +### List the Game Servers from a Game Server Build + +```GET /api/v1/gameserverbuilds/:namespace/:buildName/gameservers``` + +
+ + List the Game Servers owned by a specific Game Server Build. + + * **URL Params** + + * ```namespace```: the Kubernetes namespace of the Game Server Build + + * ```buildName```: the name of the Game Server Build + + * **Body** + + None + + * **Success Response** + + * **Code:** 200 + + **Body:** + + ```js + [ + { + apiVersion: "mps.playfab.com/v1alpha1", + kind: "GameServer", + metadata: { + name: string, + namespace: string + }, + status: { + state: string, + health: string, + publicIP: string, + ports: string, + nodeName: string + } + }, + ... + ] + ``` + + * **Error Response** + + * **Code:** 404 + + **Body:** + + ```js + {"error": error message} + ``` + + OR + + * **Code:** 500 + + **Body:** + + ```js + {"error": error message} + ``` + +
+ +
+ +### Get a Game Server + +```GET /api/v1/gameservers/:namespace/:gameServerName``` + +
+ + Get a single Game Server from the cluster. + + * **URL Params** + + * ```namespace```: the Kubernetes namespace of the Game Server + + * ```gameServerName```: the name of the Game Server + + * **Body** + + None + + * **Success Response** + + * **Code:** 200 + + **Body:** + + ```js + { + apiVersion: "mps.playfab.com/v1alpha1", + kind: "GameServer", + metadata: { + name: string, + namespace: string + }, + status: { + state: string, + health: string, + publicIP: string, + ports: string, + nodeName: string + } + } + ``` + + * **Error Response** + + * **Code:** 404 + + **Body:** + + ```js + {"error": error message} + ``` + + OR + + * **Code:** 500 + + **Body:** + + ```js + {"error": error message} + ``` + +
+ +
+ +### Delete a Game Server + +```DELETE /api/v1/gameservers/:namespace/:gameServerName``` + +
+ + Delete a Game Server from the cluster. + + * **URL Params** + + * ```namespace```: the Kubernetes namespace of the Game Server + + * ```gameServerName```: the name of the Game Server + + * **Body** + + None + + * **Success Response** + + * **Code:** 200 + + **Body:** + + ```js + {"message": "Game server deleted"} + ``` + + * **Error Response** + + * **Code:** 404 + + **Body:** + + ```js + {"error": error message} + ``` + + OR + + * **Code:** 500 + + **Body:** + + ```js + {"error": error message} + ``` + +
+ +
+ +
+ +## Game Server Details + +### List the Game Server Details from a Game Server Build + +```GET /api/v1/gameserverbuilds/:namespace/:buildName/gameserverdetails``` + +
+ + List the Game Server Details owned by a specific Game Server Build. + + * **URL Params** + + * ```namespace```: the Kubernetes namespace of the Game Server Build + + * ```buildName```: the name of the Game Server Build + + * **Body** + + None + + * **Success Response** + + * **Code:** 200 + + **Body:** + + ```js + { + apiVersion: "mps.playfab.com/v1alpha1", + kind: "GameServerDetail", + metadata: { + name: string, + namespace: string + }, + spec: { + connectedPlayersCount: number, + connectedPlayers: Array + } + } + ``` + + * **Error Response** + + * **Code:** 404 + + **Body:** + + ```js + {"error": error message} + ``` + + OR + + * **Code:** 500 + + **Body:** + + ```js + {"error": error message} + ``` + +
+ +
+ +### Get a Game Server Detail + +```GET /api/v1/gameserverdetails/:namespace/:gameServerDetailName``` + +
+ + Get a single Game Server Detail from the cluster. + + * **URL Params** + + * ```namespace```: the Kubernetes namespace of the Game Server Detail + + * ```gameServerDetailName```: the name of the Game Server Detail + + * **Body** + + None + + * **Success Response** + + * **Code:** 200 + + **Body:** + + ```js + [ + { + apiVersion: "mps.playfab.com/v1alpha1", + kind: "GameServerDetail", + metadata: { + name: string, + namespace: string + }, + spec: { + connectedPlayersCount: number, + connectedPlayers: Array + } + }, + ... + ] + ``` + + * **Error Response** + + * **Code:** 404 + + **Body:** + + ```js + {"error": error message} + ``` + + OR + + * **Code:** 500 + + **Body:** + + ```js + {"error": error message} + ``` + +
diff --git a/docs/howtos/README.md b/docs/howtos/README.md index 7e43bc70..502aa1aa 100644 --- a/docs/howtos/README.md +++ b/docs/howtos/README.md @@ -1,7 +1,7 @@ --- layout: default title: How to's -nav_order: 10 +nav_order: 11 has_children: true --- diff --git a/docs/thundernetesui/README.md b/docs/thundernetesui/README.md index 3b2d5781..a1840943 100644 --- a/docs/thundernetesui/README.md +++ b/docs/thundernetesui/README.md @@ -1,7 +1,7 @@ --- layout: default title: Thundernetes UI -nav_order: 9 +nav_order: 10 has_children: true --- diff --git a/docs/troubleshooting/README.md b/docs/troubleshooting/README.md index e142594a..7e3c570c 100644 --- a/docs/troubleshooting/README.md +++ b/docs/troubleshooting/README.md @@ -1,7 +1,7 @@ --- layout: default title: Troubleshooting -nav_order: 11 +nav_order: 12 has_children: true ---