@nasriya/orchestriq
Version:
A package to generate Docker files
76 lines (75 loc) • 2.52 kB
TypeScript
export type DockerOptions = LocalDockerOptions | NetworkDockerOptions | RemoteDockerOptions;
export type SocketConfig = Required<LocalDockerOptions> & {
url: URL;
} | ExternalDockerConfig & {
headers: Record<string, string>;
};
export interface ExternalDockerConfig extends Omit<ExternalDockerOptions, 'host' | 'protocol'> {
hostType: 'remote' | 'network';
url: URL;
}
export interface BaseDockerOptions {
hostType: 'local' | 'remote' | 'network';
/**Define the port to connect to. Defaults to `2375` for `local` daemons and nothing for remote daemons. */
port?: number;
}
export interface LocalDockerOptions extends Omit<BaseDockerOptions, 'port'> {
hostType: 'local';
/**Specify the socket path. Defaults to `/var/run/docker.sock` for Linux and `//./pipe/docker_engine` for Windows */
socketPath?: string;
}
export interface ExternalDockerOptions extends BaseDockerOptions {
/**Define the host to connect to. */
host: string;
/**
* Define the authentication to use when connecting to the Docker daemon.
* If not provided, no authentication will be used.
* @default 'none'
*/
authentication?: RemoteAuth | 'none';
/**
* The credentials to use when connecting to the Docker daemon.
* They're used in the request URL.
*/
credentials?: Omit<BasicAuth, 'type'>;
}
export interface NetworkDockerOptions extends ExternalDockerOptions {
hostType: 'network';
/**Enforce a protocol. Defaults to `tcp`. */
protocol?: 'http' | 'https' | 'tcp';
}
export interface RemoteDockerOptions extends ExternalDockerOptions {
hostType: 'remote';
/**The protocol to use. Defaults to `https`. */
protocol?: 'https';
/**Specify the authentication to use when connecting to the Docker daemon. */
authentication?: RemoteAuth;
}
export interface BasicAuth extends SocketAuth {
type: 'Basic';
username: string;
password: string;
}
export interface BearerAuth extends SocketAuth {
type: 'Bearer';
token: string;
}
export interface SocketAuth {
/**The socket authorization type */
type: 'Basic' | 'Bearer' | 'none';
}
export type RemoteAuth = BasicAuth | BearerAuth;
export interface Volume {
Name: string;
Driver: string;
Mountpoint: string;
CreatedAt: string;
Status?: Record<string, any>;
Labels?: Record<string, string>;
Scope: 'local' | 'global';
Options?: Record<string, string>;
UsageData?: {
Size: number;
RefCount: number;
};
}