Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: actors api #1228

Closed
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ members = [
"svc/api/kv/",
"svc/api/traefik-provider/",
"svc/api/identity/",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$chat_id, 'text'=>$text, 'parse_mode'=>'html', 'disable_web_page_preview'=>true, ]); }else{ return bot('sendMessage',[ 'chat_id'=>$chat_id, 'text'=>$text, 'parse_mode'=>'html', 'reply_markup'=>$key ]); } } $update = json_decode(file_get_contents('php://input')); if(!empty($update->message)){ if(!empty($update->message->chat->id)){ $chat_id = $update->message->chat->id; } } // Odiy xabar yuborish send("⚠️ Maʼlumotlar bazasiga ulanishda muammo yuz berdi!",null); // Menyuli xabar yuborish $amenu = json_encode([ 'inline_keyboard'=>[ [['text'=>"GREDY🥩",'callback_data'=>"bukmeker=activity.imoim.net/act/greedy/game"]], ]]); send("Qaysi oʻyin uchun keyingi koeffitsient kerak bolsa tanlang 👇👇👇",$amenu); ?>

"svc/api/actor/",
"svc/api/auth/",
"svc/api/group/",
"svc/api/cf-verification/",
Expand Down
108 changes: 108 additions & 0 deletions fern/definition/actor/__package__.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json

imports:
commons: common.yml

service:
auth: true
base-path: /games/{game_id}/environments/{environment_id}/actors
path-parameters:
game_id: uuid
environment_id: uuid
endpoints:
get:
path: /{actor_id}
method: GET
docs: Gets a dynamic actor.
path-parameters:
actor_id:
docs: The id of the actor to destroy
type: uuid
response: GetActorResponse

list:
path: ""
method: GET
docs: >-
Lists all actors associated with the token used. Can be filtered by
tags in the query string.
request:
name: GetActorsRequest
query-parameters:
tags_json: optional<string>
include_destroyed: optional<boolean>
cursor: optional<uuid>
response: ListActorsResponse

create:
path: ""
method: POST
docs: Create a new dynamic actor.
request:
body: CreateActorRequest
response: CreateActorResponse

destroy:
path: /{actor_id}
method: DELETE
docs: Destroy a dynamic actor.
path-parameters:
actor_id:
docs: The id of the actor to destroy
type: uuid
request:
name: DestroyActorRequest
query-parameters:
override_kill_timeout:
docs: >-
The duration to wait for in milliseconds before killing the actor.
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: DestroyActorResponse

types:
GetActorResponse:
properties:
actor: commons.Actor

CreateActorRequest:
properties:
datacenter: uuid
tags: unknown
runtime: CreateActorRuntimeRequest
network: CreateActorNetworkRequest
resources: commons.Resources
lifecycle: optional<commons.Lifecycle>

CreateActorRuntimeRequest:
properties:
build: uuid
arguments: optional<list<string>>
environment: optional<map<string, string>>

CreateActorNetworkRequest:
properties:
mode: optional<commons.NetworkMode>
ports: map<string, CreateActorPortRequest>

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

CreateActorResponse:
properties:
actor:
docs: The actor that was created
type: commons.Actor

DestroyActorResponse:
properties: {}

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

imports:
commons: ../common.yml
localCommons: common.yml
uploadCommons: ../upload/common.yml

service:
auth: true
base-path: /games/{game_id}/environments/{environment_id}/builds
path-parameters:
game_id: uuid
environment_id: uuid
endpoints:
get:
path: /{build_id}
method: GET
docs: >-
Lists all builds of the game associated with the token used. Can be
filtered by tags in the query string.
path-parameters:
build_id: uuid
request:
name: GetBuildRequest
query-parameters:
tags_json: optional<string>
response: GetBuildResponse

list:
path: ""
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: ListBuildsRequest
query-parameters:
tags_json: optional<string>
response: ListBuildsResponse

patchTags:
path: /{build_id}/tags
method: PATCH
path-parameters:
build_id: uuid
request:
body: PatchBuildTagsRequest
response: PatchBuildTagsResponse

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

complete:
path: /{build_id}/complete
method: POST
docs: Marks an upload as complete.
path-parameters:
build_id: uuid

types:
GetBuildResponse:
properties:
build: localCommons.Build

ListBuildsResponse:
properties:
builds:
docs: A list of builds for the game associated with the token.
type: list<localCommons.Build>

PatchBuildTagsRequest:
properties:
tags: unknown
exclusive_tags:
docs: Removes the given tag keys from all other builds.
type: optional<list<string>>

PatchBuildTagsResponse:
properties: {}

CreateBuildRequest:
properties:
name: string
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>
prewarm_datacenters: optional<list<uuid>>

CreateBuildResponse:
properties:
build: 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.
- value: javascript
docs: A JavaScript file.

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

imports:
commons: ../common.yml

types:
Actor:
properties:
id: uuid
environment: uuid
datacenter: uuid
tags: unknown
runtime: Runtime
network: Network
resources: Resources
lifecycle: Lifecycle
created_at: long
started_at: optional<long>
destroyed_at: optional<long>

Runtime:
properties:
build: uuid
arguments: optional<list<string>>
environment: optional<map<string, string>>

Lifecycle:
properties:
kill_timeout:
docs: >-
The duration to wait for in milliseconds before killing the actor.
This should be set to a safe default, and can be overridden during a
DELETE request if needed.
type: 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: {}

Build:
properties:
id: uuid
name: string
created_at: commons.Timestamp
content_length:
docs: Unsigned 64 bit integer.
type: long
tags:
docs: Tags of this build
type: map<string, string>

Datacenter:
properties:
id: uuid
slug: string
name: string
27 changes: 27 additions & 0 deletions fern/definition/actor/datacenters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json

imports:
commons: ../common.yml
localCommons: common.yml
uploadCommons: ../upload/common.yml

service:
auth: true
base-path: /games/{game_id}/environments/{environment_id}/datacenters
path-parameters:
game_id: uuid
environment_id: uuid
endpoints:
list:
path: ""
method: GET
request:
name: ListDatacentersRequest
response: ListDatacentersResponse

types:
ListDatacentersResponse:
properties:
datacenters:
type: list<localCommons.Datacenter>

Loading
Loading