Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "porter-sandbox",
"version": "0.1.26",
"version": "0.1.32",
"description": "TypeScript SDK for the Porter Sandbox API",
"license": "Apache-2.0",
"author": "Porter <support@porter.run>",
Expand Down
44 changes: 43 additions & 1 deletion src/_models.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Generated by oagen. DO NOT EDIT.


import type { FilterValuesResponsePhases, LogLineLevel, StatusResponsePhase, VolumePhase } from './enums.js';
import type { FilterValuesResponsePhases, LogLineLevel, SandboxDomainSpecVisibility, StatusResponsePhase, VolumePhase } from './enums.js';

export interface CountPoint {
/** Start of the bucket. */
Expand Down Expand Up @@ -115,6 +115,38 @@ export interface ReadinessResponse {
active_sandboxes: number;
}

export interface SandboxDomainSpec {
/**
* Fully qualified hostname for the sandbox, one label under the
* target ingress's domain. Unlike name it need not be unique, so
* successive sandboxes can reuse one hostname (only one may be live
* at a time). Defaults to <name>.<ingress domain>, then
* <id>.<ingress domain>, when omitted.
*/
domain?: string;
/**
* Which sandbox ingress serves the domain when the cluster has both a
* public and a private one. Omit to default to whichever is
* configured, public winning. Rejected when the sandbox exposes a
* port but the requested ingress is not configured on the cluster.
*/
visibility?: SandboxDomainSpecVisibility;
}

export interface SandboxNetworkingSpec {
/**
* Port the workload listens on; the per-sandbox Service targets it on
* the pod. Privileged ports (1-1023) are not allowed.
*/
port: number;
/**
* Domains the port is served on through a sandbox ingress. Omit to
* serve the port at the default hostname through the default ingress.
* Currently only one entry is supported.
*/
domains?: SandboxDomainSpec[];
}

export interface SandboxSpec {
/** Container image to run */
image: string;
Expand All @@ -137,6 +169,11 @@ export interface SandboxSpec {
* sandbox; values are volume IDs.
*/
volume_mounts?: Record<string, string>;
/**
* Network exposure for the sandbox. Omit to expose nothing. Currently
* only one entry is supported.
*/
networking?: SandboxNetworkingSpec[];
}

export interface StatusResponse {
Expand All @@ -156,6 +193,11 @@ export interface StatusResponse {
created_at: string;
/** When the sandbox pod started running */
started_at?: string | null;
/**
* Public hostname the sandbox is reachable at. Empty when the sandbox
* exposes no port or the cluster has no sandbox ingress configured.
*/
host: string;
/** Volumes the sandbox mounts, keyed by mount path */
volume_mounts?: Record<string, string>;
/** Where a client addresses an interactive exec into the running sandbox. Absent until the sandbox has a pod. */
Expand Down
6 changes: 6 additions & 0 deletions src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ export const LogLineLevel = {
} as const;
export type LogLineLevel = typeof LogLineLevel[keyof typeof LogLineLevel];

export const SandboxDomainSpecVisibility = {
Public: "public",
Private: "private",
} as const;
export type SandboxDomainSpecVisibility = typeof SandboxDomainSpecVisibility[keyof typeof SandboxDomainSpecVisibility];

export const SandboxesPhase = {
Queued: "queued",
Creating: "creating",
Expand Down
16 changes: 15 additions & 1 deletion tests/models.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


import { describe, expect, it } from 'vitest';
import type { CountPoint, CountResponse, CreateResponse, Error, ExecRequest, ExecResponse, ExecTarget, FilterValuesResponse, HealthResponse, LogsResponse, LookupResult, Pagination, ReadinessResponse, SandboxSpec, VolumeListResponse, VolumeSpec } from '../src/_models.js';
import type { CountPoint, CountResponse, CreateResponse, Error, ExecRequest, ExecResponse, ExecTarget, FilterValuesResponse, HealthResponse, LogsResponse, LookupResult, Pagination, ReadinessResponse, SandboxDomainSpec, SandboxNetworkingSpec, SandboxSpec, VolumeListResponse, VolumeSpec } from '../src/_models.js';

describe('model round trip', () => {
it('accepts a structurally valid CountPoint', () => {
Expand Down Expand Up @@ -122,6 +122,20 @@ describe('model round trip', () => {
expect(roundTripped).toEqual(value);
});

it('accepts a structurally valid SandboxDomainSpec', () => {
const value: SandboxDomainSpec = {};
const roundTripped = JSON.parse(JSON.stringify(value)) as SandboxDomainSpec;
expect(roundTripped).toEqual(value);
});

it('accepts a structurally valid SandboxNetworkingSpec', () => {
const value: SandboxNetworkingSpec = {
port: 1,
};
const roundTripped = JSON.parse(JSON.stringify(value)) as SandboxNetworkingSpec;
expect(roundTripped).toEqual(value);
});

it('accepts a structurally valid SandboxSpec', () => {
const value: SandboxSpec = {
image: 'x',
Expand Down
Loading