Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/rivet.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
{
"path": "../lib/bolt",
},
{
"path": "../svc",
}
],
}
9 changes: 9 additions & 0 deletions errors/servers/servers_multiple_port_routers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name = "SERVERS_MULTIPLE_PORT_ROUTERS"
description = "Multiple server port routers were provided."
http_status = 400
---

# Multiple Server Port Routers

Multiple server port routers were provided.
9 changes: 9 additions & 0 deletions errors/servers/servers_multiple_runtimes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name = "SERVERS_MULTIPLE_RUNTIMES"
description = "Multiple server runtimes were provided."
http_status = 400
---

# Multiple Server Runtimes

Multiple server runtimes were provided.
10 changes: 10 additions & 0 deletions errors/servers/servers_must_specify_routing_type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name = "SERVERS_MUST_SPECIFY_ROUTING_TYPE"
description = "Must specify routing type."
http_status = 400
---

# Must Specify Routing Type

Must specify either `game_guard` or `host` routing type.

9 changes: 9 additions & 0 deletions errors/servers/servers_no_port_routers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name = "SERVERS_NO_PORT_ROUTERS"
description = "No port routers were provided."
http_status = 400
---

# No Port Routers

No port routers were provided.
9 changes: 9 additions & 0 deletions errors/servers/servers_no_runtime.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name = "SERVERS_NO_RUNTIME"
description = "No server runtime were provided."
http_status = 400
---

# No Server Runtime

No server runtime were provided.
9 changes: 9 additions & 0 deletions errors/servers/servers_server_not_found.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name = "SERVERS_SERVER_NOT_FOUND"
description = "Server not found."
http_status = 400
---

# Server Not Found

Server not found for the given ID.
10 changes: 10 additions & 0 deletions errors/servers/servers_unsupported_host_protocol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name = "SERVERS_UNSUPPORTED_HOST_PROTOCOL"
description = "Unsupported host protocol."
http_status = 400
---

# Unsupported Host Protocol

Host protocol must use the TCP or UDP protocol.

3 changes: 3 additions & 0 deletions fern/definition/cloud/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ types:
complete:
docs: Whether or not this build has completely been uploaded.
type: boolean
tags:
docs: Tags of this build
type: map<string, string>

CdnSiteSummary:
docs: A CDN site summary.
Expand Down
14 changes: 14 additions & 0 deletions fern/definition/cloud/games/tokens.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ service:
game_id:
type: uuid
response: CreateCloudTokenResponse
createServiceToken:
path: /games/{game_id}/tokens/service
method: POST
docs: Creates a new game service token.
path-parameters:
game_id:
type: uuid
response: CreateCloudTokenResponse

types:
CreateCloudTokenResponse:
Expand All @@ -22,3 +30,9 @@ types:
Slightly modified to include a description prefix and use Protobufs of
JSON.
type: string
CreateServiceTokenResponse:
properties:
token:
docs: |-
A JSON Web Token.
type: string
112 changes: 112 additions & 0 deletions fern/definition/servers/__package__.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json

imports:
commons: common.yml

service:
auth: true
base-path: /servers
endpoints:
get:
path: /{server_id}
method: GET
docs: Gets a dynamic server.
path-parameters:
server_id:
docs: The id of the server to destroy
type: uuid
response: GetServerResponse

create:
path: ""
method: POST
docs: Create a new dynamic server.
request:
body: CreateServerRequest
response: CreateServerResponse

destroy:
path: /{server_id}
method: DELETE
docs: Destroy a dynamic server.
path-parameters:
server_id:
docs: The id of the server to destroy
type: uuid
request:
name: DestroyServerRequest
query-parameters:
override_kill_timeout:
docs: >-
The duration to wait for in milliseconds before killing the server.
This should be used to override the default kill timeout if a faster
time is needed, say for ignoring a graceful shutdown.
type: optional<long>
response: DestroyServerResponse

list:
path: /list
method: GET
docs: >-
Lists all servers associated with the token used. Can be filtered by
tags in the query string.
request:
name: GetServersRequest
query-parameters:
tags: optional<string>
response: ListServersResponse

types:
GetServerResponse:
properties:
server: commons.Server

CreateServerRequest:
properties:
datacenter:
docs: The name ID of the datacenter
type: string
tags: unknown
image_id: uuid
arguments: optional<list<string>>
environment: optional<map<string, string>>
network: CreateServerNetworkRequest
resources: commons.Resources
kill_timeout:
docs: >-
The duration to wait for in milliseconds before killing the server.
This should be set to a safe default, and can be overridden during a
DELETE request if needed.
type: optional<long>
webhook_url:
docs: >-
A url to send to which events from the server running will be sent
type: optional<string>

CreateServerNetworkRequest:
properties:
mode: optional<commons.NetworkMode>
ports: map<string, CreateServerPortRequest>

CreateServerPortRequest:
properties:
protocol: commons.PortProtocol
internal_port: optional<integer>
routing: optional<commons.PortRouting>

CreateServerResponse:
properties:
server:
docs: The server that was created
type: commons.Server

DestroyServerResponse:
properties:
server_id:
type: uuid

ListServersResponse:
properties:
servers:
docs: A list of servers for the game associated with the token.
type: list<commons.Server>
81 changes: 81 additions & 0 deletions fern/definition/servers/builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json

imports:
commons: ../common.yml
uploadCommons: ../upload/common.yml
cloudCommons: ../cloud/common.yml

service:
auth: true
base-path: /servers
endpoints:
listBuilds:
path: /builds
method: GET
docs: >-
Lists all builds of the game associated with the token used. Can be
filtered by tags in the query string.
request:
name: GetBuildsRequest
query-parameters:
tags: optional<string>
response: ListBuildsResponse

prepareBuild:
path: /builds
method: POST
docs: Creates a new game build for the given game.
request:
body: CreateBuildRequest
response: CreateBuildResponse

completeBuild:
path: /uploads/{upload_id}/complete
method: POST
docs: Marks an upload as complete.
path-parameters:
upload_id:
type: uuid

types:
ListBuildsResponse:
properties:
builds:
docs: A list of builds for the game associated with the token.
type: list<cloudCommons.BuildSummary>

CreateBuildRequest:
properties:
display_name: commons.DisplayName
tags: unknown
image_tag:
docs: A tag given to the game build.
type: string
image_file: uploadCommons.PrepareFile
multipart_upload:
type: optional<boolean>
kind: optional<BuildKind>
compression: optional<BuildCompression>

CreateBuildResponse:
properties:
build_id:
type: uuid
upload_id:
type: uuid
image_presigned_request: optional<uploadCommons.PresignedRequest>
image_presigned_requests: optional<list<uploadCommons.PresignedRequest>>

BuildKind:
enum:
- value: docker_image
docs: Docker image archive generated by `docker save`.
- value: oci_bundle
docs: OCI-compliant bundle.

BuildCompression:
enum:
- value: none
docs: None compression.
- value: lz4
docs: LZ4 compression. Use the minimum compression level.
73 changes: 73 additions & 0 deletions fern/definition/servers/common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json

types:
Server:
properties:
server_id: uuid
game_id: uuid
datacenter_id: uuid
cluster_id: uuid
tags: unknown
image_id: uuid
arguments: optional<list<string>>
environment: optional<map<string, string>>
network: Network
resources: Resources
kill_timeout:
docs: >-
The duration to wait for in milliseconds before killing the server.
This should be set to a safe default, and can be overridden during a
DELETE request if needed.
type: optional<long>
create_ts: long
destroy_ts: optional<long>

Resources:
properties:
cpu:
docs: |
The number of CPU cores in millicores, or 1/1000 of a core. For example,
1/8 of a core would be 125 millicores, and 1 core would be 1000
millicores.
type: integer
memory:
docs: The amount of memory in megabytes
type: integer

Network:
properties:
mode: optional<NetworkMode>
ports: map<string, Port>

NetworkMode:
enum:
- bridge
- host

Port:
properties:
protocol: PortProtocol
internal_port: optional<integer>
public_hostname: optional<string>
public_port: optional<integer>
routing: PortRouting

PortProtocol:
enum:
- http
- https
- tcp
- tcp_tls
- udp

PortRouting:
properties:
game_guard: optional<GameGuardRouting>
host: optional<HostRouting>

GameGuardRouting:
properties: {}

HostRouting:
properties: {}

Loading