@spheron/protocol-sdk
Version:
Spheron Protocol SDK
129 lines • 3.22 kB
TypeScript
export type ServiceExposeHttpOptions = {
maxBodySize: number;
readTimeout: number;
sendTimeout: number;
nextTries: number;
nextTimeout: number;
nextCases: string[];
};
export type Hosts = string[] | null;
export type ServiceExpose = {
port: number;
portRange: string | number;
portRangeAs: string | number;
usePublicPort: boolean;
externalPort: number;
proto: string;
service: string;
global: boolean;
hosts: Hosts;
httpOptions: ServiceExposeHttpOptions;
ip: string;
endpointSequenceNumber: number;
};
export type ExposeTo = {
service?: string;
global?: boolean;
http_options: HTTPOptions;
ip: string;
};
export type HTTPOptions = {
max_body_size: number;
read_timeout: number;
send_timeout: number;
next_tries: number;
next_timeout: number;
next_cases: string[];
};
export type Accept = string[] | null;
export type Expose = {
port: number;
as: number;
port_range: number | string;
port_range_as: number | string;
use_public_port: boolean;
proto?: string;
to?: ExposeTo[];
accept: Accept;
http_options: HTTPOptions;
};
export type Dependency = {
service: string;
};
export type ServiceStorageParams = {
name: string;
mount: string;
readOnly: boolean;
};
export type ServiceParams = {
storage?: Record<string, ServiceStorageParams>;
};
export type ServiceParamsManifest = {
storage?: ServiceStorageParams[];
};
export type ServiceImageCredentials = {
host: string;
email?: string;
username: string;
password: string;
};
export interface Service {
image: string;
pull_policy?: string;
command: string[] | null;
args: string[] | null;
env: string[] | null;
expose: Expose[];
dependencies?: Dependency[];
params?: ServiceParams | null;
credentials?: ServiceImageCredentials;
}
export type ICL = {
services: Record<string, Service>;
};
export interface AttributesManifest {
key: string;
value: string;
}
export interface ServiceManifest extends Omit<Service, 'expose' | 'params'> {
name: string;
resources: {
cpu: {
units: {
val: string;
};
};
memory: {
size: {
val: string;
};
};
storage: {
size: {
val: string;
};
attributes?: AttributesManifest[];
} | {
size: {
val: string;
};
attributes?: AttributesManifest[];
}[];
gpu?: {
units: {
val: string;
};
attributes: AttributesManifest[];
};
};
count: number | undefined;
expose: ServiceExpose[];
params: ServiceParamsManifest | null;
}
export declare const getServiceParams: (params: ServiceParams | undefined) => ServiceParamsManifest | null;
export declare function manifestExpose(service: Service, icl: ICL): ServiceExpose[];
export declare function serviceResourceEndpoints(service: Service, icl: ICL): {
kind: number;
sequence_number: number;
}[];
//# sourceMappingURL=manifest-utils.d.ts.map