UNPKG

sesterce-cli

Version:

A powerful command-line interface tool for managing Sesterce Cloud services. Sesterce CLI provides easy access to GPU cloud instances, AI inference services, container registries, and SSH key management directly from your terminal.

41 lines 1.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LaunchInstance = void 0; const either_1 = require("@/core/logic/either"); const launch_instance_error_1 = require("./errors/launch-instance-error"); class LaunchInstance { constructor(apiClient) { this.apiClient = apiClient; } async execute({ name, cloudProvider, instanceId, volumeId, region, os, dockerImage, sshKeyId, }) { try { const response = await this.apiClient.request("/gpu-cloud/instances", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name, cloudProvider, instanceId, volumeId, region, vm: { os }, dockerContainer: dockerImage ? { image: `${dockerImage.image}:${dockerImage.tag}`, } : null, sshKeyId, }), }); if (!response) { return (0, either_1.left)(new launch_instance_error_1.LaunchInstanceError("Instance not created")); } return (0, either_1.right)(response); } catch (error) { return (0, either_1.left)(new launch_instance_error_1.LaunchInstanceError(error instanceof Error ? error.message : "Unexpected error occurred.")); } } } exports.LaunchInstance = LaunchInstance; //# sourceMappingURL=launch-instance.js.map