From 2bf6db2c9de45d86926ab600dedc591713cc26fc Mon Sep 17 00:00:00 2001 From: NathanFlurry Date: Fri, 16 Aug 2024 05:35:01 +0000 Subject: [PATCH] chore: migrate from game service to env service tokens (#1054) ## Changes --- fern/definition/cloud/games/tokens.yml | 15 +- fern/definition/games/environments/tokens.yml | 22 ++ fern/definition/servers/__package__.yml | 18 +- fern/definition/servers/builds.yml | 3 +- fern/definition/servers/common.yml | 20 +- fern/definition/servers/logs.yml | 3 +- lib/claims/src/lib.rs | 24 +- lib/convert/src/impls/ds.rs | 18 +- proto/backend/build.proto | 1 + proto/claims.proto | 7 +- sdks/full/go/client/client.go | 3 + sdks/full/go/cloud/games/tokens/client.go | 78 ----- sdks/full/go/cloud/games/types.go | 32 -- sdks/full/go/games/client/client.go | 30 ++ .../go/games/environments/client/client.go | 30 ++ sdks/full/go/games/environments/tokens.go | 39 +++ .../go/games/environments/tokens/client.go | 113 +++++++ sdks/full/go/servers/builds/client.go | 20 +- sdks/full/go/servers/client/client.go | 16 +- sdks/full/go/servers/logs/client.go | 4 +- sdks/full/go/servers/servers.go | 17 +- sdks/full/go/servers/types.go | 115 ++++++- sdks/full/openapi/openapi.yml | 303 +++++++++++------- sdks/full/openapi_compat/openapi.yml | 300 ++++++++++------- sdks/full/rust-cli/.openapi-generator/FILES | 12 +- sdks/full/rust-cli/README.md | 27 +- .../full/rust-cli/docs/CloudGamesTokensApi.md | 31 -- ...EnvironmentsCreateServiceTokenResponse.md} | 2 +- .../docs/GamesEnvironmentsTokensApi.md | 40 +++ sdks/full/rust-cli/docs/ServersApi.md | 20 +- sdks/full/rust-cli/docs/ServersBuildsApi.md | 25 +- .../docs/ServersCreateServerRequest.md | 7 +- .../docs/ServersCreateServerRuntimeRequest.md | 13 + sdks/full/rust-cli/docs/ServersLifecycle.md | 11 + sdks/full/rust-cli/docs/ServersLogsApi.md | 5 +- sdks/full/rust-cli/docs/ServersRuntime.md | 13 + sdks/full/rust-cli/docs/ServersServer.md | 8 +- .../src/apis/cloud_games_tokens_api.rs | 44 --- .../src/apis/games_environments_tokens_api.rs | 62 ++++ sdks/full/rust-cli/src/apis/mod.rs | 1 + sdks/full/rust-cli/src/apis/servers_api.rs | 16 +- .../rust-cli/src/apis/servers_builds_api.rs | 20 +- .../rust-cli/src/apis/servers_logs_api.rs | 4 +- ...ronments_create_service_token_response.rs} | 8 +- sdks/full/rust-cli/src/models/mod.rs | 10 +- .../models/servers_create_server_request.rs | 25 +- .../servers_create_server_runtime_request.rs | 34 ++ .../rust-cli/src/models/servers_lifecycle.rs | 29 ++ .../rust-cli/src/models/servers_runtime.rs | 34 ++ .../rust-cli/src/models/servers_server.rs | 27 +- sdks/full/rust/.openapi-generator/FILES | 12 +- sdks/full/rust/README.md | 27 +- sdks/full/rust/docs/CloudGamesTokensApi.md | 31 -- ...EnvironmentsCreateServiceTokenResponse.md} | 2 +- .../rust/docs/GamesEnvironmentsTokensApi.md | 40 +++ sdks/full/rust/docs/ServersApi.md | 20 +- sdks/full/rust/docs/ServersBuildsApi.md | 25 +- .../rust/docs/ServersCreateServerRequest.md | 7 +- .../docs/ServersCreateServerRuntimeRequest.md | 13 + sdks/full/rust/docs/ServersLifecycle.md | 11 + sdks/full/rust/docs/ServersLogsApi.md | 5 +- sdks/full/rust/docs/ServersRuntime.md | 13 + sdks/full/rust/docs/ServersServer.md | 8 +- .../rust/src/apis/cloud_games_tokens_api.rs | 44 --- .../src/apis/games_environments_tokens_api.rs | 62 ++++ sdks/full/rust/src/apis/mod.rs | 1 + sdks/full/rust/src/apis/servers_api.rs | 16 +- sdks/full/rust/src/apis/servers_builds_api.rs | 20 +- sdks/full/rust/src/apis/servers_logs_api.rs | 4 +- ...ronments_create_service_token_response.rs} | 8 +- sdks/full/rust/src/models/mod.rs | 10 +- .../models/servers_create_server_request.rs | 25 +- .../servers_create_server_runtime_request.rs | 34 ++ .../full/rust/src/models/servers_lifecycle.rs | 29 ++ sdks/full/rust/src/models/servers_runtime.rs | 34 ++ sdks/full/rust/src/models/servers_server.rs | 27 +- sdks/full/typescript/archive.tgz | 4 +- sdks/full/typescript/src/Client.ts | 7 + .../games/resources/tokens/client/Client.ts | 130 -------- .../games/resources/tokens/types/index.ts | 1 - .../src/api/resources/games/client/Client.ts | 34 ++ .../src/api/resources/games/client/index.ts | 1 + .../src/api/resources/games/index.ts | 2 + .../resources/environments/client/Client.ts | 34 ++ .../resources/environments/client/index.ts | 1 + .../games/resources/environments/index.ts | 2 + .../resources/environments/resources/index.ts | 2 + .../resources/tokens/client/Client.ts | 172 ++++++++++ .../resources/tokens/client/index.ts | 1 + .../environments/resources/tokens/index.ts | 2 + .../api/resources/games/resources/index.ts | 1 + .../typescript/src/api/resources/index.ts | 1 + .../api/resources/servers/client/Client.ts | 37 ++- .../servers/resources/builds/client/Client.ts | 42 ++- .../servers/resources/logs/client/Client.ts | 8 +- .../games/resources/tokens/types/index.ts | 1 - .../serialization/resources/games/index.ts | 1 + .../games/resources/environments/index.ts | 1 + .../resources/environments/resources/index.ts | 2 + .../environments/resources/tokens/index.ts | 1 + .../resources/games/resources/index.ts | 1 + .../src/serialization/resources/index.ts | 1 + sdks/full/typescript/types/Client.d.ts | 3 + .../games/resources/tokens/client/Client.d.ts | 17 - .../games/resources/tokens/types/index.d.ts | 1 - .../typescript/types/api/resources/index.d.ts | 1 + .../games/resources/tokens/types/index.d.ts | 1 - .../types/serialization/resources/index.d.ts | 1 + sdks/runtime/typescript/archive.tgz | 4 +- svc/Cargo.toml | 2 +- svc/api/cloud/Cargo.toml | 1 - svc/api/cloud/src/route/games/tokens.rs | 19 -- svc/api/cloud/src/route/mod.rs | 3 - svc/api/games/Cargo.toml | 70 ++++ svc/api/games/Service.toml | 7 + svc/api/games/src/assert.rs | 6 + svc/api/games/src/auth.rs | 144 +++++++++ svc/api/games/src/lib.rs | 3 + svc/api/games/src/main.rs | 5 + svc/api/games/src/route/envs/mod.rs | 1 + svc/api/games/src/route/envs/tokens.rs | 46 +++ svc/api/games/src/route/mod.rs | 30 ++ svc/api/monolith/Cargo.toml | 1 + svc/api/monolith/src/route/mod.rs | 3 + svc/api/servers/Cargo.toml | 2 +- svc/api/servers/src/assert.rs | 9 +- svc/api/servers/src/auth.rs | 12 +- svc/api/servers/src/route/builds.rs | 2 +- svc/api/servers/src/route/logs.rs | 2 +- svc/api/servers/src/route/servers.rs | 14 +- svc/api/servers/tests/basic.rs | 55 ++-- svc/pkg/build/ops/get/src/lib.rs | 7 +- .../ops/game-service-token-create/Cargo.toml | 23 -- .../ops/game-service-token-create/README.md | 1 - .../game-service-token-create/Service.toml | 10 - .../ops/game-service-token-create/src/lib.rs | 46 --- .../tests/integration.rs | 16 - .../ds/ops/server-create/tests/integration.rs | 16 +- .../server-create/tests/print_test_data.rs | 25 +- .../ds/ops/server-get/tests/integration.rs | 6 +- svc/pkg/ds/ops/server-list-for-env/src/lib.rs | 8 +- svc/pkg/ds/worker/tests/common.rs | 6 +- svc/pkg/faker/ops/build/src/lib.rs | 5 +- svc/pkg/faker/ops/game/src/lib.rs | 1 + svc/pkg/faker/proto/build.proto | 1 + svc/pkg/faker/proto/game.proto | 3 + 146 files changed, 2246 insertions(+), 1170 deletions(-) create mode 100644 fern/definition/games/environments/tokens.yml create mode 100644 sdks/full/go/games/client/client.go create mode 100644 sdks/full/go/games/environments/client/client.go create mode 100644 sdks/full/go/games/environments/tokens.go create mode 100644 sdks/full/go/games/environments/tokens/client.go rename sdks/full/rust-cli/docs/{CloudGamesCreateServiceTokenResponse.md => GamesEnvironmentsCreateServiceTokenResponse.md} (87%) create mode 100644 sdks/full/rust-cli/docs/GamesEnvironmentsTokensApi.md create mode 100644 sdks/full/rust-cli/docs/ServersCreateServerRuntimeRequest.md create mode 100644 sdks/full/rust-cli/docs/ServersLifecycle.md create mode 100644 sdks/full/rust-cli/docs/ServersRuntime.md create mode 100644 sdks/full/rust-cli/src/apis/games_environments_tokens_api.rs rename sdks/full/rust-cli/src/models/{cloud_games_create_service_token_response.rs => games_environments_create_service_token_response.rs} (63%) create mode 100644 sdks/full/rust-cli/src/models/servers_create_server_runtime_request.rs create mode 100644 sdks/full/rust-cli/src/models/servers_lifecycle.rs create mode 100644 sdks/full/rust-cli/src/models/servers_runtime.rs rename sdks/full/rust/docs/{CloudGamesCreateServiceTokenResponse.md => GamesEnvironmentsCreateServiceTokenResponse.md} (87%) create mode 100644 sdks/full/rust/docs/GamesEnvironmentsTokensApi.md create mode 100644 sdks/full/rust/docs/ServersCreateServerRuntimeRequest.md create mode 100644 sdks/full/rust/docs/ServersLifecycle.md create mode 100644 sdks/full/rust/docs/ServersRuntime.md create mode 100644 sdks/full/rust/src/apis/games_environments_tokens_api.rs rename sdks/full/rust/src/models/{cloud_games_create_service_token_response.rs => games_environments_create_service_token_response.rs} (63%) create mode 100644 sdks/full/rust/src/models/servers_create_server_runtime_request.rs create mode 100644 sdks/full/rust/src/models/servers_lifecycle.rs create mode 100644 sdks/full/rust/src/models/servers_runtime.rs create mode 100644 sdks/full/typescript/src/api/resources/games/client/Client.ts create mode 100644 sdks/full/typescript/src/api/resources/games/client/index.ts create mode 100644 sdks/full/typescript/src/api/resources/games/index.ts create mode 100644 sdks/full/typescript/src/api/resources/games/resources/environments/client/Client.ts create mode 100644 sdks/full/typescript/src/api/resources/games/resources/environments/client/index.ts create mode 100644 sdks/full/typescript/src/api/resources/games/resources/environments/index.ts create mode 100644 sdks/full/typescript/src/api/resources/games/resources/environments/resources/index.ts create mode 100644 sdks/full/typescript/src/api/resources/games/resources/environments/resources/tokens/client/Client.ts create mode 100644 sdks/full/typescript/src/api/resources/games/resources/environments/resources/tokens/client/index.ts create mode 100644 sdks/full/typescript/src/api/resources/games/resources/environments/resources/tokens/index.ts create mode 100644 sdks/full/typescript/src/api/resources/games/resources/index.ts create mode 100644 sdks/full/typescript/src/serialization/resources/games/index.ts create mode 100644 sdks/full/typescript/src/serialization/resources/games/resources/environments/index.ts create mode 100644 sdks/full/typescript/src/serialization/resources/games/resources/environments/resources/index.ts create mode 100644 sdks/full/typescript/src/serialization/resources/games/resources/environments/resources/tokens/index.ts create mode 100644 sdks/full/typescript/src/serialization/resources/games/resources/index.ts create mode 100644 svc/api/games/Cargo.toml create mode 100644 svc/api/games/Service.toml create mode 100644 svc/api/games/src/assert.rs create mode 100644 svc/api/games/src/auth.rs create mode 100644 svc/api/games/src/lib.rs create mode 100644 svc/api/games/src/main.rs create mode 100644 svc/api/games/src/route/envs/mod.rs create mode 100644 svc/api/games/src/route/envs/tokens.rs create mode 100644 svc/api/games/src/route/mod.rs delete mode 100644 svc/pkg/cloud/ops/game-service-token-create/Cargo.toml delete mode 100644 svc/pkg/cloud/ops/game-service-token-create/README.md delete mode 100644 svc/pkg/cloud/ops/game-service-token-create/Service.toml delete mode 100644 svc/pkg/cloud/ops/game-service-token-create/src/lib.rs delete mode 100644 svc/pkg/cloud/ops/game-service-token-create/tests/integration.rs diff --git a/fern/definition/cloud/games/tokens.yml b/fern/definition/cloud/games/tokens.yml index ecdef3b306..5f04a007cc 100644 --- a/fern/definition/cloud/games/tokens.yml +++ b/fern/definition/cloud/games/tokens.yml @@ -12,14 +12,6 @@ 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: @@ -30,9 +22,4 @@ 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 + diff --git a/fern/definition/games/environments/tokens.yml b/fern/definition/games/environments/tokens.yml new file mode 100644 index 0000000000..322fed68d0 --- /dev/null +++ b/fern/definition/games/environments/tokens.yml @@ -0,0 +1,22 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +service: + auth: true + base-path: /games/{game_id}/environments/{environment_id} + path-parameters: + game_id: uuid + environment_id: uuid + endpoints: + createServiceToken: + path: /tokens/service + method: POST + docs: Creates a new environment service token. + response: CreateServiceTokenResponse + +types: + CreateServiceTokenResponse: + properties: + token: + docs: |- + A JSON Web Token. + type: string diff --git a/fern/definition/servers/__package__.yml b/fern/definition/servers/__package__.yml index d692c6ceeb..3f4fc77cb7 100644 --- a/fern/definition/servers/__package__.yml +++ b/fern/definition/servers/__package__.yml @@ -5,9 +5,10 @@ imports: service: auth: true - base-path: /games/{game_id}/servers + base-path: /games/{game_id}/environments/{environment_id}/servers path-parameters: game_id: uuid + environment_id: uuid endpoints: get: path: /{server_id} @@ -68,17 +69,16 @@ types: properties: datacenter: uuid tags: unknown + runtime: CreateServerRuntimeRequest + network: CreateServerNetworkRequest + resources: commons.Resources + lifecycle: optional + + CreateServerRuntimeRequest: + properties: image: uuid arguments: optional> environment: optional> - 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 CreateServerNetworkRequest: properties: diff --git a/fern/definition/servers/builds.yml b/fern/definition/servers/builds.yml index 63279c0b54..6e4cbbc77a 100644 --- a/fern/definition/servers/builds.yml +++ b/fern/definition/servers/builds.yml @@ -7,9 +7,10 @@ imports: service: auth: true - base-path: /games/{game_id}/builds + base-path: /games/{game_id}/environments/{environment_id}/builds path-parameters: game_id: uuid + environment_id: uuid endpoints: getBuild: path: /{build_id} diff --git a/fern/definition/servers/common.yml b/fern/definition/servers/common.yml index 9a5128543d..90de29bc0d 100644 --- a/fern/definition/servers/common.yml +++ b/fern/definition/servers/common.yml @@ -7,24 +7,32 @@ types: Server: properties: id: uuid - game: uuid + environment: uuid datacenter: uuid cluster: uuid tags: unknown + runtime: Runtime + network: Network + resources: Resources + lifecycle: Lifecycle + created_at: long + started_at: optional + destroyed_at: optional + + Runtime: + properties: image: uuid arguments: optional> environment: optional> - network: Network - resources: Resources + + Lifecycle: + properties: 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 - created_at: long - started_at: optional - destroyed_at: optional Resources: properties: diff --git a/fern/definition/servers/logs.yml b/fern/definition/servers/logs.yml index 9006797a91..407d988272 100644 --- a/fern/definition/servers/logs.yml +++ b/fern/definition/servers/logs.yml @@ -5,9 +5,10 @@ imports: service: auth: true - base-path: /games/{game_id}/servers + base-path: /games/{game_id}/environments/{environment_id}/servers path-parameters: game_id: uuid + environment_id: uuid endpoints: getServerLogs: path: /{server_id}/logs diff --git a/lib/claims/src/lib.rs b/lib/claims/src/lib.rs index 0161cc86f7..8d929a8d41 100644 --- a/lib/claims/src/lib.rs +++ b/lib/claims/src/lib.rs @@ -365,16 +365,16 @@ pub mod ent { } #[derive(Clone, Debug)] - pub struct GameService { - pub game_id: Uuid, + pub struct EnvService { + pub env_id: Uuid, } - impl TryFrom<&schema::entitlement::GameService> for GameService { + impl TryFrom<&schema::entitlement::EnvService> for EnvService { type Error = GlobalError; - fn try_from(value: &schema::entitlement::GameService) -> GlobalResult { - Ok(GameService { - game_id: unwrap!(value.game_id).as_uuid(), + fn try_from(value: &schema::entitlement::EnvService) -> GlobalResult { + Ok(EnvService { + env_id: unwrap!(value.env_id).as_uuid(), }) } } @@ -403,7 +403,7 @@ pub trait ClaimsDecode { fn as_access_token(&self) -> GlobalResult; fn as_provisioned_server(&self) -> GlobalResult; fn as_opengb_db(&self) -> GlobalResult; - fn as_game_service(&self) -> GlobalResult; + fn as_env_service(&self) -> GlobalResult; } impl ClaimsDecode for schema::Claims { @@ -702,18 +702,18 @@ impl ClaimsDecode for schema::Claims { .and_then(std::convert::identity) } - fn as_game_service(&self) -> GlobalResult { + fn as_env_service(&self) -> GlobalResult { self.entitlements .iter() .find_map(|ent| match &ent.kind { - Some(schema::entitlement::Kind::GameService(ent)) => { - Some(ent::GameService::try_from(ent)) + Some(schema::entitlement::Kind::EnvService(ent)) => { + Some(ent::EnvService::try_from(ent)) } _ => None, }) .ok_or(err_code!( CLAIMS_MISSING_ENTITLEMENT, - entitlements = "GameService" + entitlements = "EnvService" )) .and_then(std::convert::identity) } @@ -745,7 +745,7 @@ impl EntitlementTag for schema::Entitlement { schema::entitlement::Kind::AccessToken(_) => 16, schema::entitlement::Kind::ProvisionedServer(_) => 17, schema::entitlement::Kind::OpengbDb(_) => 18, - schema::entitlement::Kind::GameService(_) => 19, + schema::entitlement::Kind::EnvService(_) => 19, }) } } diff --git a/lib/convert/src/impls/ds.rs b/lib/convert/src/impls/ds.rs index 15c734afe0..b701324334 100644 --- a/lib/convert/src/impls/ds.rs +++ b/lib/convert/src/impls/ds.rs @@ -13,18 +13,18 @@ impl ApiTryFrom for models::ServersServer { fn api_try_from(value: backend::ds::Server) -> GlobalResult { Ok(models::ServersServer { id: unwrap!(value.server_id).as_uuid(), + environment: unwrap!(value.env_id).as_uuid(), + datacenter: unwrap!(value.datacenter_id).as_uuid(), cluster: unwrap!(value.cluster_id).as_uuid(), created_at: value.create_ts, started_at: value.start_ts, - datacenter: unwrap!(value.datacenter_id).as_uuid(), destroyed_at: value.destroy_ts, - game: unwrap!(value.game_id).as_uuid(), - kill_timeout: Some(value.kill_timeout_ms), tags: Some(to_value(value.tags).unwrap()), - resources: Box::new(unwrap!(value.resources).api_into()), - arguments: Some(value.args), - environment: Some(value.environment), - image: unwrap!(value.image_id).as_uuid(), + runtime: Box::new(models::ServersRuntime { + image: unwrap!(value.image_id).as_uuid(), + arguments: Some(value.args), + environment: Some(value.environment), + }), network: Box::new(models::ServersNetwork { mode: Some( unwrap!(backend::ds::NetworkMode::from_i32(value.network_mode)).api_into(), @@ -35,6 +35,10 @@ impl ApiTryFrom for models::ServersServer { .map(|(s, p)| Ok((s, p.api_try_into()?))) .collect::>>()?, }), + lifecycle: Box::new(models::ServersLifecycle { + kill_timeout: Some(value.kill_timeout_ms), + }), + resources: Box::new(unwrap!(value.resources).api_into()), }) } } diff --git a/proto/backend/build.proto b/proto/backend/build.proto index 30097028e0..0be2e7c710 100644 --- a/proto/backend/build.proto +++ b/proto/backend/build.proto @@ -17,6 +17,7 @@ enum BuildCompression { message Build { rivet.common.Uuid build_id = 1; rivet.common.Uuid game_id = 2; + rivet.common.Uuid env_id = 10; rivet.common.Uuid upload_id = 3; string display_name = 4; string image_tag = 6; diff --git a/proto/claims.proto b/proto/claims.proto index 684311a610..e3369898f8 100644 --- a/proto/claims.proto +++ b/proto/claims.proto @@ -119,9 +119,8 @@ message Entitlement { string db_name = 2; } - message GameService { - // The game ID that the server will be running. - rivet.common.Uuid game_id = 1; + message EnvService { + rivet.common.Uuid env_id = 1; } oneof kind { @@ -142,7 +141,7 @@ message Entitlement { AccessToken access_token = 16; ProvisionedServer provisioned_server = 17; OpenGbDb opengb_db = 18; - GameService game_service = 19; + EnvService env_service = 19; } reserved 13; diff --git a/sdks/full/go/client/client.go b/sdks/full/go/client/client.go index b02b1e5203..cb0ee8e983 100644 --- a/sdks/full/go/client/client.go +++ b/sdks/full/go/client/client.go @@ -8,6 +8,7 @@ import ( authclient "sdk/auth/client" cloudclient "sdk/cloud/client" core "sdk/core" + gamesclient "sdk/games/client" groupclient "sdk/group/client" identityclient "sdk/identity/client" jobclient "sdk/job/client" @@ -31,6 +32,7 @@ type Client struct { Provision *provisionclient.Client Servers *serversclient.Client Auth *authclient.Client + Games *gamesclient.Client Job *jobclient.Client Matchmaker *matchmakerclient.Client Portal *portalclient.Client @@ -53,6 +55,7 @@ func NewClient(opts ...core.ClientOption) *Client { Provision: provisionclient.NewClient(opts...), Servers: serversclient.NewClient(opts...), Auth: authclient.NewClient(opts...), + Games: gamesclient.NewClient(opts...), Job: jobclient.NewClient(opts...), Matchmaker: matchmakerclient.NewClient(opts...), Portal: portalclient.NewClient(opts...), diff --git a/sdks/full/go/cloud/games/tokens/client.go b/sdks/full/go/cloud/games/tokens/client.go index 73865dcc1a..79ae853bd0 100644 --- a/sdks/full/go/cloud/games/tokens/client.go +++ b/sdks/full/go/cloud/games/tokens/client.go @@ -111,81 +111,3 @@ func (c *Client) CreateCloudToken(ctx context.Context, gameId uuid.UUID) (*games } return response, nil } - -// Creates a new game service token. -func (c *Client) CreateServiceToken(ctx context.Context, gameId uuid.UUID) (*games.CreateCloudTokenResponse, error) { - baseURL := "https://api.rivet.gg" - if c.baseURL != "" { - baseURL = c.baseURL - } - endpointURL := fmt.Sprintf(baseURL+"/"+"cloud/games/%v/tokens/service", gameId) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 500: - value := new(sdk.InternalError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError - } - return value - case 429: - value := new(sdk.RateLimitError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError - } - return value - case 403: - value := new(sdk.ForbiddenError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError - } - return value - case 408: - value := new(sdk.UnauthorizedError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError - } - return value - case 404: - value := new(sdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError - } - return value - case 400: - value := new(sdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError - } - return value - } - return apiError - } - - var response *games.CreateCloudTokenResponse - if err := c.caller.Call( - ctx, - &core.CallParams{ - URL: endpointURL, - Method: http.MethodPost, - Headers: c.header, - Response: &response, - ErrorDecoder: errorDecoder, - }, - ); err != nil { - return nil, err - } - return response, nil -} diff --git a/sdks/full/go/cloud/games/types.go b/sdks/full/go/cloud/games/types.go index 729a89c395..7943c6ed4b 100644 --- a/sdks/full/go/cloud/games/types.go +++ b/sdks/full/go/cloud/games/types.go @@ -3,9 +3,7 @@ package games import ( - json "encoding/json" fmt "fmt" - core "sdk/core" ) type GetGameByIdRequest struct { @@ -65,33 +63,3 @@ func NewBuildKindFromString(s string) (BuildKind, error) { func (b BuildKind) Ptr() *BuildKind { return &b } - -type CreateServiceTokenResponse struct { - // A JSON Web Token. - Token string `json:"token"` - - _rawJSON json.RawMessage -} - -func (c *CreateServiceTokenResponse) UnmarshalJSON(data []byte) error { - type unmarshaler CreateServiceTokenResponse - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *c = CreateServiceTokenResponse(value) - c._rawJSON = json.RawMessage(data) - return nil -} - -func (c *CreateServiceTokenResponse) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(c); err == nil { - return value - } - return fmt.Sprintf("%#v", c) -} diff --git a/sdks/full/go/games/client/client.go b/sdks/full/go/games/client/client.go new file mode 100644 index 0000000000..626086cf09 --- /dev/null +++ b/sdks/full/go/games/client/client.go @@ -0,0 +1,30 @@ +// This file was auto-generated by Fern from our API Definition. + +package client + +import ( + http "net/http" + core "sdk/core" + environmentsclient "sdk/games/environments/client" +) + +type Client struct { + baseURL string + caller *core.Caller + header http.Header + + Environments *environmentsclient.Client +} + +func NewClient(opts ...core.ClientOption) *Client { + options := core.NewClientOptions() + for _, opt := range opts { + opt(options) + } + return &Client{ + baseURL: options.BaseURL, + caller: core.NewCaller(options.HTTPClient), + header: options.ToHeader(), + Environments: environmentsclient.NewClient(opts...), + } +} diff --git a/sdks/full/go/games/environments/client/client.go b/sdks/full/go/games/environments/client/client.go new file mode 100644 index 0000000000..a0797a8429 --- /dev/null +++ b/sdks/full/go/games/environments/client/client.go @@ -0,0 +1,30 @@ +// This file was auto-generated by Fern from our API Definition. + +package client + +import ( + http "net/http" + core "sdk/core" + tokens "sdk/games/environments/tokens" +) + +type Client struct { + baseURL string + caller *core.Caller + header http.Header + + Tokens *tokens.Client +} + +func NewClient(opts ...core.ClientOption) *Client { + options := core.NewClientOptions() + for _, opt := range opts { + opt(options) + } + return &Client{ + baseURL: options.BaseURL, + caller: core.NewCaller(options.HTTPClient), + header: options.ToHeader(), + Tokens: tokens.NewClient(opts...), + } +} diff --git a/sdks/full/go/games/environments/tokens.go b/sdks/full/go/games/environments/tokens.go new file mode 100644 index 0000000000..7556080d38 --- /dev/null +++ b/sdks/full/go/games/environments/tokens.go @@ -0,0 +1,39 @@ +// This file was auto-generated by Fern from our API Definition. + +package environments + +import ( + json "encoding/json" + fmt "fmt" + core "sdk/core" +) + +type CreateServiceTokenResponse struct { + // A JSON Web Token. + Token string `json:"token"` + + _rawJSON json.RawMessage +} + +func (c *CreateServiceTokenResponse) UnmarshalJSON(data []byte) error { + type unmarshaler CreateServiceTokenResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CreateServiceTokenResponse(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CreateServiceTokenResponse) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} diff --git a/sdks/full/go/games/environments/tokens/client.go b/sdks/full/go/games/environments/tokens/client.go new file mode 100644 index 0000000000..62c795d1b1 --- /dev/null +++ b/sdks/full/go/games/environments/tokens/client.go @@ -0,0 +1,113 @@ +// This file was auto-generated by Fern from our API Definition. + +package tokens + +import ( + bytes "bytes" + context "context" + json "encoding/json" + errors "errors" + fmt "fmt" + uuid "github.com/google/uuid" + io "io" + http "net/http" + sdk "sdk" + core "sdk/core" + environments "sdk/games/environments" +) + +type Client struct { + baseURL string + caller *core.Caller + header http.Header +} + +func NewClient(opts ...core.ClientOption) *Client { + options := core.NewClientOptions() + for _, opt := range opts { + opt(options) + } + return &Client{ + baseURL: options.BaseURL, + caller: core.NewCaller(options.HTTPClient), + header: options.ToHeader(), + } +} + +// Creates a new environment service token. +func (c *Client) CreateServiceToken(ctx context.Context, gameId uuid.UUID, environmentId uuid.UUID) (*environments.CreateServiceTokenResponse, error) { + baseURL := "https://api.rivet.gg" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/environments/%v/tokens/service", gameId, environmentId) + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 500: + value := new(sdk.InternalError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 429: + value := new(sdk.RateLimitError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 403: + value := new(sdk.ForbiddenError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 408: + value := new(sdk.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 404: + value := new(sdk.NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 400: + value := new(sdk.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *environments.CreateServiceTokenResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} diff --git a/sdks/full/go/servers/builds/client.go b/sdks/full/go/servers/builds/client.go index bae536b5ad..e174aec08a 100644 --- a/sdks/full/go/servers/builds/client.go +++ b/sdks/full/go/servers/builds/client.go @@ -36,12 +36,12 @@ func NewClient(opts ...core.ClientOption) *Client { } // Lists all builds of the game associated with the token used. Can be filtered by tags in the query string. -func (c *Client) GetBuild(ctx context.Context, gameId uuid.UUID, buildId uuid.UUID, request *servers.GetBuildRequest) (*servers.GetBuildResponse, error) { +func (c *Client) GetBuild(ctx context.Context, gameId uuid.UUID, environmentId uuid.UUID, buildId uuid.UUID, request *servers.GetBuildRequest) (*servers.GetBuildResponse, error) { baseURL := "https://api.rivet.gg" if c.baseURL != "" { baseURL = c.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/builds/%v", gameId, buildId) + endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/environments/%v/builds/%v", gameId, environmentId, buildId) queryParams := make(url.Values) if request.TagsJson != nil { @@ -125,12 +125,12 @@ func (c *Client) GetBuild(ctx context.Context, gameId uuid.UUID, buildId uuid.UU } // Lists all builds of the game associated with the token used. Can be filtered by tags in the query string. -func (c *Client) ListBuilds(ctx context.Context, gameId uuid.UUID, request *servers.ListBuildsRequest) (*servers.ListBuildsResponse, error) { +func (c *Client) ListBuilds(ctx context.Context, gameId uuid.UUID, environmentId uuid.UUID, request *servers.ListBuildsRequest) (*servers.ListBuildsResponse, error) { baseURL := "https://api.rivet.gg" if c.baseURL != "" { baseURL = c.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/builds", gameId) + endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/environments/%v/builds", gameId, environmentId) queryParams := make(url.Values) if request.TagsJson != nil { @@ -213,12 +213,12 @@ func (c *Client) ListBuilds(ctx context.Context, gameId uuid.UUID, request *serv return response, nil } -func (c *Client) PatchTags(ctx context.Context, gameId uuid.UUID, buildId uuid.UUID, request *servers.PatchBuildTagsRequest) (*servers.PatchBuildTagsResponse, error) { +func (c *Client) PatchTags(ctx context.Context, gameId uuid.UUID, environmentId uuid.UUID, buildId uuid.UUID, request *servers.PatchBuildTagsRequest) (*servers.PatchBuildTagsResponse, error) { baseURL := "https://api.rivet.gg" if c.baseURL != "" { baseURL = c.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/builds/%v/tags", gameId, buildId) + endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/environments/%v/builds/%v/tags", gameId, environmentId, buildId) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -292,12 +292,12 @@ func (c *Client) PatchTags(ctx context.Context, gameId uuid.UUID, buildId uuid.U } // Creates a new game build for the given game. -func (c *Client) PrepareBuild(ctx context.Context, gameId uuid.UUID, request *servers.CreateBuildRequest) (*servers.CreateBuildResponse, error) { +func (c *Client) PrepareBuild(ctx context.Context, gameId uuid.UUID, environmentId uuid.UUID, request *servers.CreateBuildRequest) (*servers.CreateBuildResponse, error) { baseURL := "https://api.rivet.gg" if c.baseURL != "" { baseURL = c.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/builds/prepare", gameId) + endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/environments/%v/builds/prepare", gameId, environmentId) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -371,12 +371,12 @@ func (c *Client) PrepareBuild(ctx context.Context, gameId uuid.UUID, request *se } // Marks an upload as complete. -func (c *Client) CompleteBuild(ctx context.Context, gameId uuid.UUID, buildId uuid.UUID) error { +func (c *Client) CompleteBuild(ctx context.Context, gameId uuid.UUID, environmentId uuid.UUID, buildId uuid.UUID) error { baseURL := "https://api.rivet.gg" if c.baseURL != "" { baseURL = c.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/builds/%v/complete", gameId, buildId) + endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/environments/%v/builds/%v/complete", gameId, environmentId, buildId) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) diff --git a/sdks/full/go/servers/client/client.go b/sdks/full/go/servers/client/client.go index 827293897b..2b11e60330 100644 --- a/sdks/full/go/servers/client/client.go +++ b/sdks/full/go/servers/client/client.go @@ -45,12 +45,12 @@ func NewClient(opts ...core.ClientOption) *Client { // Gets a dynamic server. // // The id of the server to destroy -func (c *Client) Get(ctx context.Context, gameId uuid.UUID, serverId uuid.UUID) (*servers.GetServerResponse, error) { +func (c *Client) Get(ctx context.Context, gameId uuid.UUID, environmentId uuid.UUID, serverId uuid.UUID) (*servers.GetServerResponse, error) { baseURL := "https://api.rivet.gg" if c.baseURL != "" { baseURL = c.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/servers/%v", gameId, serverId) + endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/environments/%v/servers/%v", gameId, environmentId, serverId) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -123,12 +123,12 @@ func (c *Client) Get(ctx context.Context, gameId uuid.UUID, serverId uuid.UUID) } // Lists all servers associated with the token used. Can be filtered by tags in the query string. -func (c *Client) List(ctx context.Context, gameId uuid.UUID, request *servers.GetServersRequest) (*servers.ListServersResponse, error) { +func (c *Client) List(ctx context.Context, gameId uuid.UUID, environmentId uuid.UUID, request *servers.GetServersRequest) (*servers.ListServersResponse, error) { baseURL := "https://api.rivet.gg" if c.baseURL != "" { baseURL = c.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/servers", gameId) + endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/environments/%v/servers", gameId, environmentId) queryParams := make(url.Values) if request.TagsJson != nil { @@ -212,12 +212,12 @@ func (c *Client) List(ctx context.Context, gameId uuid.UUID, request *servers.Ge } // Create a new dynamic server. -func (c *Client) Create(ctx context.Context, gameId uuid.UUID, request *servers.CreateServerRequest) (*servers.CreateServerResponse, error) { +func (c *Client) Create(ctx context.Context, gameId uuid.UUID, environmentId uuid.UUID, request *servers.CreateServerRequest) (*servers.CreateServerResponse, error) { baseURL := "https://api.rivet.gg" if c.baseURL != "" { baseURL = c.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/servers", gameId) + endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/environments/%v/servers", gameId, environmentId) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -293,12 +293,12 @@ func (c *Client) Create(ctx context.Context, gameId uuid.UUID, request *servers. // Destroy a dynamic server. // // The id of the server to destroy -func (c *Client) Destroy(ctx context.Context, gameId uuid.UUID, serverId uuid.UUID, request *servers.DestroyServerRequest) (*servers.DestroyServerResponse, error) { +func (c *Client) Destroy(ctx context.Context, gameId uuid.UUID, environmentId uuid.UUID, serverId uuid.UUID, request *servers.DestroyServerRequest) (*servers.DestroyServerResponse, error) { baseURL := "https://api.rivet.gg" if c.baseURL != "" { baseURL = c.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/servers/%v", gameId, serverId) + endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/environments/%v/servers/%v", gameId, environmentId, serverId) queryParams := make(url.Values) if request.OverrideKillTimeout != nil { diff --git a/sdks/full/go/servers/logs/client.go b/sdks/full/go/servers/logs/client.go index 9ca2374c42..acbab84764 100644 --- a/sdks/full/go/servers/logs/client.go +++ b/sdks/full/go/servers/logs/client.go @@ -36,12 +36,12 @@ func NewClient(opts ...core.ClientOption) *Client { } // Returns the logs for a given server. -func (c *Client) GetServerLogs(ctx context.Context, gameId uuid.UUID, serverId uuid.UUID, request *servers.GetServerLogsRequest) (*servers.GetServerLogsResponse, error) { +func (c *Client) GetServerLogs(ctx context.Context, gameId uuid.UUID, environmentId uuid.UUID, serverId uuid.UUID, request *servers.GetServerLogsRequest) (*servers.GetServerLogsResponse, error) { baseURL := "https://api.rivet.gg" if c.baseURL != "" { baseURL = c.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/servers/%v/logs", gameId, serverId) + endpointURL := fmt.Sprintf(baseURL+"/"+"games/%v/environments/%v/servers/%v/logs", gameId, environmentId, serverId) queryParams := make(url.Values) queryParams.Add("stream", fmt.Sprintf("%v", request.Stream)) diff --git a/sdks/full/go/servers/servers.go b/sdks/full/go/servers/servers.go index 89868d5c46..02aa75cda7 100644 --- a/sdks/full/go/servers/servers.go +++ b/sdks/full/go/servers/servers.go @@ -10,17 +10,12 @@ import ( ) type CreateServerRequest struct { - Datacenter uuid.UUID `json:"datacenter"` - Tags interface{} `json:"tags,omitempty"` - Image uuid.UUID `json:"image"` - Arguments []string `json:"arguments,omitempty"` - Environment map[string]string `json:"environment,omitempty"` - Network *CreateServerNetworkRequest `json:"network,omitempty"` - Resources *Resources `json:"resources,omitempty"` - // 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. - KillTimeout *int64 `json:"kill_timeout,omitempty"` - // A url to send to which events from the server running will be sent - WebhookUrl *string `json:"webhook_url,omitempty"` + Datacenter uuid.UUID `json:"datacenter"` + Tags interface{} `json:"tags,omitempty"` + Runtime *CreateServerRuntimeRequest `json:"runtime,omitempty"` + Network *CreateServerNetworkRequest `json:"network,omitempty"` + Resources *Resources `json:"resources,omitempty"` + Lifecycle *Lifecycle `json:"lifecycle,omitempty"` _rawJSON json.RawMessage } diff --git a/sdks/full/go/servers/types.go b/sdks/full/go/servers/types.go index 0ece05ca39..acee9e2e11 100644 --- a/sdks/full/go/servers/types.go +++ b/sdks/full/go/servers/types.go @@ -157,6 +157,36 @@ func (h *HostRouting) String() string { return fmt.Sprintf("%#v", h) } +type Lifecycle struct { + // 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. + KillTimeout *int64 `json:"kill_timeout,omitempty"` + + _rawJSON json.RawMessage +} + +func (l *Lifecycle) UnmarshalJSON(data []byte) error { + type unmarshaler Lifecycle + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = Lifecycle(value) + l._rawJSON = json.RawMessage(data) + return nil +} + +func (l *Lifecycle) String() string { + if len(l._rawJSON) > 0 { + if value, err := core.StringifyJSON(l._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) +} + type Network struct { Mode *NetworkMode `json:"mode,omitempty"` Ports map[string]*Port `json:"ports,omitempty"` @@ -337,22 +367,50 @@ func (r *Resources) String() string { return fmt.Sprintf("%#v", r) } -type Server struct { - Id uuid.UUID `json:"id"` - Game uuid.UUID `json:"game"` - Datacenter uuid.UUID `json:"datacenter"` - Cluster uuid.UUID `json:"cluster"` - Tags interface{} `json:"tags,omitempty"` +type Runtime struct { Image uuid.UUID `json:"image"` Arguments []string `json:"arguments,omitempty"` Environment map[string]string `json:"environment,omitempty"` - Network *Network `json:"network,omitempty"` - Resources *Resources `json:"resources,omitempty"` - // 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. - KillTimeout *int64 `json:"kill_timeout,omitempty"` - CreatedAt int64 `json:"created_at"` - StartedAt *int64 `json:"started_at,omitempty"` - DestroyedAt *int64 `json:"destroyed_at,omitempty"` + + _rawJSON json.RawMessage +} + +func (r *Runtime) UnmarshalJSON(data []byte) error { + type unmarshaler Runtime + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *r = Runtime(value) + r._rawJSON = json.RawMessage(data) + return nil +} + +func (r *Runtime) String() string { + if len(r._rawJSON) > 0 { + if value, err := core.StringifyJSON(r._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(r); err == nil { + return value + } + return fmt.Sprintf("%#v", r) +} + +type Server struct { + Id uuid.UUID `json:"id"` + Environment uuid.UUID `json:"environment"` + Datacenter uuid.UUID `json:"datacenter"` + Cluster uuid.UUID `json:"cluster"` + Tags interface{} `json:"tags,omitempty"` + Runtime *Runtime `json:"runtime,omitempty"` + Network *Network `json:"network,omitempty"` + Resources *Resources `json:"resources,omitempty"` + Lifecycle *Lifecycle `json:"lifecycle,omitempty"` + CreatedAt int64 `json:"created_at"` + StartedAt *int64 `json:"started_at,omitempty"` + DestroyedAt *int64 `json:"destroyed_at,omitempty"` _rawJSON json.RawMessage } @@ -440,3 +498,34 @@ func (c *CreateServerPortRequest) String() string { } return fmt.Sprintf("%#v", c) } + +type CreateServerRuntimeRequest struct { + Image uuid.UUID `json:"image"` + Arguments []string `json:"arguments,omitempty"` + Environment map[string]string `json:"environment,omitempty"` + + _rawJSON json.RawMessage +} + +func (c *CreateServerRuntimeRequest) UnmarshalJSON(data []byte) error { + type unmarshaler CreateServerRuntimeRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CreateServerRuntimeRequest(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CreateServerRuntimeRequest) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} diff --git a/sdks/full/openapi/openapi.yml b/sdks/full/openapi/openapi.yml index a70b922147..544a28537b 100644 --- a/sdks/full/openapi/openapi.yml +++ b/sdks/full/openapi/openapi.yml @@ -4874,7 +4874,7 @@ paths: schema: $ref: '#/components/schemas/ErrorBody' security: *ref_0 - /games/{game_id}/servers/{server_id}: + /games/{game_id}/environments/{environment_id}/servers/{server_id}: get: description: Gets a dynamic server. operationId: servers_get @@ -4887,6 +4887,12 @@ paths: schema: type: string format: uuid + - name: environment_id + in: path + required: true + schema: + type: string + format: uuid - name: server_id in: path description: The id of the server to destroy @@ -4950,6 +4956,12 @@ paths: schema: type: string format: uuid + - name: environment_id + in: path + required: true + schema: + type: string + format: uuid - name: server_id in: path description: The id of the server to destroy @@ -5011,7 +5023,7 @@ paths: schema: $ref: '#/components/schemas/ErrorBody' security: *ref_0 - /games/{game_id}/servers: + /games/{game_id}/environments/{environment_id}/servers: get: description: >- Lists all servers associated with the token used. Can be filtered by @@ -5026,6 +5038,12 @@ paths: schema: type: string format: uuid + - name: environment_id + in: path + required: true + schema: + type: string + format: uuid - name: tags_json in: query required: false @@ -5093,6 +5111,12 @@ paths: schema: type: string format: uuid + - name: environment_id + in: path + required: true + schema: + type: string + format: uuid responses: '200': description: '' @@ -6936,63 +6960,6 @@ paths: schema: $ref: '#/components/schemas/ErrorBody' security: *ref_0 - /cloud/games/{game_id}/tokens/service: - post: - description: Creates a new game service token. - operationId: cloud_games_tokens_createServiceToken - tags: - - CloudGamesTokens - parameters: - - name: game_id - in: path - required: true - schema: - type: string - format: uuid - responses: - '200': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/CloudGamesCreateCloudTokenResponse' - '400': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - '403': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - '404': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - '408': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - '429': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - '500': - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - security: *ref_0 /cloud/games/{game_id}/versions: post: description: Creates a new game version. @@ -7460,6 +7427,70 @@ paths: schema: $ref: '#/components/schemas/ErrorBody' security: *ref_0 + /games/{game_id}/environments/{environment_id}/tokens/service: + post: + description: Creates a new environment service token. + operationId: games_environments_tokens_createServiceToken + tags: + - GamesEnvironmentsTokens + parameters: + - name: game_id + in: path + required: true + schema: + type: string + format: uuid + - name: environment_id + in: path + required: true + schema: + type: string + format: uuid + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: >- + #/components/schemas/GamesEnvironmentsCreateServiceTokenResponse + '400': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorBody' + '403': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorBody' + '404': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorBody' + '408': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorBody' + '429': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorBody' + '500': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorBody' + security: *ref_0 /group/invites/{group_invite_code}: get: description: >- @@ -9174,7 +9205,7 @@ paths: schema: $ref: '#/components/schemas/ErrorBody' security: *ref_0 - /games/{game_id}/builds/{build_id}: + /games/{game_id}/environments/{environment_id}/builds/{build_id}: get: description: >- Lists all builds of the game associated with the token used. Can be @@ -9189,6 +9220,12 @@ paths: schema: type: string format: uuid + - name: environment_id + in: path + required: true + schema: + type: string + format: uuid - name: build_id in: path required: true @@ -9250,7 +9287,7 @@ paths: schema: $ref: '#/components/schemas/ErrorBody' security: *ref_0 - /games/{game_id}/builds: + /games/{game_id}/environments/{environment_id}/builds: get: description: >- Lists all builds of the game associated with the token used. Can be @@ -9265,6 +9302,12 @@ paths: schema: type: string format: uuid + - name: environment_id + in: path + required: true + schema: + type: string + format: uuid - name: tags_json in: query required: false @@ -9320,7 +9363,7 @@ paths: schema: $ref: '#/components/schemas/ErrorBody' security: *ref_0 - /games/{game_id}/builds/{build_id}/tags: + /games/{game_id}/environments/{environment_id}/builds/{build_id}/tags: patch: operationId: servers_builds_patchTags tags: @@ -9332,6 +9375,12 @@ paths: schema: type: string format: uuid + - name: environment_id + in: path + required: true + schema: + type: string + format: uuid - name: build_id in: path required: true @@ -9388,7 +9437,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ServersPatchBuildTagsRequest' - /games/{game_id}/builds/prepare: + /games/{game_id}/environments/{environment_id}/builds/prepare: post: description: Creates a new game build for the given game. operationId: servers_builds_prepareBuild @@ -9401,6 +9450,12 @@ paths: schema: type: string format: uuid + - name: environment_id + in: path + required: true + schema: + type: string + format: uuid responses: '200': description: '' @@ -9451,7 +9506,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ServersCreateBuildRequest' - /games/{game_id}/builds/{build_id}/complete: + /games/{game_id}/environments/{environment_id}/builds/{build_id}/complete: post: description: Marks an upload as complete. operationId: servers_builds_completeBuild @@ -9464,6 +9519,12 @@ paths: schema: type: string format: uuid + - name: environment_id + in: path + required: true + schema: + type: string + format: uuid - name: build_id in: path required: true @@ -9510,7 +9571,7 @@ paths: schema: $ref: '#/components/schemas/ErrorBody' security: *ref_0 - /games/{game_id}/servers/{server_id}/logs: + /games/{game_id}/environments/{environment_id}/servers/{server_id}/logs: get: description: Returns the logs for a given server. operationId: servers_logs_getServerLogs @@ -9523,6 +9584,12 @@ paths: schema: type: string format: uuid + - name: environment_id + in: path + required: true + schema: + type: string + format: uuid - name: server_id in: path required: true @@ -10731,6 +10798,23 @@ components: type: string format: uuid tags: {} + runtime: + $ref: '#/components/schemas/ServersCreateServerRuntimeRequest' + network: + $ref: '#/components/schemas/ServersCreateServerNetworkRequest' + resources: + $ref: '#/components/schemas/ServersResources' + lifecycle: + $ref: '#/components/schemas/ServersLifecycle' + required: + - datacenter + - tags + - runtime + - network + - resources + ServersCreateServerRuntimeRequest: + type: object + properties: image: type: string format: uuid @@ -10742,26 +10826,8 @@ components: type: object additionalProperties: type: string - network: - $ref: '#/components/schemas/ServersCreateServerNetworkRequest' - resources: - $ref: '#/components/schemas/ServersResources' - kill_timeout: - type: integer - format: int64 - description: >- - 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. - webhook_url: - type: string - description: A url to send to which events from the server running will be sent required: - - datacenter - - tags - image - - network - - resources ServersCreateServerNetworkRequest: type: object properties: @@ -12221,14 +12287,6 @@ components: JSON. required: - token - CloudGamesCreateServiceTokenResponse: - type: object - properties: - token: - type: string - description: A JSON Web Token. - required: - - token CloudGamesCreateGameVersionRequest: type: object properties: @@ -13174,6 +13232,14 @@ components: - desc - asc description: A value denoting the sorting method of a game statistic. + GamesEnvironmentsCreateServiceTokenResponse: + type: object + properties: + token: + type: string + description: A JSON Web Token. + required: + - token GeoCoord: type: object description: Geographical coordinates for a location on Planet Earth. @@ -14287,7 +14353,7 @@ components: id: type: string format: uuid - game: + environment: type: string format: uuid datacenter: @@ -14297,28 +14363,14 @@ components: type: string format: uuid tags: {} - image: - type: string - format: uuid - arguments: - type: array - items: - type: string - environment: - type: object - additionalProperties: - type: string + runtime: + $ref: '#/components/schemas/ServersRuntime' network: $ref: '#/components/schemas/ServersNetwork' resources: $ref: '#/components/schemas/ServersResources' - kill_timeout: - type: integer - format: int64 - description: >- - 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. + lifecycle: + $ref: '#/components/schemas/ServersLifecycle' created_at: type: integer format: int64 @@ -14330,14 +14382,41 @@ components: format: int64 required: - id - - game + - environment - datacenter - cluster - tags - - image + - runtime - network - resources + - lifecycle - created_at + ServersRuntime: + type: object + properties: + image: + type: string + format: uuid + arguments: + type: array + items: + type: string + environment: + type: object + additionalProperties: + type: string + required: + - image + ServersLifecycle: + type: object + properties: + kill_timeout: + type: integer + format: int64 + description: >- + 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. ServersResources: type: object properties: diff --git a/sdks/full/openapi_compat/openapi.yml b/sdks/full/openapi_compat/openapi.yml index c20f6ea8fc..7a24ec558c 100644 --- a/sdks/full/openapi_compat/openapi.yml +++ b/sdks/full/openapi_compat/openapi.yml @@ -861,14 +861,6 @@ components: required: - version_id type: object - CloudGamesCreateServiceTokenResponse: - properties: - token: - description: A JSON Web Token. - type: string - required: - - token - type: object CloudGamesDeleteMatchmakerLobbyResponse: properties: did_remove: @@ -2928,6 +2920,14 @@ components: - developer - total_player_count type: object + GamesEnvironmentsCreateServiceTokenResponse: + properties: + token: + description: A JSON Web Token. + type: string + required: + - token + type: object GeoCoord: description: Geographical coordinates for a location on Planet Earth. properties: @@ -4495,39 +4495,22 @@ components: type: object ServersCreateServerRequest: properties: - arguments: - items: - type: string - type: array datacenter: format: uuid type: string - environment: - additionalProperties: - type: string - type: object - image: - format: uuid - type: string - kill_timeout: - description: 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. - format: int64 - type: integer + lifecycle: + $ref: '#/components/schemas/ServersLifecycle' network: $ref: '#/components/schemas/ServersCreateServerNetworkRequest' resources: $ref: '#/components/schemas/ServersResources' + runtime: + $ref: '#/components/schemas/ServersCreateServerRuntimeRequest' tags: {} - webhook_url: - description: A url to send to which events from the server running will - be sent - type: string required: - datacenter - tags - - image + - runtime - network - resources type: object @@ -4539,6 +4522,22 @@ components: required: - server type: object + ServersCreateServerRuntimeRequest: + properties: + arguments: + items: + type: string + type: array + environment: + additionalProperties: + type: string + type: object + image: + format: uuid + type: string + required: + - image + type: object ServersDestroyServerResponse: properties: {} type: object @@ -4581,6 +4580,15 @@ components: ServersHostRouting: properties: {} type: object + ServersLifecycle: + properties: + kill_timeout: + description: 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. + format: int64 + type: integer + type: object ServersListBuildsResponse: properties: builds: @@ -4684,12 +4692,24 @@ components: - cpu - memory type: object - ServersServer: + ServersRuntime: properties: arguments: items: type: string type: array + environment: + additionalProperties: + type: string + type: object + image: + format: uuid + type: string + required: + - image + type: object + ServersServer: + properties: cluster: format: uuid type: string @@ -4703,41 +4723,33 @@ components: format: int64 type: integer environment: - additionalProperties: - type: string - type: object - game: format: uuid type: string id: format: uuid type: string - image: - format: uuid - type: string - kill_timeout: - description: 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. - format: int64 - type: integer + lifecycle: + $ref: '#/components/schemas/ServersLifecycle' network: $ref: '#/components/schemas/ServersNetwork' resources: $ref: '#/components/schemas/ServersResources' + runtime: + $ref: '#/components/schemas/ServersRuntime' started_at: format: int64 type: integer tags: {} required: - id - - game + - environment - datacenter - cluster - tags - - image + - runtime - network - resources + - lifecycle - created_at type: object Timestamp: @@ -8357,63 +8369,6 @@ paths: security: *id001 tags: - CloudGamesTokens - /cloud/games/{game_id}/tokens/service: - post: - description: Creates a new game service token. - operationId: cloud_games_tokens_createServiceToken - parameters: - - in: path - name: game_id - required: true - schema: - format: uuid - type: string - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/CloudGamesCreateCloudTokenResponse' - description: '' - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - description: '' - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - description: '' - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - description: '' - '408': - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - description: '' - '429': - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - description: '' - '500': - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorBody' - description: '' - security: *id001 - tags: - - CloudGamesTokens /cloud/games/{game_id}/versions: post: description: Creates a new game version. @@ -8936,7 +8891,7 @@ paths: security: *id001 tags: - ProvisionDatacenters - /games/{game_id}/builds: + /games/{game_id}/environments/{environment_id}/builds: get: description: Lists all builds of the game associated with the token used. Can be filtered by tags in the query string. @@ -8948,6 +8903,12 @@ paths: schema: format: uuid type: string + - in: path + name: environment_id + required: true + schema: + format: uuid + type: string - in: query name: tags_json required: false @@ -9005,7 +8966,7 @@ paths: security: *id001 tags: - ServersBuilds - /games/{game_id}/builds/prepare: + /games/{game_id}/environments/{environment_id}/builds/prepare: post: description: Creates a new game build for the given game. operationId: servers_builds_prepareBuild @@ -9016,6 +8977,12 @@ paths: schema: format: uuid type: string + - in: path + name: environment_id + required: true + schema: + format: uuid + type: string requestBody: content: application/json: @@ -9068,7 +9035,7 @@ paths: security: *id001 tags: - ServersBuilds - /games/{game_id}/builds/{build_id}: + /games/{game_id}/environments/{environment_id}/builds/{build_id}: get: description: Lists all builds of the game associated with the token used. Can be filtered by tags in the query string. @@ -9080,6 +9047,12 @@ paths: schema: format: uuid type: string + - in: path + name: environment_id + required: true + schema: + format: uuid + type: string - in: path name: build_id required: true @@ -9143,7 +9116,7 @@ paths: security: *id001 tags: - ServersBuilds - /games/{game_id}/builds/{build_id}/complete: + /games/{game_id}/environments/{environment_id}/builds/{build_id}/complete: post: description: Marks an upload as complete. operationId: servers_builds_completeBuild @@ -9154,6 +9127,12 @@ paths: schema: format: uuid type: string + - in: path + name: environment_id + required: true + schema: + format: uuid + type: string - in: path name: build_id required: true @@ -9202,7 +9181,7 @@ paths: security: *id001 tags: - ServersBuilds - /games/{game_id}/builds/{build_id}/tags: + /games/{game_id}/environments/{environment_id}/builds/{build_id}/tags: patch: operationId: servers_builds_patchTags parameters: @@ -9212,6 +9191,12 @@ paths: schema: format: uuid type: string + - in: path + name: environment_id + required: true + schema: + format: uuid + type: string - in: path name: build_id required: true @@ -9270,7 +9255,7 @@ paths: security: *id001 tags: - ServersBuilds - /games/{game_id}/servers: + /games/{game_id}/environments/{environment_id}/servers: get: description: Lists all servers associated with the token used. Can be filtered by tags in the query string. @@ -9282,6 +9267,12 @@ paths: schema: format: uuid type: string + - in: path + name: environment_id + required: true + schema: + format: uuid + type: string - in: query name: tags_json required: false @@ -9349,6 +9340,12 @@ paths: schema: format: uuid type: string + - in: path + name: environment_id + required: true + schema: + format: uuid + type: string requestBody: content: application/json: @@ -9401,7 +9398,7 @@ paths: security: *id001 tags: - Servers - /games/{game_id}/servers/{server_id}: + /games/{game_id}/environments/{environment_id}/servers/{server_id}: delete: description: Destroy a dynamic server. operationId: servers_destroy @@ -9412,6 +9409,12 @@ paths: schema: format: uuid type: string + - in: path + name: environment_id + required: true + schema: + format: uuid + type: string - description: The id of the server to destroy in: path name: server_id @@ -9484,6 +9487,12 @@ paths: schema: format: uuid type: string + - in: path + name: environment_id + required: true + schema: + format: uuid + type: string - description: The id of the server to destroy in: path name: server_id @@ -9537,7 +9546,7 @@ paths: security: *id001 tags: - Servers - /games/{game_id}/servers/{server_id}/logs: + /games/{game_id}/environments/{environment_id}/servers/{server_id}/logs: get: description: Returns the logs for a given server. operationId: servers_logs_getServerLogs @@ -9548,6 +9557,12 @@ paths: schema: format: uuid type: string + - in: path + name: environment_id + required: true + schema: + format: uuid + type: string - in: path name: server_id required: true @@ -9617,6 +9632,69 @@ paths: security: *id001 tags: - ServersLogs + /games/{game_id}/environments/{environment_id}/tokens/service: + post: + description: Creates a new environment service token. + operationId: games_environments_tokens_createServiceToken + parameters: + - in: path + name: game_id + required: true + schema: + format: uuid + type: string + - in: path + name: environment_id + required: true + schema: + format: uuid + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GamesEnvironmentsCreateServiceTokenResponse' + description: '' + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorBody' + description: '' + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorBody' + description: '' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorBody' + description: '' + '408': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorBody' + description: '' + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorBody' + description: '' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorBody' + description: '' + security: *id001 + tags: + - GamesEnvironmentsTokens /group/groups: get: description: Returns a list of suggested groups. diff --git a/sdks/full/rust-cli/.openapi-generator/FILES b/sdks/full/rust-cli/.openapi-generator/FILES index 41798ccc66..6e22b666de 100644 --- a/sdks/full/rust-cli/.openapi-generator/FILES +++ b/sdks/full/rust-cli/.openapi-generator/FILES @@ -84,7 +84,6 @@ docs/CloudGamesCreateGameRequest.md docs/CloudGamesCreateGameResponse.md docs/CloudGamesCreateGameVersionRequest.md docs/CloudGamesCreateGameVersionResponse.md -docs/CloudGamesCreateServiceTokenResponse.md docs/CloudGamesDeleteMatchmakerLobbyResponse.md docs/CloudGamesExportLobbyLogsRequest.md docs/CloudGamesExportLobbyLogsResponse.md @@ -219,6 +218,8 @@ docs/GameStatFormatMethod.md docs/GameStatSortingMethod.md docs/GameStatSummary.md docs/GameSummary.md +docs/GamesEnvironmentsCreateServiceTokenResponse.md +docs/GamesEnvironmentsTokensApi.md docs/GeoCoord.md docs/GeoDistance.md docs/GlobalEventNotification.md @@ -357,9 +358,11 @@ docs/ServersCreateServerNetworkRequest.md docs/ServersCreateServerPortRequest.md docs/ServersCreateServerRequest.md docs/ServersCreateServerResponse.md +docs/ServersCreateServerRuntimeRequest.md docs/ServersGetBuildResponse.md docs/ServersGetServerLogsResponse.md docs/ServersGetServerResponse.md +docs/ServersLifecycle.md docs/ServersListBuildsResponse.md docs/ServersListServersResponse.md docs/ServersLogStream.md @@ -371,6 +374,7 @@ docs/ServersPort.md docs/ServersPortProtocol.md docs/ServersPortRouting.md docs/ServersResources.md +docs/ServersRuntime.md docs/ServersServer.md docs/UploadPrepareFile.md docs/UploadPresignedRequest.md @@ -402,6 +406,7 @@ src/apis/cloud_logs_api.rs src/apis/cloud_tiers_api.rs src/apis/cloud_uploads_api.rs src/apis/configuration.rs +src/apis/games_environments_tokens_api.rs src/apis/group_api.rs src/apis/group_invites_api.rs src/apis/group_join_requests_api.rs @@ -489,7 +494,6 @@ src/models/cloud_games_create_game_request.rs src/models/cloud_games_create_game_response.rs src/models/cloud_games_create_game_version_request.rs src/models/cloud_games_create_game_version_response.rs -src/models/cloud_games_create_service_token_response.rs src/models/cloud_games_delete_matchmaker_lobby_response.rs src/models/cloud_games_export_lobby_logs_request.rs src/models/cloud_games_export_lobby_logs_response.rs @@ -614,6 +618,7 @@ src/models/game_stat_format_method.rs src/models/game_stat_sorting_method.rs src/models/game_stat_summary.rs src/models/game_summary.rs +src/models/games_environments_create_service_token_response.rs src/models/geo_coord.rs src/models/geo_distance.rs src/models/global_event_notification.rs @@ -736,9 +741,11 @@ src/models/servers_create_server_network_request.rs src/models/servers_create_server_port_request.rs src/models/servers_create_server_request.rs src/models/servers_create_server_response.rs +src/models/servers_create_server_runtime_request.rs src/models/servers_get_build_response.rs src/models/servers_get_server_logs_response.rs src/models/servers_get_server_response.rs +src/models/servers_lifecycle.rs src/models/servers_list_builds_response.rs src/models/servers_list_servers_response.rs src/models/servers_log_stream.rs @@ -749,6 +756,7 @@ src/models/servers_port.rs src/models/servers_port_protocol.rs src/models/servers_port_routing.rs src/models/servers_resources.rs +src/models/servers_runtime.rs src/models/servers_server.rs src/models/upload_prepare_file.rs src/models/upload_presigned_request.rs diff --git a/sdks/full/rust-cli/README.md b/sdks/full/rust-cli/README.md index 6052b89e02..a3710de8a3 100644 --- a/sdks/full/rust-cli/README.md +++ b/sdks/full/rust-cli/README.md @@ -82,7 +82,6 @@ Class | Method | HTTP request | Description *CloudGamesNamespacesLogsApi* | [**cloud_games_namespaces_logs_get_namespace_lobby**](docs/CloudGamesNamespacesLogsApi.md#cloud_games_namespaces_logs_get_namespace_lobby) | **GET** /cloud/games/{game_id}/namespaces/{namespace_id}/logs/lobbies/{lobby_id} | *CloudGamesNamespacesLogsApi* | [**cloud_games_namespaces_logs_list_namespace_lobbies**](docs/CloudGamesNamespacesLogsApi.md#cloud_games_namespaces_logs_list_namespace_lobbies) | **GET** /cloud/games/{game_id}/namespaces/{namespace_id}/logs/lobbies | *CloudGamesTokensApi* | [**cloud_games_tokens_create_cloud_token**](docs/CloudGamesTokensApi.md#cloud_games_tokens_create_cloud_token) | **POST** /cloud/games/{game_id}/tokens/cloud | -*CloudGamesTokensApi* | [**cloud_games_tokens_create_service_token**](docs/CloudGamesTokensApi.md#cloud_games_tokens_create_service_token) | **POST** /cloud/games/{game_id}/tokens/service | *CloudGamesVersionsApi* | [**cloud_games_versions_create_game_version**](docs/CloudGamesVersionsApi.md#cloud_games_versions_create_game_version) | **POST** /cloud/games/{game_id}/versions | *CloudGamesVersionsApi* | [**cloud_games_versions_get_game_version_by_id**](docs/CloudGamesVersionsApi.md#cloud_games_versions_get_game_version_by_id) | **GET** /cloud/games/{game_id}/versions/{version_id} | *CloudGamesVersionsApi* | [**cloud_games_versions_reserve_version_name**](docs/CloudGamesVersionsApi.md#cloud_games_versions_reserve_version_name) | **POST** /cloud/games/{game_id}/versions/reserve-name | @@ -91,6 +90,7 @@ Class | Method | HTTP request | Description *CloudLogsApi* | [**cloud_logs_get_ray_perf_logs**](docs/CloudLogsApi.md#cloud_logs_get_ray_perf_logs) | **GET** /cloud/rays/{ray_id}/perf | *CloudTiersApi* | [**cloud_tiers_get_region_tiers**](docs/CloudTiersApi.md#cloud_tiers_get_region_tiers) | **GET** /cloud/region-tiers | *CloudUploadsApi* | [**cloud_uploads_complete_upload**](docs/CloudUploadsApi.md#cloud_uploads_complete_upload) | **POST** /cloud/uploads/{upload_id}/complete | +*GamesEnvironmentsTokensApi* | [**games_environments_tokens_create_service_token**](docs/GamesEnvironmentsTokensApi.md#games_environments_tokens_create_service_token) | **POST** /games/{game_id}/environments/{environment_id}/tokens/service | *GroupApi* | [**group_ban_identity**](docs/GroupApi.md#group_ban_identity) | **POST** /group/groups/{group_id}/bans/{identity_id} | *GroupApi* | [**group_complete_avatar_upload**](docs/GroupApi.md#group_complete_avatar_upload) | **POST** /group/groups/{group_id}/avatar-upload/{upload_id}/complete | *GroupApi* | [**group_create**](docs/GroupApi.md#group_create) | **POST** /group/groups | @@ -167,16 +167,16 @@ Class | Method | HTTP request | Description *PortalGamesApi* | [**portal_games_get_game_profile**](docs/PortalGamesApi.md#portal_games_get_game_profile) | **GET** /portal/games/{game_name_id}/profile | *ProvisionDatacentersApi* | [**provision_datacenters_get_tls**](docs/ProvisionDatacentersApi.md#provision_datacenters_get_tls) | **GET** /datacenters/{datacenter_id}/tls | *ProvisionServersApi* | [**provision_servers_get_info**](docs/ProvisionServersApi.md#provision_servers_get_info) | **GET** /servers/{ip} | -*ServersApi* | [**servers_create**](docs/ServersApi.md#servers_create) | **POST** /games/{game_id}/servers | -*ServersApi* | [**servers_destroy**](docs/ServersApi.md#servers_destroy) | **DELETE** /games/{game_id}/servers/{server_id} | -*ServersApi* | [**servers_get**](docs/ServersApi.md#servers_get) | **GET** /games/{game_id}/servers/{server_id} | -*ServersApi* | [**servers_list**](docs/ServersApi.md#servers_list) | **GET** /games/{game_id}/servers | -*ServersBuildsApi* | [**servers_builds_complete_build**](docs/ServersBuildsApi.md#servers_builds_complete_build) | **POST** /games/{game_id}/builds/{build_id}/complete | -*ServersBuildsApi* | [**servers_builds_get_build**](docs/ServersBuildsApi.md#servers_builds_get_build) | **GET** /games/{game_id}/builds/{build_id} | -*ServersBuildsApi* | [**servers_builds_list_builds**](docs/ServersBuildsApi.md#servers_builds_list_builds) | **GET** /games/{game_id}/builds | -*ServersBuildsApi* | [**servers_builds_patch_tags**](docs/ServersBuildsApi.md#servers_builds_patch_tags) | **PATCH** /games/{game_id}/builds/{build_id}/tags | -*ServersBuildsApi* | [**servers_builds_prepare_build**](docs/ServersBuildsApi.md#servers_builds_prepare_build) | **POST** /games/{game_id}/builds/prepare | -*ServersLogsApi* | [**servers_logs_get_server_logs**](docs/ServersLogsApi.md#servers_logs_get_server_logs) | **GET** /games/{game_id}/servers/{server_id}/logs | +*ServersApi* | [**servers_create**](docs/ServersApi.md#servers_create) | **POST** /games/{game_id}/environments/{environment_id}/servers | +*ServersApi* | [**servers_destroy**](docs/ServersApi.md#servers_destroy) | **DELETE** /games/{game_id}/environments/{environment_id}/servers/{server_id} | +*ServersApi* | [**servers_get**](docs/ServersApi.md#servers_get) | **GET** /games/{game_id}/environments/{environment_id}/servers/{server_id} | +*ServersApi* | [**servers_list**](docs/ServersApi.md#servers_list) | **GET** /games/{game_id}/environments/{environment_id}/servers | +*ServersBuildsApi* | [**servers_builds_complete_build**](docs/ServersBuildsApi.md#servers_builds_complete_build) | **POST** /games/{game_id}/environments/{environment_id}/builds/{build_id}/complete | +*ServersBuildsApi* | [**servers_builds_get_build**](docs/ServersBuildsApi.md#servers_builds_get_build) | **GET** /games/{game_id}/environments/{environment_id}/builds/{build_id} | +*ServersBuildsApi* | [**servers_builds_list_builds**](docs/ServersBuildsApi.md#servers_builds_list_builds) | **GET** /games/{game_id}/environments/{environment_id}/builds | +*ServersBuildsApi* | [**servers_builds_patch_tags**](docs/ServersBuildsApi.md#servers_builds_patch_tags) | **PATCH** /games/{game_id}/environments/{environment_id}/builds/{build_id}/tags | +*ServersBuildsApi* | [**servers_builds_prepare_build**](docs/ServersBuildsApi.md#servers_builds_prepare_build) | **POST** /games/{game_id}/environments/{environment_id}/builds/prepare | +*ServersLogsApi* | [**servers_logs_get_server_logs**](docs/ServersLogsApi.md#servers_logs_get_server_logs) | **GET** /games/{game_id}/environments/{environment_id}/servers/{server_id}/logs | ## Documentation For Models @@ -248,7 +248,6 @@ Class | Method | HTTP request | Description - [CloudGamesCreateGameResponse](docs/CloudGamesCreateGameResponse.md) - [CloudGamesCreateGameVersionRequest](docs/CloudGamesCreateGameVersionRequest.md) - [CloudGamesCreateGameVersionResponse](docs/CloudGamesCreateGameVersionResponse.md) - - [CloudGamesCreateServiceTokenResponse](docs/CloudGamesCreateServiceTokenResponse.md) - [CloudGamesDeleteMatchmakerLobbyResponse](docs/CloudGamesDeleteMatchmakerLobbyResponse.md) - [CloudGamesExportLobbyLogsRequest](docs/CloudGamesExportLobbyLogsRequest.md) - [CloudGamesExportLobbyLogsResponse](docs/CloudGamesExportLobbyLogsResponse.md) @@ -373,6 +372,7 @@ Class | Method | HTTP request | Description - [GameStatSortingMethod](docs/GameStatSortingMethod.md) - [GameStatSummary](docs/GameStatSummary.md) - [GameSummary](docs/GameSummary.md) + - [GamesEnvironmentsCreateServiceTokenResponse](docs/GamesEnvironmentsCreateServiceTokenResponse.md) - [GeoCoord](docs/GeoCoord.md) - [GeoDistance](docs/GeoDistance.md) - [GlobalEventNotification](docs/GlobalEventNotification.md) @@ -494,9 +494,11 @@ Class | Method | HTTP request | Description - [ServersCreateServerPortRequest](docs/ServersCreateServerPortRequest.md) - [ServersCreateServerRequest](docs/ServersCreateServerRequest.md) - [ServersCreateServerResponse](docs/ServersCreateServerResponse.md) + - [ServersCreateServerRuntimeRequest](docs/ServersCreateServerRuntimeRequest.md) - [ServersGetBuildResponse](docs/ServersGetBuildResponse.md) - [ServersGetServerLogsResponse](docs/ServersGetServerLogsResponse.md) - [ServersGetServerResponse](docs/ServersGetServerResponse.md) + - [ServersLifecycle](docs/ServersLifecycle.md) - [ServersListBuildsResponse](docs/ServersListBuildsResponse.md) - [ServersListServersResponse](docs/ServersListServersResponse.md) - [ServersLogStream](docs/ServersLogStream.md) @@ -507,6 +509,7 @@ Class | Method | HTTP request | Description - [ServersPortProtocol](docs/ServersPortProtocol.md) - [ServersPortRouting](docs/ServersPortRouting.md) - [ServersResources](docs/ServersResources.md) + - [ServersRuntime](docs/ServersRuntime.md) - [ServersServer](docs/ServersServer.md) - [UploadPrepareFile](docs/UploadPrepareFile.md) - [UploadPresignedRequest](docs/UploadPresignedRequest.md) diff --git a/sdks/full/rust-cli/docs/CloudGamesTokensApi.md b/sdks/full/rust-cli/docs/CloudGamesTokensApi.md index 8c64a98652..c0ee6276fc 100644 --- a/sdks/full/rust-cli/docs/CloudGamesTokensApi.md +++ b/sdks/full/rust-cli/docs/CloudGamesTokensApi.md @@ -5,7 +5,6 @@ All URIs are relative to *https://api.rivet.gg* Method | HTTP request | Description ------------- | ------------- | ------------- [**cloud_games_tokens_create_cloud_token**](CloudGamesTokensApi.md#cloud_games_tokens_create_cloud_token) | **POST** /cloud/games/{game_id}/tokens/cloud | -[**cloud_games_tokens_create_service_token**](CloudGamesTokensApi.md#cloud_games_tokens_create_service_token) | **POST** /cloud/games/{game_id}/tokens/service | @@ -38,33 +37,3 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -## cloud_games_tokens_create_service_token - -> crate::models::CloudGamesCreateCloudTokenResponse cloud_games_tokens_create_service_token(game_id) - - -Creates a new game service token. - -### Parameters - - -Name | Type | Description | Required | Notes -------------- | ------------- | ------------- | ------------- | ------------- -**game_id** | **uuid::Uuid** | | [required] | - -### Return type - -[**crate::models::CloudGamesCreateCloudTokenResponse**](CloudGamesCreateCloudTokenResponse.md) - -### Authorization - -[BearerAuth](../README.md#BearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/sdks/full/rust-cli/docs/CloudGamesCreateServiceTokenResponse.md b/sdks/full/rust-cli/docs/GamesEnvironmentsCreateServiceTokenResponse.md similarity index 87% rename from sdks/full/rust-cli/docs/CloudGamesCreateServiceTokenResponse.md rename to sdks/full/rust-cli/docs/GamesEnvironmentsCreateServiceTokenResponse.md index c8d021b0f2..ee3490d4cc 100644 --- a/sdks/full/rust-cli/docs/CloudGamesCreateServiceTokenResponse.md +++ b/sdks/full/rust-cli/docs/GamesEnvironmentsCreateServiceTokenResponse.md @@ -1,4 +1,4 @@ -# CloudGamesCreateServiceTokenResponse +# GamesEnvironmentsCreateServiceTokenResponse ## Properties diff --git a/sdks/full/rust-cli/docs/GamesEnvironmentsTokensApi.md b/sdks/full/rust-cli/docs/GamesEnvironmentsTokensApi.md new file mode 100644 index 0000000000..cead2b98d8 --- /dev/null +++ b/sdks/full/rust-cli/docs/GamesEnvironmentsTokensApi.md @@ -0,0 +1,40 @@ +# \GamesEnvironmentsTokensApi + +All URIs are relative to *https://api.rivet.gg* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**games_environments_tokens_create_service_token**](GamesEnvironmentsTokensApi.md#games_environments_tokens_create_service_token) | **POST** /games/{game_id}/environments/{environment_id}/tokens/service | + + + +## games_environments_tokens_create_service_token + +> crate::models::GamesEnvironmentsCreateServiceTokenResponse games_environments_tokens_create_service_token(game_id, environment_id) + + +Creates a new environment service token. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | + +### Return type + +[**crate::models::GamesEnvironmentsCreateServiceTokenResponse**](GamesEnvironmentsCreateServiceTokenResponse.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/sdks/full/rust-cli/docs/ServersApi.md b/sdks/full/rust-cli/docs/ServersApi.md index f446dd1893..82ee6e30e6 100644 --- a/sdks/full/rust-cli/docs/ServersApi.md +++ b/sdks/full/rust-cli/docs/ServersApi.md @@ -4,16 +4,16 @@ All URIs are relative to *https://api.rivet.gg* Method | HTTP request | Description ------------- | ------------- | ------------- -[**servers_create**](ServersApi.md#servers_create) | **POST** /games/{game_id}/servers | -[**servers_destroy**](ServersApi.md#servers_destroy) | **DELETE** /games/{game_id}/servers/{server_id} | -[**servers_get**](ServersApi.md#servers_get) | **GET** /games/{game_id}/servers/{server_id} | -[**servers_list**](ServersApi.md#servers_list) | **GET** /games/{game_id}/servers | +[**servers_create**](ServersApi.md#servers_create) | **POST** /games/{game_id}/environments/{environment_id}/servers | +[**servers_destroy**](ServersApi.md#servers_destroy) | **DELETE** /games/{game_id}/environments/{environment_id}/servers/{server_id} | +[**servers_get**](ServersApi.md#servers_get) | **GET** /games/{game_id}/environments/{environment_id}/servers/{server_id} | +[**servers_list**](ServersApi.md#servers_list) | **GET** /games/{game_id}/environments/{environment_id}/servers | ## servers_create -> crate::models::ServersCreateServerResponse servers_create(game_id, servers_create_server_request) +> crate::models::ServersCreateServerResponse servers_create(game_id, environment_id, servers_create_server_request) Create a new dynamic server. @@ -24,6 +24,7 @@ Create a new dynamic server. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **servers_create_server_request** | [**ServersCreateServerRequest**](ServersCreateServerRequest.md) | | [required] | ### Return type @@ -44,7 +45,7 @@ Name | Type | Description | Required | Notes ## servers_destroy -> serde_json::Value servers_destroy(game_id, server_id, override_kill_timeout) +> serde_json::Value servers_destroy(game_id, environment_id, server_id, override_kill_timeout) Destroy a dynamic server. @@ -55,6 +56,7 @@ Destroy a dynamic server. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **server_id** | **uuid::Uuid** | The id of the server to destroy | [required] | **override_kill_timeout** | Option<**i64**> | 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. | | @@ -76,7 +78,7 @@ Name | Type | Description | Required | Notes ## servers_get -> crate::models::ServersGetServerResponse servers_get(game_id, server_id) +> crate::models::ServersGetServerResponse servers_get(game_id, environment_id, server_id) Gets a dynamic server. @@ -87,6 +89,7 @@ Gets a dynamic server. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **server_id** | **uuid::Uuid** | The id of the server to destroy | [required] | ### Return type @@ -107,7 +110,7 @@ Name | Type | Description | Required | Notes ## servers_list -> crate::models::ServersListServersResponse servers_list(game_id, tags_json, game) +> crate::models::ServersListServersResponse servers_list(game_id, environment_id, tags_json, game) Lists all servers associated with the token used. Can be filtered by tags in the query string. @@ -118,6 +121,7 @@ Lists all servers associated with the token used. Can be filtered by tags in the Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **tags_json** | Option<**String**> | | | **game** | Option<**uuid::Uuid**> | | | diff --git a/sdks/full/rust-cli/docs/ServersBuildsApi.md b/sdks/full/rust-cli/docs/ServersBuildsApi.md index 47701334e8..53c36ddd0a 100644 --- a/sdks/full/rust-cli/docs/ServersBuildsApi.md +++ b/sdks/full/rust-cli/docs/ServersBuildsApi.md @@ -4,17 +4,17 @@ All URIs are relative to *https://api.rivet.gg* Method | HTTP request | Description ------------- | ------------- | ------------- -[**servers_builds_complete_build**](ServersBuildsApi.md#servers_builds_complete_build) | **POST** /games/{game_id}/builds/{build_id}/complete | -[**servers_builds_get_build**](ServersBuildsApi.md#servers_builds_get_build) | **GET** /games/{game_id}/builds/{build_id} | -[**servers_builds_list_builds**](ServersBuildsApi.md#servers_builds_list_builds) | **GET** /games/{game_id}/builds | -[**servers_builds_patch_tags**](ServersBuildsApi.md#servers_builds_patch_tags) | **PATCH** /games/{game_id}/builds/{build_id}/tags | -[**servers_builds_prepare_build**](ServersBuildsApi.md#servers_builds_prepare_build) | **POST** /games/{game_id}/builds/prepare | +[**servers_builds_complete_build**](ServersBuildsApi.md#servers_builds_complete_build) | **POST** /games/{game_id}/environments/{environment_id}/builds/{build_id}/complete | +[**servers_builds_get_build**](ServersBuildsApi.md#servers_builds_get_build) | **GET** /games/{game_id}/environments/{environment_id}/builds/{build_id} | +[**servers_builds_list_builds**](ServersBuildsApi.md#servers_builds_list_builds) | **GET** /games/{game_id}/environments/{environment_id}/builds | +[**servers_builds_patch_tags**](ServersBuildsApi.md#servers_builds_patch_tags) | **PATCH** /games/{game_id}/environments/{environment_id}/builds/{build_id}/tags | +[**servers_builds_prepare_build**](ServersBuildsApi.md#servers_builds_prepare_build) | **POST** /games/{game_id}/environments/{environment_id}/builds/prepare | ## servers_builds_complete_build -> servers_builds_complete_build(game_id, build_id) +> servers_builds_complete_build(game_id, environment_id, build_id) Marks an upload as complete. @@ -25,6 +25,7 @@ Marks an upload as complete. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **build_id** | **uuid::Uuid** | | [required] | ### Return type @@ -45,7 +46,7 @@ Name | Type | Description | Required | Notes ## servers_builds_get_build -> crate::models::ServersGetBuildResponse servers_builds_get_build(game_id, build_id, tags_json, game_id2) +> crate::models::ServersGetBuildResponse servers_builds_get_build(game_id, environment_id, build_id, tags_json, game_id2) Lists all builds of the game associated with the token used. Can be filtered by tags in the query string. @@ -56,6 +57,7 @@ Lists all builds of the game associated with the token used. Can be filtered by Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **build_id** | **uuid::Uuid** | | [required] | **tags_json** | Option<**String**> | | | **game_id2** | Option<**uuid::Uuid**> | | | @@ -78,7 +80,7 @@ Name | Type | Description | Required | Notes ## servers_builds_list_builds -> crate::models::ServersListBuildsResponse servers_builds_list_builds(game_id, tags_json, game_id2) +> crate::models::ServersListBuildsResponse servers_builds_list_builds(game_id, environment_id, tags_json, game_id2) Lists all builds of the game associated with the token used. Can be filtered by tags in the query string. @@ -89,6 +91,7 @@ Lists all builds of the game associated with the token used. Can be filtered by Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **tags_json** | Option<**String**> | | | **game_id2** | Option<**uuid::Uuid**> | | | @@ -110,7 +113,7 @@ Name | Type | Description | Required | Notes ## servers_builds_patch_tags -> serde_json::Value servers_builds_patch_tags(game_id, build_id, servers_patch_build_tags_request) +> serde_json::Value servers_builds_patch_tags(game_id, environment_id, build_id, servers_patch_build_tags_request) ### Parameters @@ -119,6 +122,7 @@ Name | Type | Description | Required | Notes Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **build_id** | **uuid::Uuid** | | [required] | **servers_patch_build_tags_request** | [**ServersPatchBuildTagsRequest**](ServersPatchBuildTagsRequest.md) | | [required] | @@ -140,7 +144,7 @@ Name | Type | Description | Required | Notes ## servers_builds_prepare_build -> crate::models::ServersCreateBuildResponse servers_builds_prepare_build(game_id, servers_create_build_request) +> crate::models::ServersCreateBuildResponse servers_builds_prepare_build(game_id, environment_id, servers_create_build_request) Creates a new game build for the given game. @@ -151,6 +155,7 @@ Creates a new game build for the given game. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **servers_create_build_request** | [**ServersCreateBuildRequest**](ServersCreateBuildRequest.md) | | [required] | ### Return type diff --git a/sdks/full/rust-cli/docs/ServersCreateServerRequest.md b/sdks/full/rust-cli/docs/ServersCreateServerRequest.md index 5c7128b15c..b4fa0646ae 100644 --- a/sdks/full/rust-cli/docs/ServersCreateServerRequest.md +++ b/sdks/full/rust-cli/docs/ServersCreateServerRequest.md @@ -4,15 +4,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**arguments** | Option<**Vec**> | | [optional] **datacenter** | [**uuid::Uuid**](uuid::Uuid.md) | | -**environment** | Option<**::std::collections::HashMap**> | | [optional] -**image** | [**uuid::Uuid**](uuid::Uuid.md) | | -**kill_timeout** | Option<**i64**> | 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. | [optional] +**lifecycle** | Option<[**crate::models::ServersLifecycle**](ServersLifecycle.md)> | | [optional] **network** | [**crate::models::ServersCreateServerNetworkRequest**](ServersCreateServerNetworkRequest.md) | | **resources** | [**crate::models::ServersResources**](ServersResources.md) | | +**runtime** | [**crate::models::ServersCreateServerRuntimeRequest**](ServersCreateServerRuntimeRequest.md) | | **tags** | Option<[**serde_json::Value**](.md)> | | -**webhook_url** | Option<**String**> | A url to send to which events from the server running will be sent | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/sdks/full/rust-cli/docs/ServersCreateServerRuntimeRequest.md b/sdks/full/rust-cli/docs/ServersCreateServerRuntimeRequest.md new file mode 100644 index 0000000000..6221032ad2 --- /dev/null +++ b/sdks/full/rust-cli/docs/ServersCreateServerRuntimeRequest.md @@ -0,0 +1,13 @@ +# ServersCreateServerRuntimeRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arguments** | Option<**Vec**> | | [optional] +**environment** | Option<**::std::collections::HashMap**> | | [optional] +**image** | [**uuid::Uuid**](uuid::Uuid.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/sdks/full/rust-cli/docs/ServersLifecycle.md b/sdks/full/rust-cli/docs/ServersLifecycle.md new file mode 100644 index 0000000000..7f0b0c0a62 --- /dev/null +++ b/sdks/full/rust-cli/docs/ServersLifecycle.md @@ -0,0 +1,11 @@ +# ServersLifecycle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kill_timeout** | Option<**i64**> | 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. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/sdks/full/rust-cli/docs/ServersLogsApi.md b/sdks/full/rust-cli/docs/ServersLogsApi.md index d3c3fd05b8..4598d60a9c 100644 --- a/sdks/full/rust-cli/docs/ServersLogsApi.md +++ b/sdks/full/rust-cli/docs/ServersLogsApi.md @@ -4,13 +4,13 @@ All URIs are relative to *https://api.rivet.gg* Method | HTTP request | Description ------------- | ------------- | ------------- -[**servers_logs_get_server_logs**](ServersLogsApi.md#servers_logs_get_server_logs) | **GET** /games/{game_id}/servers/{server_id}/logs | +[**servers_logs_get_server_logs**](ServersLogsApi.md#servers_logs_get_server_logs) | **GET** /games/{game_id}/environments/{environment_id}/servers/{server_id}/logs | ## servers_logs_get_server_logs -> crate::models::ServersGetServerLogsResponse servers_logs_get_server_logs(game_id, server_id, stream, game, watch_index) +> crate::models::ServersGetServerLogsResponse servers_logs_get_server_logs(game_id, environment_id, server_id, stream, game, watch_index) Returns the logs for a given server. @@ -21,6 +21,7 @@ Returns the logs for a given server. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **server_id** | **uuid::Uuid** | | [required] | **stream** | [**ServersLogStream**](.md) | | [required] | **game** | Option<**uuid::Uuid**> | | | diff --git a/sdks/full/rust-cli/docs/ServersRuntime.md b/sdks/full/rust-cli/docs/ServersRuntime.md new file mode 100644 index 0000000000..b516ad72fd --- /dev/null +++ b/sdks/full/rust-cli/docs/ServersRuntime.md @@ -0,0 +1,13 @@ +# ServersRuntime + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arguments** | Option<**Vec**> | | [optional] +**environment** | Option<**::std::collections::HashMap**> | | [optional] +**image** | [**uuid::Uuid**](uuid::Uuid.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/sdks/full/rust-cli/docs/ServersServer.md b/sdks/full/rust-cli/docs/ServersServer.md index 9318bb1c47..eeeba4fff2 100644 --- a/sdks/full/rust-cli/docs/ServersServer.md +++ b/sdks/full/rust-cli/docs/ServersServer.md @@ -4,18 +4,16 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**arguments** | Option<**Vec**> | | [optional] **cluster** | [**uuid::Uuid**](uuid::Uuid.md) | | **created_at** | **i64** | | **datacenter** | [**uuid::Uuid**](uuid::Uuid.md) | | **destroyed_at** | Option<**i64**> | | [optional] -**environment** | Option<**::std::collections::HashMap**> | | [optional] -**game** | [**uuid::Uuid**](uuid::Uuid.md) | | +**environment** | [**uuid::Uuid**](uuid::Uuid.md) | | **id** | [**uuid::Uuid**](uuid::Uuid.md) | | -**image** | [**uuid::Uuid**](uuid::Uuid.md) | | -**kill_timeout** | Option<**i64**> | 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. | [optional] +**lifecycle** | [**crate::models::ServersLifecycle**](ServersLifecycle.md) | | **network** | [**crate::models::ServersNetwork**](ServersNetwork.md) | | **resources** | [**crate::models::ServersResources**](ServersResources.md) | | +**runtime** | [**crate::models::ServersRuntime**](ServersRuntime.md) | | **started_at** | Option<**i64**> | | [optional] **tags** | Option<[**serde_json::Value**](.md)> | | diff --git a/sdks/full/rust-cli/src/apis/cloud_games_tokens_api.rs b/sdks/full/rust-cli/src/apis/cloud_games_tokens_api.rs index 5541d05823..42318b5460 100644 --- a/sdks/full/rust-cli/src/apis/cloud_games_tokens_api.rs +++ b/sdks/full/rust-cli/src/apis/cloud_games_tokens_api.rs @@ -28,19 +28,6 @@ pub enum CloudGamesTokensCreateCloudTokenError { UnknownValue(serde_json::Value), } -/// struct for typed errors of method [`cloud_games_tokens_create_service_token`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CloudGamesTokensCreateServiceTokenError { - Status400(crate::models::ErrorBody), - Status403(crate::models::ErrorBody), - Status404(crate::models::ErrorBody), - Status408(crate::models::ErrorBody), - Status429(crate::models::ErrorBody), - Status500(crate::models::ErrorBody), - UnknownValue(serde_json::Value), -} - /// Creates a new game cloud token. pub async fn cloud_games_tokens_create_cloud_token(configuration: &configuration::Configuration, game_id: &str) -> Result> { @@ -73,34 +60,3 @@ pub async fn cloud_games_tokens_create_cloud_token(configuration: &configuration } } -/// Creates a new game service token. -pub async fn cloud_games_tokens_create_service_token(configuration: &configuration::Configuration, game_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/cloud/games/{game_id}/tokens/service", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/sdks/full/rust-cli/src/apis/games_environments_tokens_api.rs b/sdks/full/rust-cli/src/apis/games_environments_tokens_api.rs new file mode 100644 index 0000000000..a36af51a32 --- /dev/null +++ b/sdks/full/rust-cli/src/apis/games_environments_tokens_api.rs @@ -0,0 +1,62 @@ +/* + * Rivet API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + + +/// struct for typed errors of method [`games_environments_tokens_create_service_token`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GamesEnvironmentsTokensCreateServiceTokenError { + Status400(crate::models::ErrorBody), + Status403(crate::models::ErrorBody), + Status404(crate::models::ErrorBody), + Status408(crate::models::ErrorBody), + Status429(crate::models::ErrorBody), + Status500(crate::models::ErrorBody), + UnknownValue(serde_json::Value), +} + + +/// Creates a new environment service token. +pub async fn games_environments_tokens_create_service_token(configuration: &configuration::Configuration, game_id: &str, environment_id: &str) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/tokens/service", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { + local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/sdks/full/rust-cli/src/apis/mod.rs b/sdks/full/rust-cli/src/apis/mod.rs index 11b380d655..01e8bb0477 100644 --- a/sdks/full/rust-cli/src/apis/mod.rs +++ b/sdks/full/rust-cli/src/apis/mod.rs @@ -114,6 +114,7 @@ pub mod cloud_groups_api; pub mod cloud_logs_api; pub mod cloud_tiers_api; pub mod cloud_uploads_api; +pub mod games_environments_tokens_api; pub mod group_api; pub mod group_invites_api; pub mod group_join_requests_api; diff --git a/sdks/full/rust-cli/src/apis/servers_api.rs b/sdks/full/rust-cli/src/apis/servers_api.rs index 5b89e415cd..67bc00d2d7 100644 --- a/sdks/full/rust-cli/src/apis/servers_api.rs +++ b/sdks/full/rust-cli/src/apis/servers_api.rs @@ -69,12 +69,12 @@ pub enum ServersListError { /// Create a new dynamic server. -pub async fn servers_create(configuration: &configuration::Configuration, game_id: &str, servers_create_server_request: crate::models::ServersCreateServerRequest) -> Result> { +pub async fn servers_create(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, servers_create_server_request: crate::models::ServersCreateServerRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/servers", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/servers", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { @@ -101,12 +101,12 @@ pub async fn servers_create(configuration: &configuration::Configuration, game_i } /// Destroy a dynamic server. -pub async fn servers_destroy(configuration: &configuration::Configuration, game_id: &str, server_id: &str, override_kill_timeout: Option) -> Result> { +pub async fn servers_destroy(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, server_id: &str, override_kill_timeout: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/servers/{server_id}", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), server_id=crate::apis::urlencode(server_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/servers/{server_id}", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id), server_id=crate::apis::urlencode(server_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_str) = override_kill_timeout { @@ -135,12 +135,12 @@ pub async fn servers_destroy(configuration: &configuration::Configuration, game_ } /// Gets a dynamic server. -pub async fn servers_get(configuration: &configuration::Configuration, game_id: &str, server_id: &str) -> Result> { +pub async fn servers_get(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, server_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/servers/{server_id}", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), server_id=crate::apis::urlencode(server_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/servers/{server_id}", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id), server_id=crate::apis::urlencode(server_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { @@ -166,12 +166,12 @@ pub async fn servers_get(configuration: &configuration::Configuration, game_id: } /// Lists all servers associated with the token used. Can be filtered by tags in the query string. -pub async fn servers_list(configuration: &configuration::Configuration, game_id: &str, tags_json: Option<&str>, game: Option<&str>) -> Result> { +pub async fn servers_list(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, tags_json: Option<&str>, game: Option<&str>) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/servers", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/servers", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = tags_json { diff --git a/sdks/full/rust-cli/src/apis/servers_builds_api.rs b/sdks/full/rust-cli/src/apis/servers_builds_api.rs index 5a9fbcc584..c7f80e50fc 100644 --- a/sdks/full/rust-cli/src/apis/servers_builds_api.rs +++ b/sdks/full/rust-cli/src/apis/servers_builds_api.rs @@ -82,12 +82,12 @@ pub enum ServersBuildsPrepareBuildError { /// Marks an upload as complete. -pub async fn servers_builds_complete_build(configuration: &configuration::Configuration, game_id: &str, build_id: &str) -> Result<(), Error> { +pub async fn servers_builds_complete_build(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, build_id: &str) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/builds/{build_id}/complete", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), build_id=crate::apis::urlencode(build_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/builds/{build_id}/complete", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id), build_id=crate::apis::urlencode(build_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { @@ -113,12 +113,12 @@ pub async fn servers_builds_complete_build(configuration: &configuration::Config } /// Lists all builds of the game associated with the token used. Can be filtered by tags in the query string. -pub async fn servers_builds_get_build(configuration: &configuration::Configuration, game_id: &str, build_id: &str, tags_json: Option<&str>, game_id2: Option<&str>) -> Result> { +pub async fn servers_builds_get_build(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, build_id: &str, tags_json: Option<&str>, game_id2: Option<&str>) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/builds/{build_id}", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), build_id=crate::apis::urlencode(build_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/builds/{build_id}", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id), build_id=crate::apis::urlencode(build_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = tags_json { @@ -150,12 +150,12 @@ pub async fn servers_builds_get_build(configuration: &configuration::Configurati } /// Lists all builds of the game associated with the token used. Can be filtered by tags in the query string. -pub async fn servers_builds_list_builds(configuration: &configuration::Configuration, game_id: &str, tags_json: Option<&str>, game_id2: Option<&str>) -> Result> { +pub async fn servers_builds_list_builds(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, tags_json: Option<&str>, game_id2: Option<&str>) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/builds", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/builds", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = tags_json { @@ -186,12 +186,12 @@ pub async fn servers_builds_list_builds(configuration: &configuration::Configura } } -pub async fn servers_builds_patch_tags(configuration: &configuration::Configuration, game_id: &str, build_id: &str, servers_patch_build_tags_request: crate::models::ServersPatchBuildTagsRequest) -> Result> { +pub async fn servers_builds_patch_tags(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, build_id: &str, servers_patch_build_tags_request: crate::models::ServersPatchBuildTagsRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/builds/{build_id}/tags", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), build_id=crate::apis::urlencode(build_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/builds/{build_id}/tags", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id), build_id=crate::apis::urlencode(build_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { @@ -218,12 +218,12 @@ pub async fn servers_builds_patch_tags(configuration: &configuration::Configurat } /// Creates a new game build for the given game. -pub async fn servers_builds_prepare_build(configuration: &configuration::Configuration, game_id: &str, servers_create_build_request: crate::models::ServersCreateBuildRequest) -> Result> { +pub async fn servers_builds_prepare_build(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, servers_create_build_request: crate::models::ServersCreateBuildRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/builds/prepare", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/builds/prepare", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { diff --git a/sdks/full/rust-cli/src/apis/servers_logs_api.rs b/sdks/full/rust-cli/src/apis/servers_logs_api.rs index fd7c081b17..167a95ce1b 100644 --- a/sdks/full/rust-cli/src/apis/servers_logs_api.rs +++ b/sdks/full/rust-cli/src/apis/servers_logs_api.rs @@ -30,12 +30,12 @@ pub enum ServersLogsGetServerLogsError { /// Returns the logs for a given server. -pub async fn servers_logs_get_server_logs(configuration: &configuration::Configuration, game_id: &str, server_id: &str, stream: crate::models::ServersLogStream, game: Option<&str>, watch_index: Option<&str>) -> Result> { +pub async fn servers_logs_get_server_logs(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, server_id: &str, stream: crate::models::ServersLogStream, game: Option<&str>, watch_index: Option<&str>) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/servers/{server_id}/logs", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), server_id=crate::apis::urlencode(server_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/servers/{server_id}/logs", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id), server_id=crate::apis::urlencode(server_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder.query(&[("stream", &stream.to_string())]); diff --git a/sdks/full/rust-cli/src/models/cloud_games_create_service_token_response.rs b/sdks/full/rust-cli/src/models/games_environments_create_service_token_response.rs similarity index 63% rename from sdks/full/rust-cli/src/models/cloud_games_create_service_token_response.rs rename to sdks/full/rust-cli/src/models/games_environments_create_service_token_response.rs index 7221b71310..fb7f482fce 100644 --- a/sdks/full/rust-cli/src/models/cloud_games_create_service_token_response.rs +++ b/sdks/full/rust-cli/src/models/games_environments_create_service_token_response.rs @@ -12,15 +12,15 @@ #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] -pub struct CloudGamesCreateServiceTokenResponse { +pub struct GamesEnvironmentsCreateServiceTokenResponse { /// A JSON Web Token. #[serde(rename = "token")] pub token: String, } -impl CloudGamesCreateServiceTokenResponse { - pub fn new(token: String) -> CloudGamesCreateServiceTokenResponse { - CloudGamesCreateServiceTokenResponse { +impl GamesEnvironmentsCreateServiceTokenResponse { + pub fn new(token: String) -> GamesEnvironmentsCreateServiceTokenResponse { + GamesEnvironmentsCreateServiceTokenResponse { token, } } diff --git a/sdks/full/rust-cli/src/models/mod.rs b/sdks/full/rust-cli/src/models/mod.rs index cc06ff9f91..9de0d8ad50 100644 --- a/sdks/full/rust-cli/src/models/mod.rs +++ b/sdks/full/rust-cli/src/models/mod.rs @@ -132,8 +132,6 @@ pub mod cloud_games_create_game_version_request; pub use self::cloud_games_create_game_version_request::CloudGamesCreateGameVersionRequest; pub mod cloud_games_create_game_version_response; pub use self::cloud_games_create_game_version_response::CloudGamesCreateGameVersionResponse; -pub mod cloud_games_create_service_token_response; -pub use self::cloud_games_create_service_token_response::CloudGamesCreateServiceTokenResponse; pub mod cloud_games_delete_matchmaker_lobby_response; pub use self::cloud_games_delete_matchmaker_lobby_response::CloudGamesDeleteMatchmakerLobbyResponse; pub mod cloud_games_export_lobby_logs_request; @@ -382,6 +380,8 @@ pub mod game_stat_summary; pub use self::game_stat_summary::GameStatSummary; pub mod game_summary; pub use self::game_summary::GameSummary; +pub mod games_environments_create_service_token_response; +pub use self::games_environments_create_service_token_response::GamesEnvironmentsCreateServiceTokenResponse; pub mod geo_coord; pub use self::geo_coord::GeoCoord; pub mod geo_distance; @@ -624,12 +624,16 @@ pub mod servers_create_server_request; pub use self::servers_create_server_request::ServersCreateServerRequest; pub mod servers_create_server_response; pub use self::servers_create_server_response::ServersCreateServerResponse; +pub mod servers_create_server_runtime_request; +pub use self::servers_create_server_runtime_request::ServersCreateServerRuntimeRequest; pub mod servers_get_build_response; pub use self::servers_get_build_response::ServersGetBuildResponse; pub mod servers_get_server_logs_response; pub use self::servers_get_server_logs_response::ServersGetServerLogsResponse; pub mod servers_get_server_response; pub use self::servers_get_server_response::ServersGetServerResponse; +pub mod servers_lifecycle; +pub use self::servers_lifecycle::ServersLifecycle; pub mod servers_list_builds_response; pub use self::servers_list_builds_response::ServersListBuildsResponse; pub mod servers_list_servers_response; @@ -650,6 +654,8 @@ pub mod servers_port_routing; pub use self::servers_port_routing::ServersPortRouting; pub mod servers_resources; pub use self::servers_resources::ServersResources; +pub mod servers_runtime; +pub use self::servers_runtime::ServersRuntime; pub mod servers_server; pub use self::servers_server::ServersServer; pub mod upload_prepare_file; diff --git a/sdks/full/rust-cli/src/models/servers_create_server_request.rs b/sdks/full/rust-cli/src/models/servers_create_server_request.rs index 7112b716f1..84c0f99936 100644 --- a/sdks/full/rust-cli/src/models/servers_create_server_request.rs +++ b/sdks/full/rust-cli/src/models/servers_create_server_request.rs @@ -13,40 +13,29 @@ #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct ServersCreateServerRequest { - #[serde(rename = "arguments", skip_serializing_if = "Option::is_none")] - pub arguments: Option>, #[serde(rename = "datacenter")] pub datacenter: uuid::Uuid, - #[serde(rename = "environment", skip_serializing_if = "Option::is_none")] - pub environment: Option<::std::collections::HashMap>, - #[serde(rename = "image")] - pub image: uuid::Uuid, - /// 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. - #[serde(rename = "kill_timeout", skip_serializing_if = "Option::is_none")] - pub kill_timeout: Option, + #[serde(rename = "lifecycle", skip_serializing_if = "Option::is_none")] + pub lifecycle: Option>, #[serde(rename = "network")] pub network: Box, #[serde(rename = "resources")] pub resources: Box, + #[serde(rename = "runtime")] + pub runtime: Box, #[serde(rename = "tags", deserialize_with = "Option::deserialize")] pub tags: Option, - /// A url to send to which events from the server running will be sent - #[serde(rename = "webhook_url", skip_serializing_if = "Option::is_none")] - pub webhook_url: Option, } impl ServersCreateServerRequest { - pub fn new(datacenter: uuid::Uuid, image: uuid::Uuid, network: crate::models::ServersCreateServerNetworkRequest, resources: crate::models::ServersResources, tags: Option) -> ServersCreateServerRequest { + pub fn new(datacenter: uuid::Uuid, network: crate::models::ServersCreateServerNetworkRequest, resources: crate::models::ServersResources, runtime: crate::models::ServersCreateServerRuntimeRequest, tags: Option) -> ServersCreateServerRequest { ServersCreateServerRequest { - arguments: None, datacenter, - environment: None, - image, - kill_timeout: None, + lifecycle: None, network: Box::new(network), resources: Box::new(resources), + runtime: Box::new(runtime), tags, - webhook_url: None, } } } diff --git a/sdks/full/rust-cli/src/models/servers_create_server_runtime_request.rs b/sdks/full/rust-cli/src/models/servers_create_server_runtime_request.rs new file mode 100644 index 0000000000..9d96922589 --- /dev/null +++ b/sdks/full/rust-cli/src/models/servers_create_server_runtime_request.rs @@ -0,0 +1,34 @@ +/* + * Rivet API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct ServersCreateServerRuntimeRequest { + #[serde(rename = "arguments", skip_serializing_if = "Option::is_none")] + pub arguments: Option>, + #[serde(rename = "environment", skip_serializing_if = "Option::is_none")] + pub environment: Option<::std::collections::HashMap>, + #[serde(rename = "image")] + pub image: uuid::Uuid, +} + +impl ServersCreateServerRuntimeRequest { + pub fn new(image: uuid::Uuid) -> ServersCreateServerRuntimeRequest { + ServersCreateServerRuntimeRequest { + arguments: None, + environment: None, + image, + } + } +} + + diff --git a/sdks/full/rust-cli/src/models/servers_lifecycle.rs b/sdks/full/rust-cli/src/models/servers_lifecycle.rs new file mode 100644 index 0000000000..47b2074f46 --- /dev/null +++ b/sdks/full/rust-cli/src/models/servers_lifecycle.rs @@ -0,0 +1,29 @@ +/* + * Rivet API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct ServersLifecycle { + /// 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. + #[serde(rename = "kill_timeout", skip_serializing_if = "Option::is_none")] + pub kill_timeout: Option, +} + +impl ServersLifecycle { + pub fn new() -> ServersLifecycle { + ServersLifecycle { + kill_timeout: None, + } + } +} + + diff --git a/sdks/full/rust-cli/src/models/servers_runtime.rs b/sdks/full/rust-cli/src/models/servers_runtime.rs new file mode 100644 index 0000000000..09f44aca56 --- /dev/null +++ b/sdks/full/rust-cli/src/models/servers_runtime.rs @@ -0,0 +1,34 @@ +/* + * Rivet API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct ServersRuntime { + #[serde(rename = "arguments", skip_serializing_if = "Option::is_none")] + pub arguments: Option>, + #[serde(rename = "environment", skip_serializing_if = "Option::is_none")] + pub environment: Option<::std::collections::HashMap>, + #[serde(rename = "image")] + pub image: uuid::Uuid, +} + +impl ServersRuntime { + pub fn new(image: uuid::Uuid) -> ServersRuntime { + ServersRuntime { + arguments: None, + environment: None, + image, + } + } +} + + diff --git a/sdks/full/rust-cli/src/models/servers_server.rs b/sdks/full/rust-cli/src/models/servers_server.rs index 421b0c2530..6f0faf2c77 100644 --- a/sdks/full/rust-cli/src/models/servers_server.rs +++ b/sdks/full/rust-cli/src/models/servers_server.rs @@ -13,8 +13,6 @@ #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct ServersServer { - #[serde(rename = "arguments", skip_serializing_if = "Option::is_none")] - pub arguments: Option>, #[serde(rename = "cluster")] pub cluster: uuid::Uuid, #[serde(rename = "created_at")] @@ -23,21 +21,18 @@ pub struct ServersServer { pub datacenter: uuid::Uuid, #[serde(rename = "destroyed_at", skip_serializing_if = "Option::is_none")] pub destroyed_at: Option, - #[serde(rename = "environment", skip_serializing_if = "Option::is_none")] - pub environment: Option<::std::collections::HashMap>, - #[serde(rename = "game")] - pub game: uuid::Uuid, + #[serde(rename = "environment")] + pub environment: uuid::Uuid, #[serde(rename = "id")] pub id: uuid::Uuid, - #[serde(rename = "image")] - pub image: uuid::Uuid, - /// 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. - #[serde(rename = "kill_timeout", skip_serializing_if = "Option::is_none")] - pub kill_timeout: Option, + #[serde(rename = "lifecycle")] + pub lifecycle: Box, #[serde(rename = "network")] pub network: Box, #[serde(rename = "resources")] pub resources: Box, + #[serde(rename = "runtime")] + pub runtime: Box, #[serde(rename = "started_at", skip_serializing_if = "Option::is_none")] pub started_at: Option, #[serde(rename = "tags", deserialize_with = "Option::deserialize")] @@ -45,20 +40,18 @@ pub struct ServersServer { } impl ServersServer { - pub fn new(cluster: uuid::Uuid, created_at: i64, datacenter: uuid::Uuid, game: uuid::Uuid, id: uuid::Uuid, image: uuid::Uuid, network: crate::models::ServersNetwork, resources: crate::models::ServersResources, tags: Option) -> ServersServer { + pub fn new(cluster: uuid::Uuid, created_at: i64, datacenter: uuid::Uuid, environment: uuid::Uuid, id: uuid::Uuid, lifecycle: crate::models::ServersLifecycle, network: crate::models::ServersNetwork, resources: crate::models::ServersResources, runtime: crate::models::ServersRuntime, tags: Option) -> ServersServer { ServersServer { - arguments: None, cluster, created_at, datacenter, destroyed_at: None, - environment: None, - game, + environment, id, - image, - kill_timeout: None, + lifecycle: Box::new(lifecycle), network: Box::new(network), resources: Box::new(resources), + runtime: Box::new(runtime), started_at: None, tags, } diff --git a/sdks/full/rust/.openapi-generator/FILES b/sdks/full/rust/.openapi-generator/FILES index 41798ccc66..6e22b666de 100644 --- a/sdks/full/rust/.openapi-generator/FILES +++ b/sdks/full/rust/.openapi-generator/FILES @@ -84,7 +84,6 @@ docs/CloudGamesCreateGameRequest.md docs/CloudGamesCreateGameResponse.md docs/CloudGamesCreateGameVersionRequest.md docs/CloudGamesCreateGameVersionResponse.md -docs/CloudGamesCreateServiceTokenResponse.md docs/CloudGamesDeleteMatchmakerLobbyResponse.md docs/CloudGamesExportLobbyLogsRequest.md docs/CloudGamesExportLobbyLogsResponse.md @@ -219,6 +218,8 @@ docs/GameStatFormatMethod.md docs/GameStatSortingMethod.md docs/GameStatSummary.md docs/GameSummary.md +docs/GamesEnvironmentsCreateServiceTokenResponse.md +docs/GamesEnvironmentsTokensApi.md docs/GeoCoord.md docs/GeoDistance.md docs/GlobalEventNotification.md @@ -357,9 +358,11 @@ docs/ServersCreateServerNetworkRequest.md docs/ServersCreateServerPortRequest.md docs/ServersCreateServerRequest.md docs/ServersCreateServerResponse.md +docs/ServersCreateServerRuntimeRequest.md docs/ServersGetBuildResponse.md docs/ServersGetServerLogsResponse.md docs/ServersGetServerResponse.md +docs/ServersLifecycle.md docs/ServersListBuildsResponse.md docs/ServersListServersResponse.md docs/ServersLogStream.md @@ -371,6 +374,7 @@ docs/ServersPort.md docs/ServersPortProtocol.md docs/ServersPortRouting.md docs/ServersResources.md +docs/ServersRuntime.md docs/ServersServer.md docs/UploadPrepareFile.md docs/UploadPresignedRequest.md @@ -402,6 +406,7 @@ src/apis/cloud_logs_api.rs src/apis/cloud_tiers_api.rs src/apis/cloud_uploads_api.rs src/apis/configuration.rs +src/apis/games_environments_tokens_api.rs src/apis/group_api.rs src/apis/group_invites_api.rs src/apis/group_join_requests_api.rs @@ -489,7 +494,6 @@ src/models/cloud_games_create_game_request.rs src/models/cloud_games_create_game_response.rs src/models/cloud_games_create_game_version_request.rs src/models/cloud_games_create_game_version_response.rs -src/models/cloud_games_create_service_token_response.rs src/models/cloud_games_delete_matchmaker_lobby_response.rs src/models/cloud_games_export_lobby_logs_request.rs src/models/cloud_games_export_lobby_logs_response.rs @@ -614,6 +618,7 @@ src/models/game_stat_format_method.rs src/models/game_stat_sorting_method.rs src/models/game_stat_summary.rs src/models/game_summary.rs +src/models/games_environments_create_service_token_response.rs src/models/geo_coord.rs src/models/geo_distance.rs src/models/global_event_notification.rs @@ -736,9 +741,11 @@ src/models/servers_create_server_network_request.rs src/models/servers_create_server_port_request.rs src/models/servers_create_server_request.rs src/models/servers_create_server_response.rs +src/models/servers_create_server_runtime_request.rs src/models/servers_get_build_response.rs src/models/servers_get_server_logs_response.rs src/models/servers_get_server_response.rs +src/models/servers_lifecycle.rs src/models/servers_list_builds_response.rs src/models/servers_list_servers_response.rs src/models/servers_log_stream.rs @@ -749,6 +756,7 @@ src/models/servers_port.rs src/models/servers_port_protocol.rs src/models/servers_port_routing.rs src/models/servers_resources.rs +src/models/servers_runtime.rs src/models/servers_server.rs src/models/upload_prepare_file.rs src/models/upload_presigned_request.rs diff --git a/sdks/full/rust/README.md b/sdks/full/rust/README.md index 6052b89e02..a3710de8a3 100644 --- a/sdks/full/rust/README.md +++ b/sdks/full/rust/README.md @@ -82,7 +82,6 @@ Class | Method | HTTP request | Description *CloudGamesNamespacesLogsApi* | [**cloud_games_namespaces_logs_get_namespace_lobby**](docs/CloudGamesNamespacesLogsApi.md#cloud_games_namespaces_logs_get_namespace_lobby) | **GET** /cloud/games/{game_id}/namespaces/{namespace_id}/logs/lobbies/{lobby_id} | *CloudGamesNamespacesLogsApi* | [**cloud_games_namespaces_logs_list_namespace_lobbies**](docs/CloudGamesNamespacesLogsApi.md#cloud_games_namespaces_logs_list_namespace_lobbies) | **GET** /cloud/games/{game_id}/namespaces/{namespace_id}/logs/lobbies | *CloudGamesTokensApi* | [**cloud_games_tokens_create_cloud_token**](docs/CloudGamesTokensApi.md#cloud_games_tokens_create_cloud_token) | **POST** /cloud/games/{game_id}/tokens/cloud | -*CloudGamesTokensApi* | [**cloud_games_tokens_create_service_token**](docs/CloudGamesTokensApi.md#cloud_games_tokens_create_service_token) | **POST** /cloud/games/{game_id}/tokens/service | *CloudGamesVersionsApi* | [**cloud_games_versions_create_game_version**](docs/CloudGamesVersionsApi.md#cloud_games_versions_create_game_version) | **POST** /cloud/games/{game_id}/versions | *CloudGamesVersionsApi* | [**cloud_games_versions_get_game_version_by_id**](docs/CloudGamesVersionsApi.md#cloud_games_versions_get_game_version_by_id) | **GET** /cloud/games/{game_id}/versions/{version_id} | *CloudGamesVersionsApi* | [**cloud_games_versions_reserve_version_name**](docs/CloudGamesVersionsApi.md#cloud_games_versions_reserve_version_name) | **POST** /cloud/games/{game_id}/versions/reserve-name | @@ -91,6 +90,7 @@ Class | Method | HTTP request | Description *CloudLogsApi* | [**cloud_logs_get_ray_perf_logs**](docs/CloudLogsApi.md#cloud_logs_get_ray_perf_logs) | **GET** /cloud/rays/{ray_id}/perf | *CloudTiersApi* | [**cloud_tiers_get_region_tiers**](docs/CloudTiersApi.md#cloud_tiers_get_region_tiers) | **GET** /cloud/region-tiers | *CloudUploadsApi* | [**cloud_uploads_complete_upload**](docs/CloudUploadsApi.md#cloud_uploads_complete_upload) | **POST** /cloud/uploads/{upload_id}/complete | +*GamesEnvironmentsTokensApi* | [**games_environments_tokens_create_service_token**](docs/GamesEnvironmentsTokensApi.md#games_environments_tokens_create_service_token) | **POST** /games/{game_id}/environments/{environment_id}/tokens/service | *GroupApi* | [**group_ban_identity**](docs/GroupApi.md#group_ban_identity) | **POST** /group/groups/{group_id}/bans/{identity_id} | *GroupApi* | [**group_complete_avatar_upload**](docs/GroupApi.md#group_complete_avatar_upload) | **POST** /group/groups/{group_id}/avatar-upload/{upload_id}/complete | *GroupApi* | [**group_create**](docs/GroupApi.md#group_create) | **POST** /group/groups | @@ -167,16 +167,16 @@ Class | Method | HTTP request | Description *PortalGamesApi* | [**portal_games_get_game_profile**](docs/PortalGamesApi.md#portal_games_get_game_profile) | **GET** /portal/games/{game_name_id}/profile | *ProvisionDatacentersApi* | [**provision_datacenters_get_tls**](docs/ProvisionDatacentersApi.md#provision_datacenters_get_tls) | **GET** /datacenters/{datacenter_id}/tls | *ProvisionServersApi* | [**provision_servers_get_info**](docs/ProvisionServersApi.md#provision_servers_get_info) | **GET** /servers/{ip} | -*ServersApi* | [**servers_create**](docs/ServersApi.md#servers_create) | **POST** /games/{game_id}/servers | -*ServersApi* | [**servers_destroy**](docs/ServersApi.md#servers_destroy) | **DELETE** /games/{game_id}/servers/{server_id} | -*ServersApi* | [**servers_get**](docs/ServersApi.md#servers_get) | **GET** /games/{game_id}/servers/{server_id} | -*ServersApi* | [**servers_list**](docs/ServersApi.md#servers_list) | **GET** /games/{game_id}/servers | -*ServersBuildsApi* | [**servers_builds_complete_build**](docs/ServersBuildsApi.md#servers_builds_complete_build) | **POST** /games/{game_id}/builds/{build_id}/complete | -*ServersBuildsApi* | [**servers_builds_get_build**](docs/ServersBuildsApi.md#servers_builds_get_build) | **GET** /games/{game_id}/builds/{build_id} | -*ServersBuildsApi* | [**servers_builds_list_builds**](docs/ServersBuildsApi.md#servers_builds_list_builds) | **GET** /games/{game_id}/builds | -*ServersBuildsApi* | [**servers_builds_patch_tags**](docs/ServersBuildsApi.md#servers_builds_patch_tags) | **PATCH** /games/{game_id}/builds/{build_id}/tags | -*ServersBuildsApi* | [**servers_builds_prepare_build**](docs/ServersBuildsApi.md#servers_builds_prepare_build) | **POST** /games/{game_id}/builds/prepare | -*ServersLogsApi* | [**servers_logs_get_server_logs**](docs/ServersLogsApi.md#servers_logs_get_server_logs) | **GET** /games/{game_id}/servers/{server_id}/logs | +*ServersApi* | [**servers_create**](docs/ServersApi.md#servers_create) | **POST** /games/{game_id}/environments/{environment_id}/servers | +*ServersApi* | [**servers_destroy**](docs/ServersApi.md#servers_destroy) | **DELETE** /games/{game_id}/environments/{environment_id}/servers/{server_id} | +*ServersApi* | [**servers_get**](docs/ServersApi.md#servers_get) | **GET** /games/{game_id}/environments/{environment_id}/servers/{server_id} | +*ServersApi* | [**servers_list**](docs/ServersApi.md#servers_list) | **GET** /games/{game_id}/environments/{environment_id}/servers | +*ServersBuildsApi* | [**servers_builds_complete_build**](docs/ServersBuildsApi.md#servers_builds_complete_build) | **POST** /games/{game_id}/environments/{environment_id}/builds/{build_id}/complete | +*ServersBuildsApi* | [**servers_builds_get_build**](docs/ServersBuildsApi.md#servers_builds_get_build) | **GET** /games/{game_id}/environments/{environment_id}/builds/{build_id} | +*ServersBuildsApi* | [**servers_builds_list_builds**](docs/ServersBuildsApi.md#servers_builds_list_builds) | **GET** /games/{game_id}/environments/{environment_id}/builds | +*ServersBuildsApi* | [**servers_builds_patch_tags**](docs/ServersBuildsApi.md#servers_builds_patch_tags) | **PATCH** /games/{game_id}/environments/{environment_id}/builds/{build_id}/tags | +*ServersBuildsApi* | [**servers_builds_prepare_build**](docs/ServersBuildsApi.md#servers_builds_prepare_build) | **POST** /games/{game_id}/environments/{environment_id}/builds/prepare | +*ServersLogsApi* | [**servers_logs_get_server_logs**](docs/ServersLogsApi.md#servers_logs_get_server_logs) | **GET** /games/{game_id}/environments/{environment_id}/servers/{server_id}/logs | ## Documentation For Models @@ -248,7 +248,6 @@ Class | Method | HTTP request | Description - [CloudGamesCreateGameResponse](docs/CloudGamesCreateGameResponse.md) - [CloudGamesCreateGameVersionRequest](docs/CloudGamesCreateGameVersionRequest.md) - [CloudGamesCreateGameVersionResponse](docs/CloudGamesCreateGameVersionResponse.md) - - [CloudGamesCreateServiceTokenResponse](docs/CloudGamesCreateServiceTokenResponse.md) - [CloudGamesDeleteMatchmakerLobbyResponse](docs/CloudGamesDeleteMatchmakerLobbyResponse.md) - [CloudGamesExportLobbyLogsRequest](docs/CloudGamesExportLobbyLogsRequest.md) - [CloudGamesExportLobbyLogsResponse](docs/CloudGamesExportLobbyLogsResponse.md) @@ -373,6 +372,7 @@ Class | Method | HTTP request | Description - [GameStatSortingMethod](docs/GameStatSortingMethod.md) - [GameStatSummary](docs/GameStatSummary.md) - [GameSummary](docs/GameSummary.md) + - [GamesEnvironmentsCreateServiceTokenResponse](docs/GamesEnvironmentsCreateServiceTokenResponse.md) - [GeoCoord](docs/GeoCoord.md) - [GeoDistance](docs/GeoDistance.md) - [GlobalEventNotification](docs/GlobalEventNotification.md) @@ -494,9 +494,11 @@ Class | Method | HTTP request | Description - [ServersCreateServerPortRequest](docs/ServersCreateServerPortRequest.md) - [ServersCreateServerRequest](docs/ServersCreateServerRequest.md) - [ServersCreateServerResponse](docs/ServersCreateServerResponse.md) + - [ServersCreateServerRuntimeRequest](docs/ServersCreateServerRuntimeRequest.md) - [ServersGetBuildResponse](docs/ServersGetBuildResponse.md) - [ServersGetServerLogsResponse](docs/ServersGetServerLogsResponse.md) - [ServersGetServerResponse](docs/ServersGetServerResponse.md) + - [ServersLifecycle](docs/ServersLifecycle.md) - [ServersListBuildsResponse](docs/ServersListBuildsResponse.md) - [ServersListServersResponse](docs/ServersListServersResponse.md) - [ServersLogStream](docs/ServersLogStream.md) @@ -507,6 +509,7 @@ Class | Method | HTTP request | Description - [ServersPortProtocol](docs/ServersPortProtocol.md) - [ServersPortRouting](docs/ServersPortRouting.md) - [ServersResources](docs/ServersResources.md) + - [ServersRuntime](docs/ServersRuntime.md) - [ServersServer](docs/ServersServer.md) - [UploadPrepareFile](docs/UploadPrepareFile.md) - [UploadPresignedRequest](docs/UploadPresignedRequest.md) diff --git a/sdks/full/rust/docs/CloudGamesTokensApi.md b/sdks/full/rust/docs/CloudGamesTokensApi.md index 8c64a98652..c0ee6276fc 100644 --- a/sdks/full/rust/docs/CloudGamesTokensApi.md +++ b/sdks/full/rust/docs/CloudGamesTokensApi.md @@ -5,7 +5,6 @@ All URIs are relative to *https://api.rivet.gg* Method | HTTP request | Description ------------- | ------------- | ------------- [**cloud_games_tokens_create_cloud_token**](CloudGamesTokensApi.md#cloud_games_tokens_create_cloud_token) | **POST** /cloud/games/{game_id}/tokens/cloud | -[**cloud_games_tokens_create_service_token**](CloudGamesTokensApi.md#cloud_games_tokens_create_service_token) | **POST** /cloud/games/{game_id}/tokens/service | @@ -38,33 +37,3 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -## cloud_games_tokens_create_service_token - -> crate::models::CloudGamesCreateCloudTokenResponse cloud_games_tokens_create_service_token(game_id) - - -Creates a new game service token. - -### Parameters - - -Name | Type | Description | Required | Notes -------------- | ------------- | ------------- | ------------- | ------------- -**game_id** | **uuid::Uuid** | | [required] | - -### Return type - -[**crate::models::CloudGamesCreateCloudTokenResponse**](CloudGamesCreateCloudTokenResponse.md) - -### Authorization - -[BearerAuth](../README.md#BearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/sdks/full/rust/docs/CloudGamesCreateServiceTokenResponse.md b/sdks/full/rust/docs/GamesEnvironmentsCreateServiceTokenResponse.md similarity index 87% rename from sdks/full/rust/docs/CloudGamesCreateServiceTokenResponse.md rename to sdks/full/rust/docs/GamesEnvironmentsCreateServiceTokenResponse.md index c8d021b0f2..ee3490d4cc 100644 --- a/sdks/full/rust/docs/CloudGamesCreateServiceTokenResponse.md +++ b/sdks/full/rust/docs/GamesEnvironmentsCreateServiceTokenResponse.md @@ -1,4 +1,4 @@ -# CloudGamesCreateServiceTokenResponse +# GamesEnvironmentsCreateServiceTokenResponse ## Properties diff --git a/sdks/full/rust/docs/GamesEnvironmentsTokensApi.md b/sdks/full/rust/docs/GamesEnvironmentsTokensApi.md new file mode 100644 index 0000000000..cead2b98d8 --- /dev/null +++ b/sdks/full/rust/docs/GamesEnvironmentsTokensApi.md @@ -0,0 +1,40 @@ +# \GamesEnvironmentsTokensApi + +All URIs are relative to *https://api.rivet.gg* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**games_environments_tokens_create_service_token**](GamesEnvironmentsTokensApi.md#games_environments_tokens_create_service_token) | **POST** /games/{game_id}/environments/{environment_id}/tokens/service | + + + +## games_environments_tokens_create_service_token + +> crate::models::GamesEnvironmentsCreateServiceTokenResponse games_environments_tokens_create_service_token(game_id, environment_id) + + +Creates a new environment service token. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | + +### Return type + +[**crate::models::GamesEnvironmentsCreateServiceTokenResponse**](GamesEnvironmentsCreateServiceTokenResponse.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/sdks/full/rust/docs/ServersApi.md b/sdks/full/rust/docs/ServersApi.md index f446dd1893..82ee6e30e6 100644 --- a/sdks/full/rust/docs/ServersApi.md +++ b/sdks/full/rust/docs/ServersApi.md @@ -4,16 +4,16 @@ All URIs are relative to *https://api.rivet.gg* Method | HTTP request | Description ------------- | ------------- | ------------- -[**servers_create**](ServersApi.md#servers_create) | **POST** /games/{game_id}/servers | -[**servers_destroy**](ServersApi.md#servers_destroy) | **DELETE** /games/{game_id}/servers/{server_id} | -[**servers_get**](ServersApi.md#servers_get) | **GET** /games/{game_id}/servers/{server_id} | -[**servers_list**](ServersApi.md#servers_list) | **GET** /games/{game_id}/servers | +[**servers_create**](ServersApi.md#servers_create) | **POST** /games/{game_id}/environments/{environment_id}/servers | +[**servers_destroy**](ServersApi.md#servers_destroy) | **DELETE** /games/{game_id}/environments/{environment_id}/servers/{server_id} | +[**servers_get**](ServersApi.md#servers_get) | **GET** /games/{game_id}/environments/{environment_id}/servers/{server_id} | +[**servers_list**](ServersApi.md#servers_list) | **GET** /games/{game_id}/environments/{environment_id}/servers | ## servers_create -> crate::models::ServersCreateServerResponse servers_create(game_id, servers_create_server_request) +> crate::models::ServersCreateServerResponse servers_create(game_id, environment_id, servers_create_server_request) Create a new dynamic server. @@ -24,6 +24,7 @@ Create a new dynamic server. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **servers_create_server_request** | [**ServersCreateServerRequest**](ServersCreateServerRequest.md) | | [required] | ### Return type @@ -44,7 +45,7 @@ Name | Type | Description | Required | Notes ## servers_destroy -> serde_json::Value servers_destroy(game_id, server_id, override_kill_timeout) +> serde_json::Value servers_destroy(game_id, environment_id, server_id, override_kill_timeout) Destroy a dynamic server. @@ -55,6 +56,7 @@ Destroy a dynamic server. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **server_id** | **uuid::Uuid** | The id of the server to destroy | [required] | **override_kill_timeout** | Option<**i64**> | 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. | | @@ -76,7 +78,7 @@ Name | Type | Description | Required | Notes ## servers_get -> crate::models::ServersGetServerResponse servers_get(game_id, server_id) +> crate::models::ServersGetServerResponse servers_get(game_id, environment_id, server_id) Gets a dynamic server. @@ -87,6 +89,7 @@ Gets a dynamic server. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **server_id** | **uuid::Uuid** | The id of the server to destroy | [required] | ### Return type @@ -107,7 +110,7 @@ Name | Type | Description | Required | Notes ## servers_list -> crate::models::ServersListServersResponse servers_list(game_id, tags_json, game) +> crate::models::ServersListServersResponse servers_list(game_id, environment_id, tags_json, game) Lists all servers associated with the token used. Can be filtered by tags in the query string. @@ -118,6 +121,7 @@ Lists all servers associated with the token used. Can be filtered by tags in the Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **tags_json** | Option<**String**> | | | **game** | Option<**uuid::Uuid**> | | | diff --git a/sdks/full/rust/docs/ServersBuildsApi.md b/sdks/full/rust/docs/ServersBuildsApi.md index 47701334e8..53c36ddd0a 100644 --- a/sdks/full/rust/docs/ServersBuildsApi.md +++ b/sdks/full/rust/docs/ServersBuildsApi.md @@ -4,17 +4,17 @@ All URIs are relative to *https://api.rivet.gg* Method | HTTP request | Description ------------- | ------------- | ------------- -[**servers_builds_complete_build**](ServersBuildsApi.md#servers_builds_complete_build) | **POST** /games/{game_id}/builds/{build_id}/complete | -[**servers_builds_get_build**](ServersBuildsApi.md#servers_builds_get_build) | **GET** /games/{game_id}/builds/{build_id} | -[**servers_builds_list_builds**](ServersBuildsApi.md#servers_builds_list_builds) | **GET** /games/{game_id}/builds | -[**servers_builds_patch_tags**](ServersBuildsApi.md#servers_builds_patch_tags) | **PATCH** /games/{game_id}/builds/{build_id}/tags | -[**servers_builds_prepare_build**](ServersBuildsApi.md#servers_builds_prepare_build) | **POST** /games/{game_id}/builds/prepare | +[**servers_builds_complete_build**](ServersBuildsApi.md#servers_builds_complete_build) | **POST** /games/{game_id}/environments/{environment_id}/builds/{build_id}/complete | +[**servers_builds_get_build**](ServersBuildsApi.md#servers_builds_get_build) | **GET** /games/{game_id}/environments/{environment_id}/builds/{build_id} | +[**servers_builds_list_builds**](ServersBuildsApi.md#servers_builds_list_builds) | **GET** /games/{game_id}/environments/{environment_id}/builds | +[**servers_builds_patch_tags**](ServersBuildsApi.md#servers_builds_patch_tags) | **PATCH** /games/{game_id}/environments/{environment_id}/builds/{build_id}/tags | +[**servers_builds_prepare_build**](ServersBuildsApi.md#servers_builds_prepare_build) | **POST** /games/{game_id}/environments/{environment_id}/builds/prepare | ## servers_builds_complete_build -> servers_builds_complete_build(game_id, build_id) +> servers_builds_complete_build(game_id, environment_id, build_id) Marks an upload as complete. @@ -25,6 +25,7 @@ Marks an upload as complete. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **build_id** | **uuid::Uuid** | | [required] | ### Return type @@ -45,7 +46,7 @@ Name | Type | Description | Required | Notes ## servers_builds_get_build -> crate::models::ServersGetBuildResponse servers_builds_get_build(game_id, build_id, tags_json, game_id2) +> crate::models::ServersGetBuildResponse servers_builds_get_build(game_id, environment_id, build_id, tags_json, game_id2) Lists all builds of the game associated with the token used. Can be filtered by tags in the query string. @@ -56,6 +57,7 @@ Lists all builds of the game associated with the token used. Can be filtered by Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **build_id** | **uuid::Uuid** | | [required] | **tags_json** | Option<**String**> | | | **game_id2** | Option<**uuid::Uuid**> | | | @@ -78,7 +80,7 @@ Name | Type | Description | Required | Notes ## servers_builds_list_builds -> crate::models::ServersListBuildsResponse servers_builds_list_builds(game_id, tags_json, game_id2) +> crate::models::ServersListBuildsResponse servers_builds_list_builds(game_id, environment_id, tags_json, game_id2) Lists all builds of the game associated with the token used. Can be filtered by tags in the query string. @@ -89,6 +91,7 @@ Lists all builds of the game associated with the token used. Can be filtered by Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **tags_json** | Option<**String**> | | | **game_id2** | Option<**uuid::Uuid**> | | | @@ -110,7 +113,7 @@ Name | Type | Description | Required | Notes ## servers_builds_patch_tags -> serde_json::Value servers_builds_patch_tags(game_id, build_id, servers_patch_build_tags_request) +> serde_json::Value servers_builds_patch_tags(game_id, environment_id, build_id, servers_patch_build_tags_request) ### Parameters @@ -119,6 +122,7 @@ Name | Type | Description | Required | Notes Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **build_id** | **uuid::Uuid** | | [required] | **servers_patch_build_tags_request** | [**ServersPatchBuildTagsRequest**](ServersPatchBuildTagsRequest.md) | | [required] | @@ -140,7 +144,7 @@ Name | Type | Description | Required | Notes ## servers_builds_prepare_build -> crate::models::ServersCreateBuildResponse servers_builds_prepare_build(game_id, servers_create_build_request) +> crate::models::ServersCreateBuildResponse servers_builds_prepare_build(game_id, environment_id, servers_create_build_request) Creates a new game build for the given game. @@ -151,6 +155,7 @@ Creates a new game build for the given game. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **servers_create_build_request** | [**ServersCreateBuildRequest**](ServersCreateBuildRequest.md) | | [required] | ### Return type diff --git a/sdks/full/rust/docs/ServersCreateServerRequest.md b/sdks/full/rust/docs/ServersCreateServerRequest.md index 5c7128b15c..b4fa0646ae 100644 --- a/sdks/full/rust/docs/ServersCreateServerRequest.md +++ b/sdks/full/rust/docs/ServersCreateServerRequest.md @@ -4,15 +4,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**arguments** | Option<**Vec**> | | [optional] **datacenter** | [**uuid::Uuid**](uuid::Uuid.md) | | -**environment** | Option<**::std::collections::HashMap**> | | [optional] -**image** | [**uuid::Uuid**](uuid::Uuid.md) | | -**kill_timeout** | Option<**i64**> | 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. | [optional] +**lifecycle** | Option<[**crate::models::ServersLifecycle**](ServersLifecycle.md)> | | [optional] **network** | [**crate::models::ServersCreateServerNetworkRequest**](ServersCreateServerNetworkRequest.md) | | **resources** | [**crate::models::ServersResources**](ServersResources.md) | | +**runtime** | [**crate::models::ServersCreateServerRuntimeRequest**](ServersCreateServerRuntimeRequest.md) | | **tags** | Option<[**serde_json::Value**](.md)> | | -**webhook_url** | Option<**String**> | A url to send to which events from the server running will be sent | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/sdks/full/rust/docs/ServersCreateServerRuntimeRequest.md b/sdks/full/rust/docs/ServersCreateServerRuntimeRequest.md new file mode 100644 index 0000000000..6221032ad2 --- /dev/null +++ b/sdks/full/rust/docs/ServersCreateServerRuntimeRequest.md @@ -0,0 +1,13 @@ +# ServersCreateServerRuntimeRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arguments** | Option<**Vec**> | | [optional] +**environment** | Option<**::std::collections::HashMap**> | | [optional] +**image** | [**uuid::Uuid**](uuid::Uuid.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/sdks/full/rust/docs/ServersLifecycle.md b/sdks/full/rust/docs/ServersLifecycle.md new file mode 100644 index 0000000000..7f0b0c0a62 --- /dev/null +++ b/sdks/full/rust/docs/ServersLifecycle.md @@ -0,0 +1,11 @@ +# ServersLifecycle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kill_timeout** | Option<**i64**> | 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. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/sdks/full/rust/docs/ServersLogsApi.md b/sdks/full/rust/docs/ServersLogsApi.md index d3c3fd05b8..4598d60a9c 100644 --- a/sdks/full/rust/docs/ServersLogsApi.md +++ b/sdks/full/rust/docs/ServersLogsApi.md @@ -4,13 +4,13 @@ All URIs are relative to *https://api.rivet.gg* Method | HTTP request | Description ------------- | ------------- | ------------- -[**servers_logs_get_server_logs**](ServersLogsApi.md#servers_logs_get_server_logs) | **GET** /games/{game_id}/servers/{server_id}/logs | +[**servers_logs_get_server_logs**](ServersLogsApi.md#servers_logs_get_server_logs) | **GET** /games/{game_id}/environments/{environment_id}/servers/{server_id}/logs | ## servers_logs_get_server_logs -> crate::models::ServersGetServerLogsResponse servers_logs_get_server_logs(game_id, server_id, stream, game, watch_index) +> crate::models::ServersGetServerLogsResponse servers_logs_get_server_logs(game_id, environment_id, server_id, stream, game, watch_index) Returns the logs for a given server. @@ -21,6 +21,7 @@ Returns the logs for a given server. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **game_id** | **uuid::Uuid** | | [required] | +**environment_id** | **uuid::Uuid** | | [required] | **server_id** | **uuid::Uuid** | | [required] | **stream** | [**ServersLogStream**](.md) | | [required] | **game** | Option<**uuid::Uuid**> | | | diff --git a/sdks/full/rust/docs/ServersRuntime.md b/sdks/full/rust/docs/ServersRuntime.md new file mode 100644 index 0000000000..b516ad72fd --- /dev/null +++ b/sdks/full/rust/docs/ServersRuntime.md @@ -0,0 +1,13 @@ +# ServersRuntime + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arguments** | Option<**Vec**> | | [optional] +**environment** | Option<**::std::collections::HashMap**> | | [optional] +**image** | [**uuid::Uuid**](uuid::Uuid.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/sdks/full/rust/docs/ServersServer.md b/sdks/full/rust/docs/ServersServer.md index 9318bb1c47..eeeba4fff2 100644 --- a/sdks/full/rust/docs/ServersServer.md +++ b/sdks/full/rust/docs/ServersServer.md @@ -4,18 +4,16 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**arguments** | Option<**Vec**> | | [optional] **cluster** | [**uuid::Uuid**](uuid::Uuid.md) | | **created_at** | **i64** | | **datacenter** | [**uuid::Uuid**](uuid::Uuid.md) | | **destroyed_at** | Option<**i64**> | | [optional] -**environment** | Option<**::std::collections::HashMap**> | | [optional] -**game** | [**uuid::Uuid**](uuid::Uuid.md) | | +**environment** | [**uuid::Uuid**](uuid::Uuid.md) | | **id** | [**uuid::Uuid**](uuid::Uuid.md) | | -**image** | [**uuid::Uuid**](uuid::Uuid.md) | | -**kill_timeout** | Option<**i64**> | 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. | [optional] +**lifecycle** | [**crate::models::ServersLifecycle**](ServersLifecycle.md) | | **network** | [**crate::models::ServersNetwork**](ServersNetwork.md) | | **resources** | [**crate::models::ServersResources**](ServersResources.md) | | +**runtime** | [**crate::models::ServersRuntime**](ServersRuntime.md) | | **started_at** | Option<**i64**> | | [optional] **tags** | Option<[**serde_json::Value**](.md)> | | diff --git a/sdks/full/rust/src/apis/cloud_games_tokens_api.rs b/sdks/full/rust/src/apis/cloud_games_tokens_api.rs index 5541d05823..42318b5460 100644 --- a/sdks/full/rust/src/apis/cloud_games_tokens_api.rs +++ b/sdks/full/rust/src/apis/cloud_games_tokens_api.rs @@ -28,19 +28,6 @@ pub enum CloudGamesTokensCreateCloudTokenError { UnknownValue(serde_json::Value), } -/// struct for typed errors of method [`cloud_games_tokens_create_service_token`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CloudGamesTokensCreateServiceTokenError { - Status400(crate::models::ErrorBody), - Status403(crate::models::ErrorBody), - Status404(crate::models::ErrorBody), - Status408(crate::models::ErrorBody), - Status429(crate::models::ErrorBody), - Status500(crate::models::ErrorBody), - UnknownValue(serde_json::Value), -} - /// Creates a new game cloud token. pub async fn cloud_games_tokens_create_cloud_token(configuration: &configuration::Configuration, game_id: &str) -> Result> { @@ -73,34 +60,3 @@ pub async fn cloud_games_tokens_create_cloud_token(configuration: &configuration } } -/// Creates a new game service token. -pub async fn cloud_games_tokens_create_service_token(configuration: &configuration::Configuration, game_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/cloud/games/{game_id}/tokens/service", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/sdks/full/rust/src/apis/games_environments_tokens_api.rs b/sdks/full/rust/src/apis/games_environments_tokens_api.rs new file mode 100644 index 0000000000..a36af51a32 --- /dev/null +++ b/sdks/full/rust/src/apis/games_environments_tokens_api.rs @@ -0,0 +1,62 @@ +/* + * Rivet API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + + +/// struct for typed errors of method [`games_environments_tokens_create_service_token`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GamesEnvironmentsTokensCreateServiceTokenError { + Status400(crate::models::ErrorBody), + Status403(crate::models::ErrorBody), + Status404(crate::models::ErrorBody), + Status408(crate::models::ErrorBody), + Status429(crate::models::ErrorBody), + Status500(crate::models::ErrorBody), + UnknownValue(serde_json::Value), +} + + +/// Creates a new environment service token. +pub async fn games_environments_tokens_create_service_token(configuration: &configuration::Configuration, game_id: &str, environment_id: &str) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/tokens/service", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { + local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/sdks/full/rust/src/apis/mod.rs b/sdks/full/rust/src/apis/mod.rs index 11b380d655..01e8bb0477 100644 --- a/sdks/full/rust/src/apis/mod.rs +++ b/sdks/full/rust/src/apis/mod.rs @@ -114,6 +114,7 @@ pub mod cloud_groups_api; pub mod cloud_logs_api; pub mod cloud_tiers_api; pub mod cloud_uploads_api; +pub mod games_environments_tokens_api; pub mod group_api; pub mod group_invites_api; pub mod group_join_requests_api; diff --git a/sdks/full/rust/src/apis/servers_api.rs b/sdks/full/rust/src/apis/servers_api.rs index 5b89e415cd..67bc00d2d7 100644 --- a/sdks/full/rust/src/apis/servers_api.rs +++ b/sdks/full/rust/src/apis/servers_api.rs @@ -69,12 +69,12 @@ pub enum ServersListError { /// Create a new dynamic server. -pub async fn servers_create(configuration: &configuration::Configuration, game_id: &str, servers_create_server_request: crate::models::ServersCreateServerRequest) -> Result> { +pub async fn servers_create(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, servers_create_server_request: crate::models::ServersCreateServerRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/servers", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/servers", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { @@ -101,12 +101,12 @@ pub async fn servers_create(configuration: &configuration::Configuration, game_i } /// Destroy a dynamic server. -pub async fn servers_destroy(configuration: &configuration::Configuration, game_id: &str, server_id: &str, override_kill_timeout: Option) -> Result> { +pub async fn servers_destroy(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, server_id: &str, override_kill_timeout: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/servers/{server_id}", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), server_id=crate::apis::urlencode(server_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/servers/{server_id}", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id), server_id=crate::apis::urlencode(server_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_str) = override_kill_timeout { @@ -135,12 +135,12 @@ pub async fn servers_destroy(configuration: &configuration::Configuration, game_ } /// Gets a dynamic server. -pub async fn servers_get(configuration: &configuration::Configuration, game_id: &str, server_id: &str) -> Result> { +pub async fn servers_get(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, server_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/servers/{server_id}", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), server_id=crate::apis::urlencode(server_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/servers/{server_id}", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id), server_id=crate::apis::urlencode(server_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { @@ -166,12 +166,12 @@ pub async fn servers_get(configuration: &configuration::Configuration, game_id: } /// Lists all servers associated with the token used. Can be filtered by tags in the query string. -pub async fn servers_list(configuration: &configuration::Configuration, game_id: &str, tags_json: Option<&str>, game: Option<&str>) -> Result> { +pub async fn servers_list(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, tags_json: Option<&str>, game: Option<&str>) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/servers", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/servers", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = tags_json { diff --git a/sdks/full/rust/src/apis/servers_builds_api.rs b/sdks/full/rust/src/apis/servers_builds_api.rs index 5a9fbcc584..c7f80e50fc 100644 --- a/sdks/full/rust/src/apis/servers_builds_api.rs +++ b/sdks/full/rust/src/apis/servers_builds_api.rs @@ -82,12 +82,12 @@ pub enum ServersBuildsPrepareBuildError { /// Marks an upload as complete. -pub async fn servers_builds_complete_build(configuration: &configuration::Configuration, game_id: &str, build_id: &str) -> Result<(), Error> { +pub async fn servers_builds_complete_build(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, build_id: &str) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/builds/{build_id}/complete", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), build_id=crate::apis::urlencode(build_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/builds/{build_id}/complete", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id), build_id=crate::apis::urlencode(build_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { @@ -113,12 +113,12 @@ pub async fn servers_builds_complete_build(configuration: &configuration::Config } /// Lists all builds of the game associated with the token used. Can be filtered by tags in the query string. -pub async fn servers_builds_get_build(configuration: &configuration::Configuration, game_id: &str, build_id: &str, tags_json: Option<&str>, game_id2: Option<&str>) -> Result> { +pub async fn servers_builds_get_build(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, build_id: &str, tags_json: Option<&str>, game_id2: Option<&str>) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/builds/{build_id}", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), build_id=crate::apis::urlencode(build_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/builds/{build_id}", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id), build_id=crate::apis::urlencode(build_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = tags_json { @@ -150,12 +150,12 @@ pub async fn servers_builds_get_build(configuration: &configuration::Configurati } /// Lists all builds of the game associated with the token used. Can be filtered by tags in the query string. -pub async fn servers_builds_list_builds(configuration: &configuration::Configuration, game_id: &str, tags_json: Option<&str>, game_id2: Option<&str>) -> Result> { +pub async fn servers_builds_list_builds(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, tags_json: Option<&str>, game_id2: Option<&str>) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/builds", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/builds", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = tags_json { @@ -186,12 +186,12 @@ pub async fn servers_builds_list_builds(configuration: &configuration::Configura } } -pub async fn servers_builds_patch_tags(configuration: &configuration::Configuration, game_id: &str, build_id: &str, servers_patch_build_tags_request: crate::models::ServersPatchBuildTagsRequest) -> Result> { +pub async fn servers_builds_patch_tags(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, build_id: &str, servers_patch_build_tags_request: crate::models::ServersPatchBuildTagsRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/builds/{build_id}/tags", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), build_id=crate::apis::urlencode(build_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/builds/{build_id}/tags", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id), build_id=crate::apis::urlencode(build_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { @@ -218,12 +218,12 @@ pub async fn servers_builds_patch_tags(configuration: &configuration::Configurat } /// Creates a new game build for the given game. -pub async fn servers_builds_prepare_build(configuration: &configuration::Configuration, game_id: &str, servers_create_build_request: crate::models::ServersCreateBuildRequest) -> Result> { +pub async fn servers_builds_prepare_build(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, servers_create_build_request: crate::models::ServersCreateBuildRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/builds/prepare", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/builds/prepare", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { diff --git a/sdks/full/rust/src/apis/servers_logs_api.rs b/sdks/full/rust/src/apis/servers_logs_api.rs index fd7c081b17..167a95ce1b 100644 --- a/sdks/full/rust/src/apis/servers_logs_api.rs +++ b/sdks/full/rust/src/apis/servers_logs_api.rs @@ -30,12 +30,12 @@ pub enum ServersLogsGetServerLogsError { /// Returns the logs for a given server. -pub async fn servers_logs_get_server_logs(configuration: &configuration::Configuration, game_id: &str, server_id: &str, stream: crate::models::ServersLogStream, game: Option<&str>, watch_index: Option<&str>) -> Result> { +pub async fn servers_logs_get_server_logs(configuration: &configuration::Configuration, game_id: &str, environment_id: &str, server_id: &str, stream: crate::models::ServersLogStream, game: Option<&str>, watch_index: Option<&str>) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/games/{game_id}/servers/{server_id}/logs", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), server_id=crate::apis::urlencode(server_id)); + let local_var_uri_str = format!("{}/games/{game_id}/environments/{environment_id}/servers/{server_id}/logs", local_var_configuration.base_path, game_id=crate::apis::urlencode(game_id), environment_id=crate::apis::urlencode(environment_id), server_id=crate::apis::urlencode(server_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder.query(&[("stream", &stream.to_string())]); diff --git a/sdks/full/rust/src/models/cloud_games_create_service_token_response.rs b/sdks/full/rust/src/models/games_environments_create_service_token_response.rs similarity index 63% rename from sdks/full/rust/src/models/cloud_games_create_service_token_response.rs rename to sdks/full/rust/src/models/games_environments_create_service_token_response.rs index 7221b71310..fb7f482fce 100644 --- a/sdks/full/rust/src/models/cloud_games_create_service_token_response.rs +++ b/sdks/full/rust/src/models/games_environments_create_service_token_response.rs @@ -12,15 +12,15 @@ #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] -pub struct CloudGamesCreateServiceTokenResponse { +pub struct GamesEnvironmentsCreateServiceTokenResponse { /// A JSON Web Token. #[serde(rename = "token")] pub token: String, } -impl CloudGamesCreateServiceTokenResponse { - pub fn new(token: String) -> CloudGamesCreateServiceTokenResponse { - CloudGamesCreateServiceTokenResponse { +impl GamesEnvironmentsCreateServiceTokenResponse { + pub fn new(token: String) -> GamesEnvironmentsCreateServiceTokenResponse { + GamesEnvironmentsCreateServiceTokenResponse { token, } } diff --git a/sdks/full/rust/src/models/mod.rs b/sdks/full/rust/src/models/mod.rs index cc06ff9f91..9de0d8ad50 100644 --- a/sdks/full/rust/src/models/mod.rs +++ b/sdks/full/rust/src/models/mod.rs @@ -132,8 +132,6 @@ pub mod cloud_games_create_game_version_request; pub use self::cloud_games_create_game_version_request::CloudGamesCreateGameVersionRequest; pub mod cloud_games_create_game_version_response; pub use self::cloud_games_create_game_version_response::CloudGamesCreateGameVersionResponse; -pub mod cloud_games_create_service_token_response; -pub use self::cloud_games_create_service_token_response::CloudGamesCreateServiceTokenResponse; pub mod cloud_games_delete_matchmaker_lobby_response; pub use self::cloud_games_delete_matchmaker_lobby_response::CloudGamesDeleteMatchmakerLobbyResponse; pub mod cloud_games_export_lobby_logs_request; @@ -382,6 +380,8 @@ pub mod game_stat_summary; pub use self::game_stat_summary::GameStatSummary; pub mod game_summary; pub use self::game_summary::GameSummary; +pub mod games_environments_create_service_token_response; +pub use self::games_environments_create_service_token_response::GamesEnvironmentsCreateServiceTokenResponse; pub mod geo_coord; pub use self::geo_coord::GeoCoord; pub mod geo_distance; @@ -624,12 +624,16 @@ pub mod servers_create_server_request; pub use self::servers_create_server_request::ServersCreateServerRequest; pub mod servers_create_server_response; pub use self::servers_create_server_response::ServersCreateServerResponse; +pub mod servers_create_server_runtime_request; +pub use self::servers_create_server_runtime_request::ServersCreateServerRuntimeRequest; pub mod servers_get_build_response; pub use self::servers_get_build_response::ServersGetBuildResponse; pub mod servers_get_server_logs_response; pub use self::servers_get_server_logs_response::ServersGetServerLogsResponse; pub mod servers_get_server_response; pub use self::servers_get_server_response::ServersGetServerResponse; +pub mod servers_lifecycle; +pub use self::servers_lifecycle::ServersLifecycle; pub mod servers_list_builds_response; pub use self::servers_list_builds_response::ServersListBuildsResponse; pub mod servers_list_servers_response; @@ -650,6 +654,8 @@ pub mod servers_port_routing; pub use self::servers_port_routing::ServersPortRouting; pub mod servers_resources; pub use self::servers_resources::ServersResources; +pub mod servers_runtime; +pub use self::servers_runtime::ServersRuntime; pub mod servers_server; pub use self::servers_server::ServersServer; pub mod upload_prepare_file; diff --git a/sdks/full/rust/src/models/servers_create_server_request.rs b/sdks/full/rust/src/models/servers_create_server_request.rs index 7112b716f1..84c0f99936 100644 --- a/sdks/full/rust/src/models/servers_create_server_request.rs +++ b/sdks/full/rust/src/models/servers_create_server_request.rs @@ -13,40 +13,29 @@ #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct ServersCreateServerRequest { - #[serde(rename = "arguments", skip_serializing_if = "Option::is_none")] - pub arguments: Option>, #[serde(rename = "datacenter")] pub datacenter: uuid::Uuid, - #[serde(rename = "environment", skip_serializing_if = "Option::is_none")] - pub environment: Option<::std::collections::HashMap>, - #[serde(rename = "image")] - pub image: uuid::Uuid, - /// 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. - #[serde(rename = "kill_timeout", skip_serializing_if = "Option::is_none")] - pub kill_timeout: Option, + #[serde(rename = "lifecycle", skip_serializing_if = "Option::is_none")] + pub lifecycle: Option>, #[serde(rename = "network")] pub network: Box, #[serde(rename = "resources")] pub resources: Box, + #[serde(rename = "runtime")] + pub runtime: Box, #[serde(rename = "tags", deserialize_with = "Option::deserialize")] pub tags: Option, - /// A url to send to which events from the server running will be sent - #[serde(rename = "webhook_url", skip_serializing_if = "Option::is_none")] - pub webhook_url: Option, } impl ServersCreateServerRequest { - pub fn new(datacenter: uuid::Uuid, image: uuid::Uuid, network: crate::models::ServersCreateServerNetworkRequest, resources: crate::models::ServersResources, tags: Option) -> ServersCreateServerRequest { + pub fn new(datacenter: uuid::Uuid, network: crate::models::ServersCreateServerNetworkRequest, resources: crate::models::ServersResources, runtime: crate::models::ServersCreateServerRuntimeRequest, tags: Option) -> ServersCreateServerRequest { ServersCreateServerRequest { - arguments: None, datacenter, - environment: None, - image, - kill_timeout: None, + lifecycle: None, network: Box::new(network), resources: Box::new(resources), + runtime: Box::new(runtime), tags, - webhook_url: None, } } } diff --git a/sdks/full/rust/src/models/servers_create_server_runtime_request.rs b/sdks/full/rust/src/models/servers_create_server_runtime_request.rs new file mode 100644 index 0000000000..9d96922589 --- /dev/null +++ b/sdks/full/rust/src/models/servers_create_server_runtime_request.rs @@ -0,0 +1,34 @@ +/* + * Rivet API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct ServersCreateServerRuntimeRequest { + #[serde(rename = "arguments", skip_serializing_if = "Option::is_none")] + pub arguments: Option>, + #[serde(rename = "environment", skip_serializing_if = "Option::is_none")] + pub environment: Option<::std::collections::HashMap>, + #[serde(rename = "image")] + pub image: uuid::Uuid, +} + +impl ServersCreateServerRuntimeRequest { + pub fn new(image: uuid::Uuid) -> ServersCreateServerRuntimeRequest { + ServersCreateServerRuntimeRequest { + arguments: None, + environment: None, + image, + } + } +} + + diff --git a/sdks/full/rust/src/models/servers_lifecycle.rs b/sdks/full/rust/src/models/servers_lifecycle.rs new file mode 100644 index 0000000000..47b2074f46 --- /dev/null +++ b/sdks/full/rust/src/models/servers_lifecycle.rs @@ -0,0 +1,29 @@ +/* + * Rivet API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct ServersLifecycle { + /// 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. + #[serde(rename = "kill_timeout", skip_serializing_if = "Option::is_none")] + pub kill_timeout: Option, +} + +impl ServersLifecycle { + pub fn new() -> ServersLifecycle { + ServersLifecycle { + kill_timeout: None, + } + } +} + + diff --git a/sdks/full/rust/src/models/servers_runtime.rs b/sdks/full/rust/src/models/servers_runtime.rs new file mode 100644 index 0000000000..09f44aca56 --- /dev/null +++ b/sdks/full/rust/src/models/servers_runtime.rs @@ -0,0 +1,34 @@ +/* + * Rivet API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct ServersRuntime { + #[serde(rename = "arguments", skip_serializing_if = "Option::is_none")] + pub arguments: Option>, + #[serde(rename = "environment", skip_serializing_if = "Option::is_none")] + pub environment: Option<::std::collections::HashMap>, + #[serde(rename = "image")] + pub image: uuid::Uuid, +} + +impl ServersRuntime { + pub fn new(image: uuid::Uuid) -> ServersRuntime { + ServersRuntime { + arguments: None, + environment: None, + image, + } + } +} + + diff --git a/sdks/full/rust/src/models/servers_server.rs b/sdks/full/rust/src/models/servers_server.rs index 421b0c2530..6f0faf2c77 100644 --- a/sdks/full/rust/src/models/servers_server.rs +++ b/sdks/full/rust/src/models/servers_server.rs @@ -13,8 +13,6 @@ #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct ServersServer { - #[serde(rename = "arguments", skip_serializing_if = "Option::is_none")] - pub arguments: Option>, #[serde(rename = "cluster")] pub cluster: uuid::Uuid, #[serde(rename = "created_at")] @@ -23,21 +21,18 @@ pub struct ServersServer { pub datacenter: uuid::Uuid, #[serde(rename = "destroyed_at", skip_serializing_if = "Option::is_none")] pub destroyed_at: Option, - #[serde(rename = "environment", skip_serializing_if = "Option::is_none")] - pub environment: Option<::std::collections::HashMap>, - #[serde(rename = "game")] - pub game: uuid::Uuid, + #[serde(rename = "environment")] + pub environment: uuid::Uuid, #[serde(rename = "id")] pub id: uuid::Uuid, - #[serde(rename = "image")] - pub image: uuid::Uuid, - /// 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. - #[serde(rename = "kill_timeout", skip_serializing_if = "Option::is_none")] - pub kill_timeout: Option, + #[serde(rename = "lifecycle")] + pub lifecycle: Box, #[serde(rename = "network")] pub network: Box, #[serde(rename = "resources")] pub resources: Box, + #[serde(rename = "runtime")] + pub runtime: Box, #[serde(rename = "started_at", skip_serializing_if = "Option::is_none")] pub started_at: Option, #[serde(rename = "tags", deserialize_with = "Option::deserialize")] @@ -45,20 +40,18 @@ pub struct ServersServer { } impl ServersServer { - pub fn new(cluster: uuid::Uuid, created_at: i64, datacenter: uuid::Uuid, game: uuid::Uuid, id: uuid::Uuid, image: uuid::Uuid, network: crate::models::ServersNetwork, resources: crate::models::ServersResources, tags: Option) -> ServersServer { + pub fn new(cluster: uuid::Uuid, created_at: i64, datacenter: uuid::Uuid, environment: uuid::Uuid, id: uuid::Uuid, lifecycle: crate::models::ServersLifecycle, network: crate::models::ServersNetwork, resources: crate::models::ServersResources, runtime: crate::models::ServersRuntime, tags: Option) -> ServersServer { ServersServer { - arguments: None, cluster, created_at, datacenter, destroyed_at: None, - environment: None, - game, + environment, id, - image, - kill_timeout: None, + lifecycle: Box::new(lifecycle), network: Box::new(network), resources: Box::new(resources), + runtime: Box::new(runtime), started_at: None, tags, } diff --git a/sdks/full/typescript/archive.tgz b/sdks/full/typescript/archive.tgz index c38867344c..ddc97887d6 100644 --- a/sdks/full/typescript/archive.tgz +++ b/sdks/full/typescript/archive.tgz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:22e35eaf05ecd0072588f05b430e7f879cfb9496e9ee8d0c6f0f61be9c493aab -size 545988 +oid sha256:e7ea6c6dd1b58b2b43be0751c1d0babed09d08221d655cc82819678af1bfb41f +size 547915 diff --git a/sdks/full/typescript/src/Client.ts b/sdks/full/typescript/src/Client.ts index a4df62420e..052751b86d 100644 --- a/sdks/full/typescript/src/Client.ts +++ b/sdks/full/typescript/src/Client.ts @@ -12,6 +12,7 @@ import { Kv } from "./api/resources/kv/client/Client"; import { Provision } from "./api/resources/provision/client/Client"; import { Servers } from "./api/resources/servers/client/Client"; import { Auth } from "./api/resources/auth/client/Client"; +import { Games } from "./api/resources/games/client/Client"; import { Job } from "./api/resources/job/client/Client"; import { Matchmaker } from "./api/resources/matchmaker/client/Client"; import { Portal } from "./api/resources/portal/client/Client"; @@ -84,6 +85,12 @@ export class RivetClient { return (this._auth ??= new Auth(this._options)); } + protected _games: Games | undefined; + + public get games(): Games { + return (this._games ??= new Games(this._options)); + } + protected _job: Job | undefined; public get job(): Job { diff --git a/sdks/full/typescript/src/api/resources/cloud/resources/games/resources/tokens/client/Client.ts b/sdks/full/typescript/src/api/resources/cloud/resources/games/resources/tokens/client/Client.ts index f53a7f0e97..3bda5d5aa0 100644 --- a/sdks/full/typescript/src/api/resources/cloud/resources/games/resources/tokens/client/Client.ts +++ b/sdks/full/typescript/src/api/resources/cloud/resources/games/resources/tokens/client/Client.ts @@ -159,136 +159,6 @@ export class Tokens { } } - /** - * Creates a new game service token. - * - * @param {string} gameId - * @param {Tokens.RequestOptions} requestOptions - Request-specific configuration. - * - * @throws {@link Rivet.InternalError} - * @throws {@link Rivet.RateLimitError} - * @throws {@link Rivet.ForbiddenError} - * @throws {@link Rivet.UnauthorizedError} - * @throws {@link Rivet.NotFoundError} - * @throws {@link Rivet.BadRequestError} - * - * @example - * await client.cloud.games.tokens.createServiceToken("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32") - */ - public async createServiceToken( - gameId: string, - requestOptions?: Tokens.RequestOptions - ): Promise { - const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.RivetEnvironment.Production, - `/cloud/games/${encodeURIComponent(gameId)}/tokens/service` - ), - method: "POST", - headers: { - Authorization: await this._getAuthorizationHeader(), - }, - contentType: "application/json", - requestType: "json", - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 180000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return serializers.cloud.games.CreateCloudTokenResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); - } - - if (_response.error.reason === "status-code") { - switch (_response.error.statusCode) { - case 500: - throw new Rivet.InternalError( - serializers.ErrorBody.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 429: - throw new Rivet.RateLimitError( - serializers.ErrorBody.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 403: - throw new Rivet.ForbiddenError( - serializers.ErrorBody.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 408: - throw new Rivet.UnauthorizedError( - serializers.ErrorBody.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 404: - throw new Rivet.NotFoundError( - serializers.ErrorBody.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 400: - throw new Rivet.BadRequestError( - serializers.ErrorBody.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - default: - throw new errors.RivetError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - } - - switch (_response.error.reason) { - case "non-json": - throw new errors.RivetError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - }); - case "timeout": - throw new errors.RivetTimeoutError(); - case "unknown": - throw new errors.RivetError({ - message: _response.error.errorMessage, - }); - } - } - protected async _getAuthorizationHeader(): Promise { const bearer = await core.Supplier.get(this._options.token); if (bearer != null) { diff --git a/sdks/full/typescript/src/api/resources/cloud/resources/games/resources/tokens/types/index.ts b/sdks/full/typescript/src/api/resources/cloud/resources/games/resources/tokens/types/index.ts index 3f81f48699..c6eb67fbbe 100644 --- a/sdks/full/typescript/src/api/resources/cloud/resources/games/resources/tokens/types/index.ts +++ b/sdks/full/typescript/src/api/resources/cloud/resources/games/resources/tokens/types/index.ts @@ -1,2 +1 @@ export * from "./CreateCloudTokenResponse"; -export * from "./CreateServiceTokenResponse"; diff --git a/sdks/full/typescript/src/api/resources/games/client/Client.ts b/sdks/full/typescript/src/api/resources/games/client/Client.ts new file mode 100644 index 0000000000..980768de9b --- /dev/null +++ b/sdks/full/typescript/src/api/resources/games/client/Client.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import { Environments } from "../resources/environments/client/Client"; + +export declare namespace Games { + interface Options { + environment?: core.Supplier; + token?: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + } +} + +export class Games { + constructor(protected readonly _options: Games.Options = {}) {} + + protected _environments: Environments | undefined; + + public get environments(): Environments { + return (this._environments ??= new Environments(this._options)); + } +} diff --git a/sdks/full/typescript/src/api/resources/games/client/index.ts b/sdks/full/typescript/src/api/resources/games/client/index.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/sdks/full/typescript/src/api/resources/games/client/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/sdks/full/typescript/src/api/resources/games/index.ts b/sdks/full/typescript/src/api/resources/games/index.ts new file mode 100644 index 0000000000..4ce0f39077 --- /dev/null +++ b/sdks/full/typescript/src/api/resources/games/index.ts @@ -0,0 +1,2 @@ +export * from "./resources"; +export * from "./client"; diff --git a/sdks/full/typescript/src/api/resources/games/resources/environments/client/Client.ts b/sdks/full/typescript/src/api/resources/games/resources/environments/client/Client.ts new file mode 100644 index 0000000000..c84751626e --- /dev/null +++ b/sdks/full/typescript/src/api/resources/games/resources/environments/client/Client.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import { Tokens } from "../resources/tokens/client/Client"; + +export declare namespace Environments { + interface Options { + environment?: core.Supplier; + token?: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + } +} + +export class Environments { + constructor(protected readonly _options: Environments.Options = {}) {} + + protected _tokens: Tokens | undefined; + + public get tokens(): Tokens { + return (this._tokens ??= new Tokens(this._options)); + } +} diff --git a/sdks/full/typescript/src/api/resources/games/resources/environments/client/index.ts b/sdks/full/typescript/src/api/resources/games/resources/environments/client/index.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/sdks/full/typescript/src/api/resources/games/resources/environments/client/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/sdks/full/typescript/src/api/resources/games/resources/environments/index.ts b/sdks/full/typescript/src/api/resources/games/resources/environments/index.ts new file mode 100644 index 0000000000..4ce0f39077 --- /dev/null +++ b/sdks/full/typescript/src/api/resources/games/resources/environments/index.ts @@ -0,0 +1,2 @@ +export * from "./resources"; +export * from "./client"; diff --git a/sdks/full/typescript/src/api/resources/games/resources/environments/resources/index.ts b/sdks/full/typescript/src/api/resources/games/resources/environments/resources/index.ts new file mode 100644 index 0000000000..57df7482c7 --- /dev/null +++ b/sdks/full/typescript/src/api/resources/games/resources/environments/resources/index.ts @@ -0,0 +1,2 @@ +export * as tokens from "./tokens"; +export * from "./tokens/types"; diff --git a/sdks/full/typescript/src/api/resources/games/resources/environments/resources/tokens/client/Client.ts b/sdks/full/typescript/src/api/resources/games/resources/environments/resources/tokens/client/Client.ts new file mode 100644 index 0000000000..659d96aec9 --- /dev/null +++ b/sdks/full/typescript/src/api/resources/games/resources/environments/resources/tokens/client/Client.ts @@ -0,0 +1,172 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../../../environments"; +import * as core from "../../../../../../../../core"; +import * as Rivet from "../../../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../../../serialization/index"; +import * as errors from "../../../../../../../../errors/index"; + +export declare namespace Tokens { + interface Options { + environment?: core.Supplier; + token?: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + } +} + +export class Tokens { + constructor(protected readonly _options: Tokens.Options = {}) {} + + /** + * Creates a new environment service token. + * + * @param {string} gameId + * @param {string} environmentId + * @param {Tokens.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Rivet.InternalError} + * @throws {@link Rivet.RateLimitError} + * @throws {@link Rivet.ForbiddenError} + * @throws {@link Rivet.UnauthorizedError} + * @throws {@link Rivet.NotFoundError} + * @throws {@link Rivet.BadRequestError} + * + * @example + * await client.games.environments.tokens.createServiceToken("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32") + */ + public async createServiceToken( + gameId: string, + environmentId: string, + requestOptions?: Tokens.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.RivetEnvironment.Production, + `/games/${encodeURIComponent(gameId)}/environments/${encodeURIComponent(environmentId)}/tokens/service` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 180000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.games.environments.CreateServiceTokenResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 500: + throw new Rivet.InternalError( + serializers.ErrorBody.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 429: + throw new Rivet.RateLimitError( + serializers.ErrorBody.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 403: + throw new Rivet.ForbiddenError( + serializers.ErrorBody.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 408: + throw new Rivet.UnauthorizedError( + serializers.ErrorBody.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 404: + throw new Rivet.NotFoundError( + serializers.ErrorBody.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 400: + throw new Rivet.BadRequestError( + serializers.ErrorBody.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.RivetError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.RivetError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.RivetTimeoutError(); + case "unknown": + throw new errors.RivetError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = await core.Supplier.get(this._options.token); + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/sdks/full/typescript/src/api/resources/games/resources/environments/resources/tokens/client/index.ts b/sdks/full/typescript/src/api/resources/games/resources/environments/resources/tokens/client/index.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/sdks/full/typescript/src/api/resources/games/resources/environments/resources/tokens/client/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/sdks/full/typescript/src/api/resources/games/resources/environments/resources/tokens/index.ts b/sdks/full/typescript/src/api/resources/games/resources/environments/resources/tokens/index.ts new file mode 100644 index 0000000000..c9240f83b4 --- /dev/null +++ b/sdks/full/typescript/src/api/resources/games/resources/environments/resources/tokens/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/sdks/full/typescript/src/api/resources/games/resources/index.ts b/sdks/full/typescript/src/api/resources/games/resources/index.ts new file mode 100644 index 0000000000..edb1d83107 --- /dev/null +++ b/sdks/full/typescript/src/api/resources/games/resources/index.ts @@ -0,0 +1 @@ +export * as environments from "./environments"; diff --git a/sdks/full/typescript/src/api/resources/index.ts b/sdks/full/typescript/src/api/resources/index.ts index 3989427651..c47e93959f 100644 --- a/sdks/full/typescript/src/api/resources/index.ts +++ b/sdks/full/typescript/src/api/resources/index.ts @@ -10,6 +10,7 @@ export * as captcha from "./captcha"; export * as common from "./common"; export * from "./common/types"; export * as game from "./game"; +export * as games from "./games"; export * as geo from "./geo"; export * as matchmaker from "./matchmaker"; export * as portal from "./portal"; diff --git a/sdks/full/typescript/src/api/resources/servers/client/Client.ts b/sdks/full/typescript/src/api/resources/servers/client/Client.ts index 29ed864781..547d80f73e 100644 --- a/sdks/full/typescript/src/api/resources/servers/client/Client.ts +++ b/sdks/full/typescript/src/api/resources/servers/client/Client.ts @@ -35,6 +35,7 @@ export class Servers { * Gets a dynamic server. * * @param {string} gameId + * @param {string} environmentId * @param {string} serverId - The id of the server to destroy * @param {Servers.RequestOptions} requestOptions - Request-specific configuration. * @@ -46,17 +47,20 @@ export class Servers { * @throws {@link Rivet.BadRequestError} * * @example - * await client.servers.get("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32") + * await client.servers.get("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32") */ public async get( gameId: string, + environmentId: string, serverId: string, requestOptions?: Servers.RequestOptions ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.RivetEnvironment.Production, - `/games/${encodeURIComponent(gameId)}/servers/${encodeURIComponent(serverId)}` + `/games/${encodeURIComponent(gameId)}/environments/${encodeURIComponent( + environmentId + )}/servers/${encodeURIComponent(serverId)}` ), method: "GET", headers: { @@ -167,6 +171,7 @@ export class Servers { * Lists all servers associated with the token used. Can be filtered by tags in the query string. * * @param {string} gameId + * @param {string} environmentId * @param {Rivet.servers.GetServersRequest} request * @param {Servers.RequestOptions} requestOptions - Request-specific configuration. * @@ -178,13 +183,14 @@ export class Servers { * @throws {@link Rivet.BadRequestError} * * @example - * await client.servers.list("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", { + * await client.servers.list("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", { * tagsJson: "string", * game: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32" * }) */ public async list( gameId: string, + environmentId: string, request: Rivet.servers.GetServersRequest = {}, requestOptions?: Servers.RequestOptions ): Promise { @@ -201,7 +207,7 @@ export class Servers { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.RivetEnvironment.Production, - `/games/${encodeURIComponent(gameId)}/servers` + `/games/${encodeURIComponent(gameId)}/environments/${encodeURIComponent(environmentId)}/servers` ), method: "GET", headers: { @@ -313,6 +319,7 @@ export class Servers { * Create a new dynamic server. * * @param {string} gameId + * @param {string} environmentId * @param {Rivet.servers.CreateServerRequest} request * @param {Servers.RequestOptions} requestOptions - Request-specific configuration. * @@ -324,31 +331,27 @@ export class Servers { * @throws {@link Rivet.BadRequestError} * * @example - * await client.servers.create("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", { + * await client.servers.create("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", { * datacenter: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", * tags: { * "key": "value" * }, - * image: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", - * arguments: ["string"], - * environment: { - * "string": "string" - * }, + * runtime: {}, * network: {}, * resources: {}, - * killTimeout: 1000000, - * webhookUrl: "string" + * lifecycle: {} * }) */ public async create( gameId: string, + environmentId: string, request: Rivet.servers.CreateServerRequest, requestOptions?: Servers.RequestOptions ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.RivetEnvironment.Production, - `/games/${encodeURIComponent(gameId)}/servers` + `/games/${encodeURIComponent(gameId)}/environments/${encodeURIComponent(environmentId)}/servers` ), method: "POST", headers: { @@ -460,6 +463,7 @@ export class Servers { * Destroy a dynamic server. * * @param {string} gameId + * @param {string} environmentId * @param {string} serverId - The id of the server to destroy * @param {Rivet.servers.DestroyServerRequest} request * @param {Servers.RequestOptions} requestOptions - Request-specific configuration. @@ -472,12 +476,13 @@ export class Servers { * @throws {@link Rivet.BadRequestError} * * @example - * await client.servers.destroy("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", { + * await client.servers.destroy("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", { * overrideKillTimeout: 1000000 * }) */ public async destroy( gameId: string, + environmentId: string, serverId: string, request: Rivet.servers.DestroyServerRequest = {}, requestOptions?: Servers.RequestOptions @@ -491,7 +496,9 @@ export class Servers { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.RivetEnvironment.Production, - `/games/${encodeURIComponent(gameId)}/servers/${encodeURIComponent(serverId)}` + `/games/${encodeURIComponent(gameId)}/environments/${encodeURIComponent( + environmentId + )}/servers/${encodeURIComponent(serverId)}` ), method: "DELETE", headers: { diff --git a/sdks/full/typescript/src/api/resources/servers/resources/builds/client/Client.ts b/sdks/full/typescript/src/api/resources/servers/resources/builds/client/Client.ts index a9d7571657..315e07d100 100644 --- a/sdks/full/typescript/src/api/resources/servers/resources/builds/client/Client.ts +++ b/sdks/full/typescript/src/api/resources/servers/resources/builds/client/Client.ts @@ -33,6 +33,7 @@ export class Builds { * Lists all builds of the game associated with the token used. Can be filtered by tags in the query string. * * @param {string} gameId + * @param {string} environmentId * @param {string} buildId * @param {Rivet.servers.GetBuildRequest} request * @param {Builds.RequestOptions} requestOptions - Request-specific configuration. @@ -45,13 +46,14 @@ export class Builds { * @throws {@link Rivet.BadRequestError} * * @example - * await client.servers.builds.getBuild("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", { + * await client.servers.builds.getBuild("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", { * tagsJson: "string", * gameId: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32" * }) */ public async getBuild( gameId: string, + environmentId: string, buildId: string, request: Rivet.servers.GetBuildRequest = {}, requestOptions?: Builds.RequestOptions @@ -69,7 +71,9 @@ export class Builds { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.RivetEnvironment.Production, - `/games/${encodeURIComponent(gameId)}/builds/${encodeURIComponent(buildId)}` + `/games/${encodeURIComponent(gameId)}/environments/${encodeURIComponent( + environmentId + )}/builds/${encodeURIComponent(buildId)}` ), method: "GET", headers: { @@ -181,6 +185,7 @@ export class Builds { * Lists all builds of the game associated with the token used. Can be filtered by tags in the query string. * * @param {string} gameId + * @param {string} environmentId * @param {Rivet.servers.ListBuildsRequest} request * @param {Builds.RequestOptions} requestOptions - Request-specific configuration. * @@ -192,13 +197,14 @@ export class Builds { * @throws {@link Rivet.BadRequestError} * * @example - * await client.servers.builds.listBuilds("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", { + * await client.servers.builds.listBuilds("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", { * tagsJson: "string", * gameId: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32" * }) */ public async listBuilds( gameId: string, + environmentId: string, request: Rivet.servers.ListBuildsRequest = {}, requestOptions?: Builds.RequestOptions ): Promise { @@ -215,7 +221,7 @@ export class Builds { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.RivetEnvironment.Production, - `/games/${encodeURIComponent(gameId)}/builds` + `/games/${encodeURIComponent(gameId)}/environments/${encodeURIComponent(environmentId)}/builds` ), method: "GET", headers: { @@ -325,6 +331,7 @@ export class Builds { /** * @param {string} gameId + * @param {string} environmentId * @param {string} buildId * @param {Rivet.servers.PatchBuildTagsRequest} request * @param {Builds.RequestOptions} requestOptions - Request-specific configuration. @@ -337,7 +344,7 @@ export class Builds { * @throws {@link Rivet.BadRequestError} * * @example - * await client.servers.builds.patchTags("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", { + * await client.servers.builds.patchTags("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", { * tags: { * "key": "value" * }, @@ -346,6 +353,7 @@ export class Builds { */ public async patchTags( gameId: string, + environmentId: string, buildId: string, request: Rivet.servers.PatchBuildTagsRequest, requestOptions?: Builds.RequestOptions @@ -353,7 +361,9 @@ export class Builds { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.RivetEnvironment.Production, - `/games/${encodeURIComponent(gameId)}/builds/${encodeURIComponent(buildId)}/tags` + `/games/${encodeURIComponent(gameId)}/environments/${encodeURIComponent( + environmentId + )}/builds/${encodeURIComponent(buildId)}/tags` ), method: "PATCH", headers: { @@ -465,6 +475,7 @@ export class Builds { * Creates a new game build for the given game. * * @param {string} gameId + * @param {string} environmentId * @param {Rivet.servers.CreateBuildRequest} request * @param {Builds.RequestOptions} requestOptions - Request-specific configuration. * @@ -476,7 +487,7 @@ export class Builds { * @throws {@link Rivet.BadRequestError} * * @example - * await client.servers.builds.prepareBuild("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", { + * await client.servers.builds.prepareBuild("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", { * name: "string", * imageTag: "string", * imageFile: {}, @@ -487,13 +498,14 @@ export class Builds { */ public async prepareBuild( gameId: string, + environmentId: string, request: Rivet.servers.CreateBuildRequest, requestOptions?: Builds.RequestOptions ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.RivetEnvironment.Production, - `/games/${encodeURIComponent(gameId)}/builds/prepare` + `/games/${encodeURIComponent(gameId)}/environments/${encodeURIComponent(environmentId)}/builds/prepare` ), method: "POST", headers: { @@ -605,6 +617,7 @@ export class Builds { * Marks an upload as complete. * * @param {string} gameId + * @param {string} environmentId * @param {string} buildId * @param {Builds.RequestOptions} requestOptions - Request-specific configuration. * @@ -616,13 +629,20 @@ export class Builds { * @throws {@link Rivet.BadRequestError} * * @example - * await client.servers.builds.completeBuild("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32") + * await client.servers.builds.completeBuild("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32") */ - public async completeBuild(gameId: string, buildId: string, requestOptions?: Builds.RequestOptions): Promise { + public async completeBuild( + gameId: string, + environmentId: string, + buildId: string, + requestOptions?: Builds.RequestOptions + ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.RivetEnvironment.Production, - `/games/${encodeURIComponent(gameId)}/builds/${encodeURIComponent(buildId)}/complete` + `/games/${encodeURIComponent(gameId)}/environments/${encodeURIComponent( + environmentId + )}/builds/${encodeURIComponent(buildId)}/complete` ), method: "POST", headers: { diff --git a/sdks/full/typescript/src/api/resources/servers/resources/logs/client/Client.ts b/sdks/full/typescript/src/api/resources/servers/resources/logs/client/Client.ts index 3d9bcc4e68..a7095d393f 100644 --- a/sdks/full/typescript/src/api/resources/servers/resources/logs/client/Client.ts +++ b/sdks/full/typescript/src/api/resources/servers/resources/logs/client/Client.ts @@ -33,6 +33,7 @@ export class Logs { * Returns the logs for a given server. * * @param {string} gameId + * @param {string} environmentId * @param {string} serverId * @param {Rivet.servers.GetServerLogsRequest} request * @param {Logs.RequestOptions} requestOptions - Request-specific configuration. @@ -45,7 +46,7 @@ export class Logs { * @throws {@link Rivet.BadRequestError} * * @example - * await client.servers.logs.getServerLogs("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", { + * await client.servers.logs.getServerLogs("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", { * stream: Rivet.servers.LogStream.StdOut, * game: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", * watchIndex: "string" @@ -53,6 +54,7 @@ export class Logs { */ public async getServerLogs( gameId: string, + environmentId: string, serverId: string, request: Rivet.servers.GetServerLogsRequest, requestOptions?: Logs.RequestOptions @@ -71,7 +73,9 @@ export class Logs { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.RivetEnvironment.Production, - `/games/${encodeURIComponent(gameId)}/servers/${encodeURIComponent(serverId)}/logs` + `/games/${encodeURIComponent(gameId)}/environments/${encodeURIComponent( + environmentId + )}/servers/${encodeURIComponent(serverId)}/logs` ), method: "GET", headers: { diff --git a/sdks/full/typescript/src/serialization/resources/cloud/resources/games/resources/tokens/types/index.ts b/sdks/full/typescript/src/serialization/resources/cloud/resources/games/resources/tokens/types/index.ts index 3f81f48699..c6eb67fbbe 100644 --- a/sdks/full/typescript/src/serialization/resources/cloud/resources/games/resources/tokens/types/index.ts +++ b/sdks/full/typescript/src/serialization/resources/cloud/resources/games/resources/tokens/types/index.ts @@ -1,2 +1 @@ export * from "./CreateCloudTokenResponse"; -export * from "./CreateServiceTokenResponse"; diff --git a/sdks/full/typescript/src/serialization/resources/games/index.ts b/sdks/full/typescript/src/serialization/resources/games/index.ts new file mode 100644 index 0000000000..3e5335fe42 --- /dev/null +++ b/sdks/full/typescript/src/serialization/resources/games/index.ts @@ -0,0 +1 @@ +export * from "./resources"; diff --git a/sdks/full/typescript/src/serialization/resources/games/resources/environments/index.ts b/sdks/full/typescript/src/serialization/resources/games/resources/environments/index.ts new file mode 100644 index 0000000000..3e5335fe42 --- /dev/null +++ b/sdks/full/typescript/src/serialization/resources/games/resources/environments/index.ts @@ -0,0 +1 @@ +export * from "./resources"; diff --git a/sdks/full/typescript/src/serialization/resources/games/resources/environments/resources/index.ts b/sdks/full/typescript/src/serialization/resources/games/resources/environments/resources/index.ts new file mode 100644 index 0000000000..57df7482c7 --- /dev/null +++ b/sdks/full/typescript/src/serialization/resources/games/resources/environments/resources/index.ts @@ -0,0 +1,2 @@ +export * as tokens from "./tokens"; +export * from "./tokens/types"; diff --git a/sdks/full/typescript/src/serialization/resources/games/resources/environments/resources/tokens/index.ts b/sdks/full/typescript/src/serialization/resources/games/resources/environments/resources/tokens/index.ts new file mode 100644 index 0000000000..eea524d655 --- /dev/null +++ b/sdks/full/typescript/src/serialization/resources/games/resources/environments/resources/tokens/index.ts @@ -0,0 +1 @@ +export * from "./types"; diff --git a/sdks/full/typescript/src/serialization/resources/games/resources/index.ts b/sdks/full/typescript/src/serialization/resources/games/resources/index.ts new file mode 100644 index 0000000000..edb1d83107 --- /dev/null +++ b/sdks/full/typescript/src/serialization/resources/games/resources/index.ts @@ -0,0 +1 @@ +export * as environments from "./environments"; diff --git a/sdks/full/typescript/src/serialization/resources/index.ts b/sdks/full/typescript/src/serialization/resources/index.ts index f134c5d8f3..17a08df3e6 100644 --- a/sdks/full/typescript/src/serialization/resources/index.ts +++ b/sdks/full/typescript/src/serialization/resources/index.ts @@ -10,6 +10,7 @@ export * as captcha from "./captcha"; export * as common from "./common"; export * from "./common/types"; export * as game from "./game"; +export * as games from "./games"; export * as geo from "./geo"; export * as matchmaker from "./matchmaker"; export * as portal from "./portal"; diff --git a/sdks/full/typescript/types/Client.d.ts b/sdks/full/typescript/types/Client.d.ts index cc17ae102e..6f931b8b8a 100644 --- a/sdks/full/typescript/types/Client.d.ts +++ b/sdks/full/typescript/types/Client.d.ts @@ -11,6 +11,7 @@ import { Kv } from "./api/resources/kv/client/Client"; import { Provision } from "./api/resources/provision/client/Client"; import { Servers } from "./api/resources/servers/client/Client"; import { Auth } from "./api/resources/auth/client/Client"; +import { Games } from "./api/resources/games/client/Client"; import { Job } from "./api/resources/job/client/Client"; import { Matchmaker } from "./api/resources/matchmaker/client/Client"; import { Portal } from "./api/resources/portal/client/Client"; @@ -48,6 +49,8 @@ export declare class RivetClient { get servers(): Servers; protected _auth: Auth | undefined; get auth(): Auth; + protected _games: Games | undefined; + get games(): Games; protected _job: Job | undefined; get job(): Job; protected _matchmaker: Matchmaker | undefined; diff --git a/sdks/full/typescript/types/api/resources/cloud/resources/games/resources/tokens/client/Client.d.ts b/sdks/full/typescript/types/api/resources/cloud/resources/games/resources/tokens/client/Client.d.ts index 9dc722c9c0..31dd0373d0 100644 --- a/sdks/full/typescript/types/api/resources/cloud/resources/games/resources/tokens/client/Client.d.ts +++ b/sdks/full/typescript/types/api/resources/cloud/resources/games/resources/tokens/client/Client.d.ts @@ -39,22 +39,5 @@ export declare class Tokens { * await client.cloud.games.tokens.createCloudToken("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32") */ createCloudToken(gameId: string, requestOptions?: Tokens.RequestOptions): Promise; - /** - * Creates a new game service token. - * - * @param {string} gameId - * @param {Tokens.RequestOptions} requestOptions - Request-specific configuration. - * - * @throws {@link Rivet.InternalError} - * @throws {@link Rivet.RateLimitError} - * @throws {@link Rivet.ForbiddenError} - * @throws {@link Rivet.UnauthorizedError} - * @throws {@link Rivet.NotFoundError} - * @throws {@link Rivet.BadRequestError} - * - * @example - * await client.cloud.games.tokens.createServiceToken("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32") - */ - createServiceToken(gameId: string, requestOptions?: Tokens.RequestOptions): Promise; protected _getAuthorizationHeader(): Promise; } diff --git a/sdks/full/typescript/types/api/resources/cloud/resources/games/resources/tokens/types/index.d.ts b/sdks/full/typescript/types/api/resources/cloud/resources/games/resources/tokens/types/index.d.ts index 3f81f48699..c6eb67fbbe 100644 --- a/sdks/full/typescript/types/api/resources/cloud/resources/games/resources/tokens/types/index.d.ts +++ b/sdks/full/typescript/types/api/resources/cloud/resources/games/resources/tokens/types/index.d.ts @@ -1,2 +1 @@ export * from "./CreateCloudTokenResponse"; -export * from "./CreateServiceTokenResponse"; diff --git a/sdks/full/typescript/types/api/resources/index.d.ts b/sdks/full/typescript/types/api/resources/index.d.ts index 3989427651..c47e93959f 100644 --- a/sdks/full/typescript/types/api/resources/index.d.ts +++ b/sdks/full/typescript/types/api/resources/index.d.ts @@ -10,6 +10,7 @@ export * as captcha from "./captcha"; export * as common from "./common"; export * from "./common/types"; export * as game from "./game"; +export * as games from "./games"; export * as geo from "./geo"; export * as matchmaker from "./matchmaker"; export * as portal from "./portal"; diff --git a/sdks/full/typescript/types/serialization/resources/cloud/resources/games/resources/tokens/types/index.d.ts b/sdks/full/typescript/types/serialization/resources/cloud/resources/games/resources/tokens/types/index.d.ts index 3f81f48699..c6eb67fbbe 100644 --- a/sdks/full/typescript/types/serialization/resources/cloud/resources/games/resources/tokens/types/index.d.ts +++ b/sdks/full/typescript/types/serialization/resources/cloud/resources/games/resources/tokens/types/index.d.ts @@ -1,2 +1 @@ export * from "./CreateCloudTokenResponse"; -export * from "./CreateServiceTokenResponse"; diff --git a/sdks/full/typescript/types/serialization/resources/index.d.ts b/sdks/full/typescript/types/serialization/resources/index.d.ts index f134c5d8f3..17a08df3e6 100644 --- a/sdks/full/typescript/types/serialization/resources/index.d.ts +++ b/sdks/full/typescript/types/serialization/resources/index.d.ts @@ -10,6 +10,7 @@ export * as captcha from "./captcha"; export * as common from "./common"; export * from "./common/types"; export * as game from "./game"; +export * as games from "./games"; export * as geo from "./geo"; export * as matchmaker from "./matchmaker"; export * as portal from "./portal"; diff --git a/sdks/runtime/typescript/archive.tgz b/sdks/runtime/typescript/archive.tgz index eba805dcac..5b543a2f8e 100644 --- a/sdks/runtime/typescript/archive.tgz +++ b/sdks/runtime/typescript/archive.tgz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:071fe51bfbef89bc2a91dd2e8ebb87f64c74a2b87605c9b1f79d5877c32cd197 -size 282615 +oid sha256:dfbae41b7677e51d13771c439afa6bf876660f5dd03835c69977b47ce0b7fb87 +size 282626 diff --git a/svc/Cargo.toml b/svc/Cargo.toml index 845eb4eebb..efad6845ad 100644 --- a/svc/Cargo.toml +++ b/svc/Cargo.toml @@ -7,6 +7,7 @@ members = [ "api/auth", "api/cf-verification", "api/cloud", + "api/games", "api/group", "api/identity", "api/internal-monolith", @@ -50,7 +51,6 @@ members = [ "pkg/cloud/ops/device-link-create", "pkg/cloud/ops/game-config-create", "pkg/cloud/ops/game-config-get", - "pkg/cloud/ops/game-service-token-create", "pkg/cloud/ops/game-token-create", "pkg/cloud/ops/namespace-create", "pkg/cloud/ops/namespace-get", diff --git a/svc/api/cloud/Cargo.toml b/svc/api/cloud/Cargo.toml index 46d9cc700c..2097206faa 100644 --- a/svc/api/cloud/Cargo.toml +++ b/svc/api/cloud/Cargo.toml @@ -57,7 +57,6 @@ cloud-device-link-create = { path = "../../pkg/cloud/ops/device-link-create" } cloud-game-config-create = { path = "../../pkg/cloud/ops/game-config-create" } cloud-game-config-get = { path = "../../pkg/cloud/ops/game-config-get" } cloud-game-token-create = { path = "../../pkg/cloud/ops/game-token-create" } -cloud-service-game-token-create = { path = "../../pkg/cloud/ops/game-service-token-create" } cloud-namespace-create = { path = "../../pkg/cloud/ops/namespace-create" } cloud-namespace-get = { path = "../../pkg/cloud/ops/namespace-get" } cloud-namespace-token-development-create = { path = "../../pkg/cloud/ops/namespace-token-development-create" } diff --git a/svc/api/cloud/src/route/games/tokens.rs b/svc/api/cloud/src/route/games/tokens.rs index 0e2b6a5f1e..3350389223 100644 --- a/svc/api/cloud/src/route/games/tokens.rs +++ b/svc/api/cloud/src/route/games/tokens.rs @@ -27,22 +27,3 @@ pub async fn create_cloud_token( }) } -// MARK: POST /games/{}/tokens/service -pub async fn create_service_token( - ctx: Ctx, - game_id: Uuid, - _body: serde_json::Value, -) -> GlobalResult { - ctx.auth() - .check_game_write_or_admin(ctx.op_ctx(), game_id) - .await?; - - let token_res = op!([ctx] cloud_service_game_token_create { - game_id: Some(game_id.into()), - }) - .await?; - - Ok(models::CloudGamesCreateServiceTokenResponse { - token: token_res.token, - }) -} diff --git a/svc/api/cloud/src/route/mod.rs b/svc/api/cloud/src/route/mod.rs index de861ab113..5eb6f04838 100644 --- a/svc/api/cloud/src/route/mod.rs +++ b/svc/api/cloud/src/route/mod.rs @@ -147,9 +147,6 @@ define_router! { "games" / Uuid / "tokens" / "cloud": { POST: games::tokens::create_cloud_token(body: serde_json::Value), }, - "games" / Uuid / "tokens" / "service": { - POST: games::tokens::create_service_token(body: serde_json::Value), - }, "games" / Uuid / "matchmaker" / "lobbies" / "export-history": { POST: games::matchmaker::export_history(body: models::CloudGamesExportMatchmakerLobbyHistoryRequest), }, diff --git a/svc/api/games/Cargo.toml b/svc/api/games/Cargo.toml new file mode 100644 index 0000000000..7af552a94b --- /dev/null +++ b/svc/api/games/Cargo.toml @@ -0,0 +1,70 @@ +[package] +name = "api-games" +version = "0.0.1" +authors = ["Rivet Gaming, LLC "] +edition = "2021" +license = "Apache-2.0" + +[dependencies] +api-helper = { path = "../../../lib/api-helper/build" } +chirp-client = { path = "../../../lib/chirp/client" } +rivet-operation = { path = "../../../lib/operation/core" } +chrono = "0.4" +http = "0.2" +hyper = { version = "0.14", features = ["server", "http1", "stream", "tcp"] } +lazy_static = "1.4" +rivet-api = { path = "../../../sdks/full/rust" } +rivet-cache = { path = "../../../lib/cache/build" } +rivet-claims = { path = "../../../lib/claims" } +rivet-health-checks = { path = "../../../lib/health-checks" } +rivet-convert = { path = "../../../lib/convert" } +rivet-pools = { path = "../../../lib/pools" } +s3-util = { path = "../../../lib/s3-util" } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +base64 = "0.13" +tokio = { version = "1.29" } +tracing = "0.1" +tracing-futures = "0.2" +tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt", "json", "ansi"] } +url = "2.2.2" +util-team = { package = "rivet-util-team", path = "../../pkg/team/util" } +uuid = { version = "1", features = ["v4"] } + +build-create = { path = "../../pkg/build/ops/create" } +build-get = { path = "../../pkg/build/ops/get" } +build-list-for-env = { path = "../../pkg/build/ops/list-for-env" } +cluster = { path = "../../pkg/cluster" } +build = { path = "../../pkg/build" } +ds-log-read = { path = "../../pkg/ds-log/ops/read" } +ds-server-create = { path = "../../pkg/ds/ops/server-create" } +ds-server-delete = { path = "../../pkg/ds/ops/server-delete" } +ds-server-get = { path = "../../pkg/ds/ops/server-get" } +ds-server-list-for-env = { path = "../../pkg/ds/ops/server-list-for-env" } +game-get = { path = "../../pkg/game/ops/get" } +game-namespace-get = { path = "../../pkg/game/ops/namespace-get" } +game-version-get = { path = "../../pkg/game/ops/version-get" } +team-get = { path = "../../pkg/team/ops/get" } +token-revoke = { path = "../../pkg/token/ops/revoke" } +token-create = { path = "../../pkg/token/ops/create" } +upload-complete = { path = "../../pkg/upload/ops/complete" } +upload-get = { path = "../../pkg/upload/ops/get" } +user-get = { path = "../../pkg/user/ops/get" } +user-identity-get = { path = "../../pkg/user-identity/ops/get" } +user-team-list = { path = "../../pkg/user/ops/team-list" } + +[dev-dependencies] +rivet-connection = { path = "../../../lib/connection" } +reqwest = "0.11" + +cdn-namespace-domain-create = { path = "../../pkg/cdn/ops/namespace-domain-create" } +cloud-namespace-token-development-create = { path = "../../pkg/cloud/ops/namespace-token-development-create" } +cloud-namespace-token-public-create = { path = "../../pkg/cloud/ops/namespace-token-public-create" } +cloud-service-env-token-create = { path = "../../pkg/cloud/ops/env-service-token-create" } +faker-build = { path = "../../pkg/faker/ops/build" } +faker-game = { path = "../../pkg/faker/ops/game" } +faker-game-namespace = { path = "../../pkg/faker/ops/game-namespace" } +faker-game-version = { path = "../../pkg/faker/ops/game-version" } +faker-region = { path = "../../pkg/faker/ops/region" } +game-get = { path = "../../pkg/game/ops/get" } +region-get = { path = "../../pkg/region/ops/get" } diff --git a/svc/api/games/Service.toml b/svc/api/games/Service.toml new file mode 100644 index 0000000000..b941e56a92 --- /dev/null +++ b/svc/api/games/Service.toml @@ -0,0 +1,7 @@ +[service] +name = "api-games" + +[runtime] +kind = "rust" + +[api-routes] diff --git a/svc/api/games/src/assert.rs b/svc/api/games/src/assert.rs new file mode 100644 index 0000000000..aa935e5400 --- /dev/null +++ b/svc/api/games/src/assert.rs @@ -0,0 +1,6 @@ +use api_helper::ctx::Ctx; +use rivet_api::models; +use rivet_convert::ApiTryFrom; +use rivet_operation::prelude::*; + +use crate::auth::Auth; diff --git a/svc/api/games/src/auth.rs b/svc/api/games/src/auth.rs new file mode 100644 index 0000000000..6e4dd0a8eb --- /dev/null +++ b/svc/api/games/src/auth.rs @@ -0,0 +1,144 @@ +use api_helper::{ + auth::{ApiAuth, AuthRateLimitCtx}, + util::{as_auth_expired, basic_rate_limit}, +}; +use proto::{backend, claims::Claims}; +use rivet_claims::ClaimsDecode; +use rivet_operation::prelude::*; + +pub struct Auth { + claims: Option, +} + +#[async_trait] +impl ApiAuth for Auth { + async fn new( + api_token: Option, + rate_limit_ctx: AuthRateLimitCtx<'_>, + ) -> GlobalResult { + Self::rate_limit(rate_limit_ctx).await?; + + Ok(Auth { + claims: if let Some(api_token) = api_token { + Some(as_auth_expired(rivet_claims::decode(&api_token)?)?) + } else { + None + }, + }) + } + + async fn rate_limit(rate_limit_ctx: AuthRateLimitCtx<'_>) -> GlobalResult<()> { + basic_rate_limit(rate_limit_ctx).await + } +} + +impl Auth { + pub fn claims(&self) -> GlobalResult<&Claims> { + self.claims + .as_ref() + .ok_or_else(|| err_code!(API_UNAUTHORIZED, reason = "No bearer token provided.")) + } + + pub fn server(&self) -> GlobalResult { + self.claims()?.as_env_service() + } + + pub async fn check_game( + &self, + ctx: &OperationContext<()>, + game_id: Uuid, + env_id: Uuid, + allow_service: bool, + ) -> GlobalResult<()> { + let claims = self.claims()?; + + // Get the game this env belongs to + let ns_res = op!([ctx] game_namespace_get { + namespace_ids: vec![env_id.into()], + }) + .await?; + let env = unwrap_with!(ns_res.namespaces.first(), GAME_ENVIRONMENT_NOT_FOUND); + + // Ensure belongs to game + ensure_with!( + unwrap!(env.game_id).as_uuid() == game_id, + GAME_ENVIRONMENT_NOT_FOUND + ); + + // Validate token + if let Ok(cloud_ent) = claims.as_game_cloud() { + ensure_with!( + cloud_ent.game_id == game_id, + API_FORBIDDEN, + reason = "Cloud token cannot write to this game", + ); + Ok(()) + } else if let Ok(service_ent) = claims.as_env_service() { + ensure_with!( + allow_service, + API_FORBIDDEN, + reason = "Cannot use service token for this endpoint." + ); + ensure_with!( + service_ent.env_id == env_id, + API_FORBIDDEN, + reason = "Service token cannot write to this game", + ); + Ok(()) + } else if let Ok(user_ent) = claims.as_user() { + // Get the user + let (user_res, game_res, team_list_res) = tokio::try_join!( + op!([ctx] user_get { + user_ids: vec![user_ent.user_id.into()], + }), + op!([ctx] game_get { + game_ids: vec![game_id.into()], + }), + op!([ctx] user_team_list { + user_ids: vec![user_ent.user_id.into()], + }), + )?; + let user = unwrap!(user_res.users.first()); + let game = unwrap_with!(game_res.games.first(), GAME_NOT_FOUND); + let user_teams = unwrap!(team_list_res.users.first()); + let dev_team_id = unwrap_ref!(game.developer_team_id).as_uuid(); + + // Allow admin + if user.is_admin { + return Ok(()); + } + + // Verify user is not deleted + ensure_with!(user.delete_complete_ts.is_none(), TOKEN_REVOKED); + + // Validate user is member of team + let is_part_of_team = user_teams + .teams + .iter() + .filter_map(|x| x.team_id) + .any(|x| x.as_uuid() == dev_team_id); + ensure_with!(is_part_of_team, GROUP_NOT_MEMBER); + + // Get team + let team_res = op!([ctx] team_get { + team_ids: vec![dev_team_id.into()], + }) + .await?; + let dev_team = unwrap!(team_res.teams.first()); + + // Check team active + ensure_with!( + dev_team.deactivate_reasons.is_empty(), + GROUP_DEACTIVATED, + reasons = util_team::format_deactivate_reasons(&dev_team.deactivate_reasons)?, + ); + + Ok(()) + } else { + bail_with!( + CLAIMS_MISSING_ENTITLEMENT, + entitlements = "User, GameCloud, EnvService" + ); + } + } +} diff --git a/svc/api/games/src/lib.rs b/svc/api/games/src/lib.rs new file mode 100644 index 0000000000..da71d9c8cf --- /dev/null +++ b/svc/api/games/src/lib.rs @@ -0,0 +1,3 @@ +pub mod assert; +pub mod auth; +pub mod route; diff --git a/svc/api/games/src/main.rs b/svc/api/games/src/main.rs new file mode 100644 index 0000000000..26c0bd45b7 --- /dev/null +++ b/svc/api/games/src/main.rs @@ -0,0 +1,5 @@ +use api_helper::start; + +fn main() { + start(api_servers::route::handle); +} diff --git a/svc/api/games/src/route/envs/mod.rs b/svc/api/games/src/route/envs/mod.rs new file mode 100644 index 0000000000..5c76635567 --- /dev/null +++ b/svc/api/games/src/route/envs/mod.rs @@ -0,0 +1 @@ +pub mod tokens; diff --git a/svc/api/games/src/route/envs/tokens.rs b/svc/api/games/src/route/envs/tokens.rs new file mode 100644 index 0000000000..76a24d29c3 --- /dev/null +++ b/svc/api/games/src/route/envs/tokens.rs @@ -0,0 +1,46 @@ +use api_helper::ctx::Ctx; +use proto::backend::pkg::*; +use rivet_api::models; +use rivet_operation::prelude::*; + +use crate::{assert, auth::Auth}; + +// MARK: POST /games/{}/environments/{}/tokens/service +pub async fn create_service( + ctx: Ctx, + game_id: Uuid, + env_id: Uuid, + _body: serde_json::Value, +) -> GlobalResult { + ctx.auth() + .check_game(ctx.op_ctx(), game_id, env_id, false) + .await?; + + let token_res = op!([ctx] token_create { + token_config: Some(token::create::request::TokenConfig { + // TODO: Allow configuring expiration + ttl: util::duration::days(15 * 365) + }), + refresh_token_config: None, + issuer: "api-games".to_owned(), + client: None, + kind: Some(token::create::request::Kind::New( + token::create::request::KindNew { entitlements: vec![proto::claims::Entitlement { + kind: Some(proto::claims::entitlement::Kind::EnvService( + proto::claims::entitlement::EnvService { + env_id: Some(env_id.into()), + } + )), + }]}, + )), + label: Some("env_svc".to_owned()), + ..Default::default() + }) + .await?; + + let token = unwrap_ref!(token_res.token); + + Ok(models::GamesEnvironmentsCreateServiceTokenResponse { + token: token.token.clone(), + }) +} diff --git a/svc/api/games/src/route/mod.rs b/svc/api/games/src/route/mod.rs new file mode 100644 index 0000000000..7fb571aa53 --- /dev/null +++ b/svc/api/games/src/route/mod.rs @@ -0,0 +1,30 @@ +use api_helper::{define_router, util::CorsConfigBuilder}; +use hyper::{Body, Request, Response}; +use rivet_api::models; +use uuid::Uuid; + +pub mod envs; + +pub async fn handle( + shared_client: chirp_client::SharedClientHandle, + pools: rivet_pools::Pools, + cache: rivet_cache::Cache, + ray_id: uuid::Uuid, + request: Request, +) -> Result, http::Error> { + let response = Response::builder(); + + // Handle route + Router::handle(shared_client, pools, cache, ray_id, request, response).await +} + +define_router! { + cors: CorsConfigBuilder::hub().build(), + routes: { + "games" / Uuid / "environments" / Uuid / "tokens" / "service": { + POST: envs::tokens::create_service( + body: serde_json::Value + ), + }, + }, +} diff --git a/svc/api/monolith/Cargo.toml b/svc/api/monolith/Cargo.toml index 3b33435cdf..041c31c969 100644 --- a/svc/api/monolith/Cargo.toml +++ b/svc/api/monolith/Cargo.toml @@ -25,6 +25,7 @@ api-admin = { path = "../admin" } api-auth = { path = "../auth" } api-cf-verification = { path = "../cf-verification" } api-cloud = { path = "../cloud" } +api-games = { path = "../games" } api-group = { path = "../group" } api-identity = { path = "../identity" } api-job = { path = "../job" } diff --git a/svc/api/monolith/src/route/mod.rs b/svc/api/monolith/src/route/mod.rs index a88933b731..517ee249f9 100644 --- a/svc/api/monolith/src/route/mod.rs +++ b/svc/api/monolith/src/route/mod.rs @@ -34,6 +34,9 @@ define_router! { path: api_cloud::route::Router, prefix: "cloud", }, + { + path: api_games::route::Router, + }, { path: api_group::route::Router, prefix: "group", diff --git a/svc/api/servers/Cargo.toml b/svc/api/servers/Cargo.toml index 4d22b4fe24..3ab67af7e3 100644 --- a/svc/api/servers/Cargo.toml +++ b/svc/api/servers/Cargo.toml @@ -59,7 +59,7 @@ reqwest = "0.11" cdn-namespace-domain-create = { path = "../../pkg/cdn/ops/namespace-domain-create" } cloud-namespace-token-development-create = { path = "../../pkg/cloud/ops/namespace-token-development-create" } cloud-namespace-token-public-create = { path = "../../pkg/cloud/ops/namespace-token-public-create" } -cloud-service-game-token-create = { path = "../../pkg/cloud/ops/game-service-token-create" } +cloud-service-env-token-create = { path = "../../pkg/cloud/ops/env-service-token-create" } faker-build = { path = "../../pkg/faker/ops/build" } faker-game = { path = "../../pkg/faker/ops/game" } faker-game-namespace = { path = "../../pkg/faker/ops/game-namespace" } diff --git a/svc/api/servers/src/assert.rs b/svc/api/servers/src/assert.rs index 015637a4f0..0b52aa2960 100644 --- a/svc/api/servers/src/assert.rs +++ b/svc/api/servers/src/assert.rs @@ -6,7 +6,12 @@ use rivet_operation::prelude::*; use crate::auth::Auth; /// Validates that a server belongs to the given game ID. -pub async fn server_for_game(ctx: &Ctx, server_id: Uuid, game_id: Uuid) -> GlobalResult<()> { +pub async fn server_for_env( + ctx: &Ctx, + server_id: Uuid, + game_id: Uuid, + env_id: Uuid, +) -> GlobalResult<()> { let get_res = op!([ctx] ds_server_get { server_ids: vec![server_id.into()], }) @@ -15,7 +20,7 @@ pub async fn server_for_game(ctx: &Ctx, server_id: Uuid, game_id: Uuid) -> // Validate token can access server ensure_with!( - unwrap!(server.game_id).as_uuid() == game_id, + unwrap!(server.env_id).as_uuid() == env_id, SERVERS_SERVER_NOT_FOUND ); diff --git a/svc/api/servers/src/auth.rs b/svc/api/servers/src/auth.rs index 3e6ee95f2b..6e4dd0a8eb 100644 --- a/svc/api/servers/src/auth.rs +++ b/svc/api/servers/src/auth.rs @@ -39,8 +39,8 @@ impl Auth { .ok_or_else(|| err_code!(API_UNAUTHORIZED, reason = "No bearer token provided.")) } - pub fn server(&self) -> GlobalResult { - self.claims()?.as_game_service() + pub fn server(&self) -> GlobalResult { + self.claims()?.as_env_service() } pub async fn check_game( @@ -57,7 +57,7 @@ impl Auth { namespace_ids: vec![env_id.into()], }) .await?; - let env = unwrap!(ns_res.namespaces.first(), GAME_ENVIRONMENT_NOT_FOUND); + let env = unwrap_with!(ns_res.namespaces.first(), GAME_ENVIRONMENT_NOT_FOUND); // Ensure belongs to game ensure_with!( @@ -73,14 +73,14 @@ impl Auth { reason = "Cloud token cannot write to this game", ); Ok(()) - } else if let Ok(service_ent) = claims.as_game_service() { + } else if let Ok(service_ent) = claims.as_env_service() { ensure_with!( allow_service, API_FORBIDDEN, reason = "Cannot use service token for this endpoint." ); ensure_with!( - service_ent.game_id == game_id, + service_ent.env_id == env_id, API_FORBIDDEN, reason = "Service token cannot write to this game", ); @@ -137,7 +137,7 @@ impl Auth { } else { bail_with!( CLAIMS_MISSING_ENTITLEMENT, - entitlements = "User, GameCloud, GameService" + entitlements = "User, GameCloud, EnvService" ); } } diff --git a/svc/api/servers/src/route/builds.rs b/svc/api/servers/src/route/builds.rs index 025201c66e..950afd675d 100644 --- a/svc/api/servers/src/route/builds.rs +++ b/svc/api/servers/src/route/builds.rs @@ -27,7 +27,7 @@ pub async fn get( build_ids: vec![build_id.into()], }) .await?; - let build = unwrap!(builds_res.builds.first(), BUILDS_BUILD_NOT_FOUND); + let build = unwrap_with!(builds_res.builds.first(), BUILDS_BUILD_NOT_FOUND); ensure_with!( unwrap!(build.env_id).as_uuid() == env_id, BUILDS_BUILD_NOT_FOUND diff --git a/svc/api/servers/src/route/logs.rs b/svc/api/servers/src/route/logs.rs index c17281cc5b..80c44a9b9d 100644 --- a/svc/api/servers/src/route/logs.rs +++ b/svc/api/servers/src/route/logs.rs @@ -29,7 +29,7 @@ pub async fn get_logs( .await?; // Validate server belongs to game - assert::server_for_game(&ctx, server_id, game_id).await?; + assert::server_for_env(&ctx, server_id, game_id, env_id).await?; // Determine stream type let stream_type = match query.stream { diff --git a/svc/api/servers/src/route/servers.rs b/svc/api/servers/src/route/servers.rs index 29056ddf09..cc4bae0a56 100644 --- a/svc/api/servers/src/route/servers.rs +++ b/svc/api/servers/src/route/servers.rs @@ -78,13 +78,13 @@ pub async fn create( cluster_id: Some(cluster_id.into()), tags: tags, resources: Some((*body.resources).api_into()), - kill_timeout_ms: body.kill_timeout.unwrap_or_default(), - image_id: Some(body.image.into()), - args: body.arguments.unwrap_or_default(), + kill_timeout_ms: body.lifecycle.as_ref().and_then(|x| x.kill_timeout).unwrap_or_default(), + image_id: Some(body.runtime.image.into()), + args: body.runtime.arguments.unwrap_or_default(), network_mode: backend::ds::NetworkMode::api_from( body.network.mode.unwrap_or_default(), ) as i32, - environment: body.environment.unwrap_or_default(), + environment: body.runtime.environment.unwrap_or_default(), network_ports: unwrap!(body.network .ports .into_iter() @@ -143,7 +143,7 @@ pub async fn destroy( .check_game(ctx.op_ctx(), game_id, env_id, true) .await?; - assert::server_for_game(&ctx, server_id, game_id).await?; + assert::server_for_env(&ctx, server_id, game_id, env_id).await?; op!([ctx] ds_server_delete { server_id: Some(server_id.into()), @@ -171,8 +171,8 @@ pub async fn list_servers( .check_game(ctx.op_ctx(), game_id, env_id, true) .await?; - let list_res = op!([ctx] ds_server_list_for_game { - game_id: Some(game_id.into()), + let list_res = op!([ctx] ds_server_list_for_env { + env_id: Some(env_id.into()), tags: query.tags_json.as_deref().map_or(Ok(HashMap::new()), serde_json::from_str)?, }) .await?; diff --git a/svc/api/servers/tests/basic.rs b/svc/api/servers/tests/basic.rs index 84e7a8b4e2..97c132b299 100644 --- a/svc/api/servers/tests/basic.rs +++ b/svc/api/servers/tests/basic.rs @@ -7,9 +7,11 @@ static GLOBAL_INIT: Once = Once::new(); struct Ctx { pub op_ctx: OperationContext<()>, - pub ns_auth_token: String, + pub service_token: String, pub game_id: Uuid, + pub env_id: Uuid, pub game_id_str: String, + pub env_id_str: String, pub datacenter_id: Uuid, pub image_id: Uuid, } @@ -46,14 +48,16 @@ impl Ctx { ); let (datacenter_id, primary_datacenter_name_id) = Self::setup_datacenter(&op_ctx).await?; - let (game_id, image_id) = Self::setup_game(&op_ctx, datacenter_id).await?; - let ns_auth_token = Self::setup_public_token(&op_ctx, game_id).await?; + let (game_id, env_id, image_id) = Self::setup_game(&op_ctx, datacenter_id).await?; + let service_token = Self::setup_token(&op_ctx, game_id).await?; Ok(Ctx { op_ctx, - ns_auth_token, + service_token, game_id, + env_id, game_id_str: game_id.to_string(), + env_id_str: env_id.to_string(), datacenter_id, image_id, }) @@ -110,30 +114,29 @@ impl Ctx { pub async fn setup_game( ctx: &OperationContext<()>, region_id: Uuid, - ) -> GlobalResult<(Uuid, Uuid)> { + ) -> GlobalResult<(Uuid, Uuid, Uuid)> { let game_res = op!([ctx] faker_game { ..Default::default() }) .await?; let game_id = unwrap!(game_res.game_id); + let env_id = unwrap!(game_res.prod_env_id); let build_res = op!([ctx] faker_build { - game_id: Some(game_id), + env_id: Some(env_id.clone()), image: proto::backend::faker::Image::DsEcho as i32, }) .await?; Ok(( unwrap!(game_res.game_id).as_uuid(), + unwrap!(game_res.prod_env_id).as_uuid(), unwrap!(build_res.build_id).as_uuid(), )) } - pub async fn setup_public_token( - ctx: &OperationContext<()>, - game_id: Uuid, - ) -> GlobalResult { - let token_res = op!([ctx] cloud_service_game_token_create { + pub async fn setup_token(ctx: &OperationContext<()>, game_id: Uuid) -> GlobalResult { + let token_res = op!([ctx] cloud_service_env_token_create { game_id: Some(game_id.into()), }) .await?; @@ -146,18 +149,20 @@ impl Ctx { async fn create_http() -> GlobalResult<()> { let ctx = Ctx::init().await?; - let ctx_config = ctx.config(ctx.ns_auth_token.clone())?; + let ctx_config = ctx.config(ctx.service_token.clone())?; servers_api::servers_create( &ctx_config, &ctx.game_id_str, + &ctx.env_id_str, models::ServersCreateServerRequest { - arguments: None, datacenter: ctx.datacenter_id, - environment: Some(HashMap::new()), - image: ctx.image_id, - kill_timeout: Some(0), tags: None, + runtime: Box::new(models::ServersCreateServerRuntimeRequest { + image: ctx.image_id, + environment: Some(HashMap::new()), + arguments: None, + }), network: Box::new(models::ServersCreateServerNetworkRequest { mode: Some(models::ServersNetworkMode::Bridge), ports: vec![( @@ -175,6 +180,9 @@ async fn create_http() -> GlobalResult<()> { .into_iter() .collect(), }), + lifecycle: Some(Box::new(models::ServersLifecycle { + kill_timeout: Some(0), + })), resources: Box::new(models::ServersResources { cpu: 100, memory: 200, @@ -190,18 +198,23 @@ async fn create_http() -> GlobalResult<()> { async fn list_builds_with_tags() -> GlobalResult<()> { let ctx = Ctx::init().await?; - let ctx_config = ctx.config(ctx.ns_auth_token.clone())?; + let ctx_config = ctx.config(ctx.service_token.clone())?; servers_api::servers_create( &ctx_config, &ctx.game_id_str, + &ctx.env_id_str, models::ServersCreateServerRequest { - arguments: None, datacenter: ctx.datacenter_id, - environment: Some(HashMap::new()), - image: ctx.image_id, - kill_timeout: Some(0), tags: None, + runtime: Box::new(models::ServersCreateServerRuntimeRequest { + image: ctx.image_id, + arguments: None, + environment: Some(HashMap::new()), + }), + lifecycle: Some(Box::new(models::ServersLifecycle { + kill_timeout: Some(0), + })), network: Box::new(models::ServersCreateServerNetworkRequest { mode: Some(models::ServersNetworkMode::Bridge), ports: vec![( diff --git a/svc/pkg/build/ops/get/src/lib.rs b/svc/pkg/build/ops/get/src/lib.rs index 4ddbd59b3a..c2de18c22c 100644 --- a/svc/pkg/build/ops/get/src/lib.rs +++ b/svc/pkg/build/ops/get/src/lib.rs @@ -7,7 +7,8 @@ use serde_json::Value; #[derive(sqlx::FromRow)] struct BuildRow { build_id: Uuid, - game_id: Uuid, + game_id: Option, + env_id: Option, upload_id: Uuid, display_name: String, image_tag: String, @@ -31,6 +32,7 @@ async fn handle(ctx: OperationContext) -> GlobalResult) -> GlobalResult"] -license = "Apache-2.0" - -[dependencies] -rivet-operation = { path = "../../../../../lib/operation/core" } -chirp-client = { path = "../../../../../lib/chirp/client" } -prost = "0.10" - -token-create = { path = "../../../token/ops/create" } - -[dependencies.sqlx] -git = "https://github.com/rivet-gg/sqlx" -rev = "08d6e61aa0572e7ec557abbedb72cebb96e1ac5b" -default-features = false - -[dev-dependencies] -chirp-worker = { path = "../../../../../lib/chirp/worker" } - -faker-game = { path = "../../../faker/ops/game" } diff --git a/svc/pkg/cloud/ops/game-service-token-create/README.md b/svc/pkg/cloud/ops/game-service-token-create/README.md deleted file mode 100644 index 45fefbb2c7..0000000000 --- a/svc/pkg/cloud/ops/game-service-token-create/README.md +++ /dev/null @@ -1 +0,0 @@ -# cloud-game-token-create diff --git a/svc/pkg/cloud/ops/game-service-token-create/Service.toml b/svc/pkg/cloud/ops/game-service-token-create/Service.toml deleted file mode 100644 index 3da51dee5e..0000000000 --- a/svc/pkg/cloud/ops/game-service-token-create/Service.toml +++ /dev/null @@ -1,10 +0,0 @@ -[service] -name = "cloud-game-token-create" - -[runtime] -kind = "rust" - -[operation] - -[databases] -db-cloud = {} diff --git a/svc/pkg/cloud/ops/game-service-token-create/src/lib.rs b/svc/pkg/cloud/ops/game-service-token-create/src/lib.rs deleted file mode 100644 index 4f1403f017..0000000000 --- a/svc/pkg/cloud/ops/game-service-token-create/src/lib.rs +++ /dev/null @@ -1,46 +0,0 @@ -use common::glob::Token; -use proto::backend::pkg::*; -use rivet_operation::prelude::*; - -#[operation(name = "cloud-service-game-token-create")] -async fn handle( - ctx: OperationContext, -) -> GlobalResult { - let game_id = unwrap_ref!(ctx.game_id).as_uuid(); - - let token_res = op!([ctx] token_create { - token_config: Some(token::create::request::TokenConfig { - ttl: util::duration::days(15 * 365) - }), - refresh_token_config: None, - issuer: "api-cloud".to_owned(), - client: None, - kind: Some(token::create::request::Kind::New( - token::create::request::KindNew { entitlements: vec![proto::claims::Entitlement { - kind: Some(proto::claims::entitlement::Kind::GameService( - proto::claims::entitlement::GameService { - game_id: Some(game_id.into()), - } - )), - }]}, - )), - label: Some("game_service".to_owned()), - ..Default::default() - }) - .await?; - - let token = unwrap_ref!(token_res.token); - let token_session_id = unwrap_ref!(token_res.session_id).as_uuid(); - - sql_execute!( - [ctx] - "INSERT INTO db_cloud.service_cloud_tokens (game_id, token_session_id) VALUES ($1, $2)", - game_id, - token_session_id, - ) - .await?; - - Ok(cloud::game_token_create::Response { - token: token.token.clone(), - }) -} diff --git a/svc/pkg/cloud/ops/game-service-token-create/tests/integration.rs b/svc/pkg/cloud/ops/game-service-token-create/tests/integration.rs deleted file mode 100644 index 860a6b67fc..0000000000 --- a/svc/pkg/cloud/ops/game-service-token-create/tests/integration.rs +++ /dev/null @@ -1,16 +0,0 @@ -use chirp_worker::prelude::*; - -#[worker_test] -async fn empty(ctx: TestCtx) { - let game_res = op!([ctx] faker_game { - ..Default::default() - }) - .await - .unwrap(); - - // op!([ctx] cloud_game_token_create { - // game_id: game_res.game_id, - // }) - // .await - // .unwrap(); -} diff --git a/svc/pkg/ds/ops/server-create/tests/integration.rs b/svc/pkg/ds/ops/server-create/tests/integration.rs index bcafd87b06..a32fba5772 100644 --- a/svc/pkg/ds/ops/server-create/tests/integration.rs +++ b/svc/pkg/ds/ops/server-create/tests/integration.rs @@ -17,7 +17,7 @@ async fn create(ctx: TestCtx) { }) .await .unwrap(); - let game_id = game_res.game_id.unwrap(); + let env_id = game_res.prod_env_id.unwrap(); // Create token let token_res = op!([ctx] token_create { @@ -27,14 +27,14 @@ async fn create(ctx: TestCtx) { issuer: "test".to_owned(), kind: Some(token::create::request::Kind::New( token::create::request::KindNew { entitlements: vec![proto::claims::Entitlement { - kind: Some(proto::claims::entitlement::Kind::GameService( - proto::claims::entitlement::GameService { - game_id: Some(game_id), + kind: Some(proto::claims::entitlement::Kind::EnvService( + proto::claims::entitlement::EnvService { + env_id: game_res.env_id.clone(), } )), }]}, )), - label: Some("game_service".to_owned()), + label: Some("env".to_owned()), ..Default::default() }) .await @@ -68,7 +68,7 @@ async fn create(ctx: TestCtx) { .to_owned(); let build_res: backend::pkg::faker::build::Response = op!([ctx] faker_build { - game_id: Some(game_id), + env_id: Some(env_id), image: backend::faker::Image::DsEcho as i32, }) .await @@ -100,7 +100,7 @@ async fn create(ctx: TestCtx) { .collect(); let server = op!([ctx] ds_server_create { - game_id: Some(game_id), + env_id: Some(env_id), cluster_id: Some(cluster_id.into()), datacenter_id: faker_region.region_id, resources: Some(proto::backend::ds::ServerResources { cpu_millicores: 100, memory_mib: 200 }), @@ -153,5 +153,5 @@ async fn create(ctx: TestCtx) { let res_text = res.text().await.unwrap(); assert_eq!(random_body, res_text, "echoed wrong response"); - // assert_eq!(game_res.game_id.unwrap(), server.game_id.unwrap().as_uuid()); + // assert_eq!(game_res.prod_env_id.unwrap(), server.env_id.unwrap().as_uuid()); } diff --git a/svc/pkg/ds/ops/server-create/tests/print_test_data.rs b/svc/pkg/ds/ops/server-create/tests/print_test_data.rs index 026b93c31b..15082e4bdc 100644 --- a/svc/pkg/ds/ops/server-create/tests/print_test_data.rs +++ b/svc/pkg/ds/ops/server-create/tests/print_test_data.rs @@ -11,7 +11,7 @@ async fn print_test_data(ctx: TestCtx) { }) .await .unwrap(); - let game_id = game_res.game_id.unwrap(); + let env_id = game_res.prod_env_id.unwrap(); let user_res = op!([ctx] faker_user { ..Default::default() @@ -46,7 +46,7 @@ async fn print_test_data(ctx: TestCtx) { .to_owned(); let build_res: backend::pkg::faker::build::Response = op!([ctx] faker_build { - game_id: Some(game_id), + env_id: Some(env_id), image: backend::faker::Image::DsEcho as i32, }) .await @@ -60,14 +60,14 @@ async fn print_test_data(ctx: TestCtx) { issuer: "test".to_owned(), kind: Some(token::create::request::Kind::New( token::create::request::KindNew { entitlements: vec![proto::claims::Entitlement { - kind: Some(proto::claims::entitlement::Kind::GameService( - proto::claims::entitlement::GameService { - game_id: Some(game_id), + kind: Some(proto::claims::entitlement::Kind::EnvService( + proto::claims::entitlement::EnvService { + env_id: game_res.env_id.clone(), } )), }]}, )), - label: Some("game_service".to_owned()), + label: Some("env".to_owned()), ..Default::default() }) .await @@ -83,7 +83,7 @@ async fn print_test_data(ctx: TestCtx) { token::create::request::KindNew { entitlements: vec![proto::claims::Entitlement { kind: Some(proto::claims::entitlement::Kind::GameCloud( proto::claims::entitlement::GameCloud { - game_id: Some(game_id), + env_id: game_res.env_id.clone(), } )), },proto::claims::Entitlement { @@ -115,19 +115,20 @@ async fn print_test_data(ctx: TestCtx) { )), }]}, )), - label: Some("game_service".to_owned()), + label: Some("env".to_owned()), ..Default::default() }) .await .unwrap(); tracing::info!( - ?game_id, + ?env_id, ?datacenter_id, service_token = ?token_res.token.clone().unwrap().token, cloud_token = ?cloud_token_res.token.clone().unwrap().token, invalid_token = ?invalid_token.token.clone().unwrap().token, build_id = ?build_res.build_id.unwrap(), + env_id = ?env_id, "test data"); // // let runtime = Some( @@ -161,10 +162,10 @@ async fn print_test_data(ctx: TestCtx) { // // let faker_region = op!([ctx] faker_region {}).await.unwrap(); // - // tracing::info!(?game_id); + // tracing::info!(?env_id); // // let server = op!([ctx] ds_server_create { - // game_id: Some(game_id), + // env_id: Some(env_id), // cluster_id: Some(cluster_id), // datacenter_id: faker_region.region_id, // resources: Some(proto::backend::ds::ServerResources { cpu_millicores: 100, memory_mib: 200 }), @@ -212,5 +213,5 @@ async fn print_test_data(ctx: TestCtx) { // let res_text = res.text().await.unwrap(); // assert_eq!(random_body, res_text, "echoed wrong response"); // - // assert_eq!(game_res.game_id.unwrap(), server.game_id.unwrap().as_uuid()); + // assert_eq!(game_res.env_id.unwrap(), server.prod_env_id.unwrap().as_uuid()); } diff --git a/svc/pkg/ds/ops/server-get/tests/integration.rs b/svc/pkg/ds/ops/server-get/tests/integration.rs index 0d23a61268..7efddf2f1d 100644 --- a/svc/pkg/ds/ops/server-get/tests/integration.rs +++ b/svc/pkg/ds/ops/server-get/tests/integration.rs @@ -13,7 +13,7 @@ async fn server_get(ctx: TestCtx) { }) .await .unwrap(); - let game_id = game_res.game_id.unwrap(); + let env_id = game_res.prod_env_id.unwrap(); // Pick an existing cluster let cluster_id = ctx @@ -26,7 +26,7 @@ async fn server_get(ctx: TestCtx) { .to_owned(); let build_res: backend::pkg::faker::build::Response = op!([ctx] faker_build { - game_id: Some(game_id), + env_id: Some(env_id), image: backend::faker::Image::DsEcho as i32, }) .await @@ -58,7 +58,7 @@ async fn server_get(ctx: TestCtx) { .collect(); let server = op!([ctx] ds_server_create { - game_id: Some(game_id), + env_id: Some(env_id), cluster_id: Some(cluster_id.into()), datacenter_id: faker_region.region_id, resources: Some(proto::backend::ds::ServerResources { cpu_millicores: 100, memory_mib: 200 }), diff --git a/svc/pkg/ds/ops/server-list-for-env/src/lib.rs b/svc/pkg/ds/ops/server-list-for-env/src/lib.rs index a783806cdb..1dbe93a4eb 100644 --- a/svc/pkg/ds/ops/server-list-for-env/src/lib.rs +++ b/svc/pkg/ds/ops/server-list-for-env/src/lib.rs @@ -1,10 +1,10 @@ use proto::backend::pkg::*; use rivet_operation::prelude::*; -#[operation(name = "server-list-for-game")] +#[operation(name = "server-list-for-env")] async fn handle( - ctx: OperationContext, -) -> GlobalResult { + ctx: OperationContext, +) -> GlobalResult { let env_id = unwrap_ref!(ctx.env_id).as_uuid(); let server_ids = sql_fetch_all!( @@ -27,5 +27,5 @@ async fn handle( .map(|(id,)| common::Uuid::from(id)) .collect::>(); - Ok(dynamic_servers::server_list_for_game::Response { server_ids }) + Ok(dynamic_servers::server_list_for_env::Response { server_ids }) } diff --git a/svc/pkg/ds/worker/tests/common.rs b/svc/pkg/ds/worker/tests/common.rs index 26b8b28190..5a99b5d52c 100644 --- a/svc/pkg/ds/worker/tests/common.rs +++ b/svc/pkg/ds/worker/tests/common.rs @@ -27,7 +27,7 @@ // .unwrap(); // let build_res = op!([ctx] faker_build { -// game_id: game_res.game_id, +// env_id: game_res.prod_env_id, // image: backend::faker::Image::MmLobbyEcho as i32, // }) // .await @@ -39,7 +39,7 @@ // let host_port_udp = rand::thread_rng().gen_range(26000..27000); // let game_version_res = op!([ctx] faker_game_version { -// game_id: game_res.game_id, +// env_id: game_res.prod_env_id, // override_lobby_groups: Some(faker::game_version::request::OverrideLobbyGroups { // lobby_groups: vec![backend::matchmaker::LobbyGroup { // name_id: "test-1".into(), @@ -211,7 +211,7 @@ // .lobby_groups; // let ns_create_res = op!([ctx] faker_game_namespace { -// game_id: game_res.game_id, +// env_id: game_res.prod_env_id, // version_id: game_version_res.version_id, // override_name_id: "prod".to_owned(), // ..Default::default() diff --git a/svc/pkg/faker/ops/build/src/lib.rs b/svc/pkg/faker/ops/build/src/lib.rs index 62b67b6ee4..3616c63032 100644 --- a/svc/pkg/faker/ops/build/src/lib.rs +++ b/svc/pkg/faker/ops/build/src/lib.rs @@ -5,8 +5,6 @@ use rivet_operation::prelude::*; async fn handle( ctx: OperationContext, ) -> GlobalResult { - let game_id = unwrap_ref!(ctx.game_id).as_uuid(); - // Determine image name // // These are built in `bin/runtime_docker_builds/` @@ -20,7 +18,8 @@ async fn handle( }; let create_res = op!([ctx] build_create { - game_id: Some(game_id.into()), + game_id: ctx.game_id, + env_id: ctx.env_id, display_name: util::faker::display_name(), default_build_kind: Some(build_kind.into()), ..Default::default() diff --git a/svc/pkg/faker/ops/game/src/lib.rs b/svc/pkg/faker/ops/game/src/lib.rs index a042e5798f..168c39eb8a 100644 --- a/svc/pkg/faker/ops/game/src/lib.rs +++ b/svc/pkg/faker/ops/game/src/lib.rs @@ -64,6 +64,7 @@ async fn handle( Ok(faker::game::Response { game_id: game_create_res.game_id, + prod_env_id: namespace_ids.first().cloned(), namespace_ids, version_ids, }) diff --git a/svc/pkg/faker/proto/build.proto b/svc/pkg/faker/proto/build.proto index 57f8cb5f6c..8001fac1e1 100644 --- a/svc/pkg/faker/proto/build.proto +++ b/svc/pkg/faker/proto/build.proto @@ -8,6 +8,7 @@ import "google/protobuf/empty.proto"; message Request { optional rivet.common.Uuid game_id = 1; + optional rivet.common.Uuid env_id = 4; rivet.backend.faker.Image image = 2; optional string fs_path = 3; } diff --git a/svc/pkg/faker/proto/game.proto b/svc/pkg/faker/proto/game.proto index 72e3a536c8..b0d6e74a09 100644 --- a/svc/pkg/faker/proto/game.proto +++ b/svc/pkg/faker/proto/game.proto @@ -14,6 +14,9 @@ message Request { message Response { rivet.common.Uuid game_id = 1; + + // Prod env id. + rivet.common.Uuid prod_env_id = 4; // The first namespace will always be prod. repeated rivet.common.Uuid namespace_ids = 2;