Skip to content

Commit f6315d1

Browse files
authored
Merge pull request #16 from yepcode/feature/YEP-3128
YEP-3128 Allow creating sandboxes
2 parents 8c5cc1c + 4e785ae commit f6315d1

2 files changed

Lines changed: 43 additions & 1 deletion

File tree

src/api/types.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export interface DependenciesConfigInput {
4343
autoDetect?: boolean;
4444
}
4545
export interface ExecuteProcessInput {
46-
parameters?: Record<string, any>,
46+
parameters?: Record<string, any>;
4747
tag?: string;
4848
comment?: string;
4949
settings?: ExecuteProcessSettingsInput;
@@ -416,6 +416,33 @@ export interface VersionedModuleAliasesPaginatedResult {
416416
data?: VersionedModuleAlias[];
417417
}
418418

419+
/**
420+
* Sandboxes
421+
*/
422+
export interface CreateSandboxInput {
423+
imageId: string;
424+
name?: string;
425+
metadata?: Record<string, string>;
426+
timeout?: number;
427+
publicHttpPorts?: number[];
428+
publicHttpPortsBasicAuth?: string;
429+
}
430+
431+
export interface Sandbox {
432+
id: string;
433+
name: string;
434+
grpcServerUrl?: string;
435+
grpcApiKey?: string;
436+
imageId: string;
437+
publicHttpPorts?: number[];
438+
metadata?: Record<string, string>;
439+
timeoutAt: string;
440+
}
441+
442+
export interface UpdateSandboxInput {
443+
timeout: number;
444+
}
445+
419446
/**
420447
* Storage
421448
*/

src/api/yepcodeApi.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ import {
3838
ServiceAccountInput,
3939
ServiceAccount,
4040
ServiceAccountsListResult,
41+
Sandbox,
42+
CreateSandboxInput,
43+
UpdateSandboxInput,
4144
} from "./types";
4245
import { Readable } from "stream";
4346

@@ -622,6 +625,18 @@ export class YepCodeApi {
622625
return this.request("DELETE", `/variables/${id}`);
623626
}
624627

628+
async createSandbox(data: CreateSandboxInput): Promise<Sandbox> {
629+
return this.request("POST", "/sandboxes", { data });
630+
}
631+
632+
async updateSandbox(id: string, data: UpdateSandboxInput): Promise<Sandbox> {
633+
return this.request("POST", `/sandboxes/${id}`, { data });
634+
}
635+
636+
async killSandbox(id: string): Promise<Sandbox> {
637+
return this.request("POST", `/sandboxes/${id}/kill`, {});
638+
}
639+
625640
async getModules(
626641
params: {
627642
keywords?: string;

0 commit comments

Comments
 (0)