Skip to content

Latest commit

 

History

History
255 lines (187 loc) · 11.5 KB

README.md

File metadata and controls

255 lines (187 loc) · 11.5 KB

DeploymentsV3

(deploymentsV3())

Overview

Operations that allow you configure and manage an application's build at runtime.

Available Operations

createDeployment

Create a new deployment. Creating a new deployment means all new rooms created will use the latest deployment configuration, but existing games in progress will not be affected.

Example Usage

package hello.world;

import dev.hathora.cloud_sdk.HathoraCloud;
import dev.hathora.cloud_sdk.models.errors.ApiError;
import dev.hathora.cloud_sdk.models.operations.CreateDeploymentResponse;
import dev.hathora.cloud_sdk.models.shared.DeploymentConfigV3;
import dev.hathora.cloud_sdk.models.shared.Security;
import dev.hathora.cloud_sdk.models.shared.TransportType;
import java.lang.Exception;
import java.util.List;

public class Application {

    public static void main(String[] args) throws ApiError, Exception {

        HathoraCloud sdk = HathoraCloud.builder()
                .security(Security.builder()
                    .hathoraDevToken("<YOUR_BEARER_TOKEN_HERE>")
                    .build())
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
            .build();

        CreateDeploymentResponse res = sdk.deploymentsV3().createDeployment()
                .deploymentConfigV3(DeploymentConfigV3.builder()
                    .buildId("bld-6d4c6a71-2d75-4b42-94e1-f312f57f33c5")
                    .containerPort(4000)
                    .env(List.of(
                    ))
                    .idleTimeoutEnabled(true)
                    .requestedCPU(0.5d)
                    .requestedMemoryMB(1024d)
                    .roomsPerProcess(3)
                    .transportType(TransportType.TCP)
                    .additionalContainerPorts(List.of(
                    ))
                    .deploymentTag("alpha")
                    .build())
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .call();

        if (res.deploymentV3().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
deploymentConfigV3 DeploymentConfigV3 ✔️ N/A
appId Optional<String> N/A app-af469a92-5b45-4565-b3c4-b79878de67d2

Response

CreateDeploymentResponse

Errors

Error Type Status Code Content Type
models/errors/ApiError 400, 401, 404, 422, 429, 500 application/json
models/errors/SDKError 4XX, 5XX */*

getDeployment

Get details for a deployment.

Example Usage

package hello.world;

import dev.hathora.cloud_sdk.HathoraCloud;
import dev.hathora.cloud_sdk.models.errors.ApiError;
import dev.hathora.cloud_sdk.models.operations.GetDeploymentResponse;
import dev.hathora.cloud_sdk.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ApiError, Exception {

        HathoraCloud sdk = HathoraCloud.builder()
                .security(Security.builder()
                    .hathoraDevToken("<YOUR_BEARER_TOKEN_HERE>")
                    .build())
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
            .build();

        GetDeploymentResponse res = sdk.deploymentsV3().getDeployment()
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .deploymentId("dep-6d4c6a71-2d75-4b42-94e1-f312f57f33c5")
                .call();

        if (res.deploymentV3().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
appId Optional<String> N/A app-af469a92-5b45-4565-b3c4-b79878de67d2
deploymentId String ✔️ N/A dep-6d4c6a71-2d75-4b42-94e1-f312f57f33c5

Response

GetDeploymentResponse

Errors

Error Type Status Code Content Type
models/errors/ApiError 401, 404, 429 application/json
models/errors/SDKError 4XX, 5XX */*

getDeployments

Returns an array of deployments for an application, optionally filtered by deploymentTag.

Example Usage

package hello.world;

import dev.hathora.cloud_sdk.HathoraCloud;
import dev.hathora.cloud_sdk.models.errors.ApiError;
import dev.hathora.cloud_sdk.models.operations.GetDeploymentsResponse;
import dev.hathora.cloud_sdk.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ApiError, Exception {

        HathoraCloud sdk = HathoraCloud.builder()
                .security(Security.builder()
                    .hathoraDevToken("<YOUR_BEARER_TOKEN_HERE>")
                    .build())
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
            .build();

        GetDeploymentsResponse res = sdk.deploymentsV3().getDeployments()
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .deploymentTag("alpha")
                .call();

        if (res.deploymentsV3Page().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
appId Optional<String> N/A app-af469a92-5b45-4565-b3c4-b79878de67d2
deploymentTag Optional<String> N/A alpha

Response

GetDeploymentsResponse

Errors

Error Type Status Code Content Type
models/errors/ApiError 401, 404, 429 application/json
models/errors/SDKError 4XX, 5XX */*

getLatestDeployment

Get the latest deployment for an application.

Example Usage

package hello.world;

import dev.hathora.cloud_sdk.HathoraCloud;
import dev.hathora.cloud_sdk.models.errors.ApiError;
import dev.hathora.cloud_sdk.models.operations.GetLatestDeploymentResponse;
import dev.hathora.cloud_sdk.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ApiError, Exception {

        HathoraCloud sdk = HathoraCloud.builder()
                .security(Security.builder()
                    .hathoraDevToken("<YOUR_BEARER_TOKEN_HERE>")
                    .build())
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
            .build();

        GetLatestDeploymentResponse res = sdk.deploymentsV3().getLatestDeployment()
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .call();

        if (res.deploymentV3().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
appId Optional<String> N/A app-af469a92-5b45-4565-b3c4-b79878de67d2

Response

GetLatestDeploymentResponse

Errors

Error Type Status Code Content Type
models/errors/ApiError 401, 404, 422, 429 application/json
models/errors/SDKError 4XX, 5XX */*