Skip to content

Latest commit

 

History

History
254 lines (184 loc) · 10.8 KB

README.md

File metadata and controls

254 lines (184 loc) · 10.8 KB

FleetsV1

(fleetsV1())

Overview

Operations to manage and view a fleet.

Available Operations

getFleetMetrics

Gets metrics for a fleet in a region.

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.GetFleetMetricsRequest;
import dev.hathora.cloud_sdk.models.operations.GetFleetMetricsResponse;
import dev.hathora.cloud_sdk.models.shared.Region;
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();

        GetFleetMetricsRequest req = GetFleetMetricsRequest.builder()
                .fleetId("<id>")
                .region(Region.LONDON)
                .build();

        GetFleetMetricsResponse res = sdk.fleetsV1().getFleetMetrics()
                .request(req)
                .call();

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

Parameters

Parameter Type Required Description
request GetFleetMetricsRequest ✔️ The request object to use for the request.

Response

GetFleetMetricsResponse

Errors

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

getFleetRegion

Gets the configuration for a given fleet in a region.

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.GetFleetRegionResponse;
import dev.hathora.cloud_sdk.models.shared.Region;
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();

        GetFleetRegionResponse res = sdk.fleetsV1().getFleetRegion()
                .fleetId("<id>")
                .orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
                .region(Region.SAO_PAULO)
                .call();

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

Parameters

Parameter Type Required Description Example
fleetId String ✔️ N/A
orgId Optional<String> N/A org-6f706e83-0ec1-437a-9a46-7d4281eb2f39
region Region ✔️ N/A

Response

GetFleetRegionResponse

Errors

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

getFleets

Returns an array of fleets.

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.GetFleetsResponse;
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();

        GetFleetsResponse res = sdk.fleetsV1().getFleets()
                .orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
                .call();

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

Parameters

Parameter Type Required Description Example
orgId Optional<String> N/A org-6f706e83-0ec1-437a-9a46-7d4281eb2f39

Response

GetFleetsResponse

Errors

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

updateFleetRegion

Updates the configuration for a given fleet in a region.

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.UpdateFleetRegionRequest;
import dev.hathora.cloud_sdk.models.operations.UpdateFleetRegionResponse;
import dev.hathora.cloud_sdk.models.shared.FleetRegionConfig;
import dev.hathora.cloud_sdk.models.shared.Region;
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();

        UpdateFleetRegionRequest req = UpdateFleetRegionRequest.builder()
                .fleetRegionConfig(FleetRegionConfig.builder()
                    .cloudMinVcpus(511402)
                    .build())
                .fleetId("<id>")
                .region(Region.SINGAPORE)
                .build();

        UpdateFleetRegionResponse res = sdk.fleetsV1().updateFleetRegion()
                .request(req)
                .call();

        // handle response
    }
}

Parameters

Parameter Type Required Description
request UpdateFleetRegionRequest ✔️ The request object to use for the request.

Response

UpdateFleetRegionResponse

Errors

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