Skip to content

Latest commit

 

History

History
128 lines (92 loc) · 5.54 KB

README.md

File metadata and controls

128 lines (92 loc) · 5.54 KB

LogsV1

(logsV1())

Overview

Available Operations

downloadLogForProcess

Download entire log file for a stopped process.

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

        DownloadLogForProcessResponse res = sdk.logsV1().downloadLogForProcess()
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .processId("cbfcddd2-0006-43ae-996c-995fff7bed2e")
                .call();

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

Parameters

Parameter Type Required Description Example
appId Optional<String> N/A app-af469a92-5b45-4565-b3c4-b79878de67d2
processId String ✔️ N/A cbfcddd2-0006-43ae-996c-995fff7bed2e

Response

DownloadLogForProcessResponse

Errors

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

getLogsForProcess

Returns a stream of logs for a process using appId and processId.

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.GetLogsForProcessRequest;
import dev.hathora.cloud_sdk.models.operations.GetLogsForProcessResponse;
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();

        GetLogsForProcessRequest req = GetLogsForProcessRequest.builder()
                .processId("cbfcddd2-0006-43ae-996c-995fff7bed2e")
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .tailLines(100)
                .build();

        GetLogsForProcessResponse res = sdk.logsV1().getLogsForProcess()
                .request(req)
                .call();

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

Parameters

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

Response

GetLogsForProcessResponse

Errors

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