the-moby-effect
Version:
Moby/Docker API client built using effect-ts
473 lines • 20.8 kB
TypeScript
import * as Config from "effect/Config";
import * as Data from "effect/Data";
import * as Effect from "effect/Effect";
import * as Path from "effect/Path";
import type * as MobyConnection from "../../MobyConnection.js";
/**
* Connection options for how to connect to your moby/docker instance. Can be a
* unix socket on the current machine. Can be an ssh connection to a remote
* machine with a remote user, remote machine, remote port, and remote socket
* path. Can be an http connection to a remote machine with a host, port, and
* path. Or it can be an https connection to a remote machine with a host, port,
* path, cert, ca, key, and passphrase.
*
* @since 1.0.0
* @category Connection Types
*/
export declare const MobyConnectionOptions: {
readonly $is: <Tag extends "http" | "https" | "socket" | "ssh">(tag: Tag) => (u: unknown) => u is Extract<{
readonly _tag: "http";
readonly host: string;
readonly port: number;
readonly path?: string | undefined;
readonly version?: string | undefined;
}, {
readonly _tag: Tag;
}> | Extract<{
readonly _tag: "https";
readonly host: string;
readonly port: number;
readonly version?: string | undefined;
readonly path?: string | undefined;
readonly cert?: string | undefined;
readonly ca?: string | undefined;
readonly key?: string | undefined;
readonly passphrase?: string | undefined;
}, {
readonly _tag: Tag;
}> | Extract<{
readonly _tag: "socket";
readonly socketPath: string;
readonly version?: string | undefined;
}, {
readonly _tag: Tag;
}> | Extract<{
readonly _tag: "ssh";
readonly port?: number;
readonly forceIPv4?: boolean;
readonly forceIPv6?: boolean;
readonly hostHash?: string;
readonly hostVerifier?: import("ssh2").HostVerifier | import("ssh2").SyncHostVerifier | import("ssh2").HostFingerprintVerifier | import("ssh2").SyncHostFingerprintVerifier;
readonly username?: string;
readonly password?: string;
readonly agent?: import("ssh2").BaseAgent | string;
readonly privateKey?: Buffer | string;
readonly passphrase?: Buffer | string;
readonly localHostname?: string;
readonly localUsername?: string;
readonly tryKeyboard?: boolean;
readonly keepaliveInterval?: number;
readonly keepaliveCountMax?: number;
readonly readyTimeout?: number;
readonly strictVendor?: boolean;
readonly sock?: import("node:stream").Readable;
readonly agentForward?: boolean;
readonly algorithms?: import("ssh2").Algorithms;
readonly debug?: import("ssh2").DebugFunction;
readonly authHandler?: import("ssh2").AuthenticationType[] | import("ssh2").AuthHandlerMiddleware | import("ssh2").AuthMethod[];
readonly localAddress?: string;
readonly localPort?: number;
readonly timeout?: number;
readonly ident?: Buffer | string;
readonly remoteSocketPath: string;
readonly host: string;
readonly version?: string | undefined;
}, {
readonly _tag: Tag;
}>;
readonly $match: {
<Cases extends { readonly [Tag in "http" | "https" | "socket" | "ssh"]: (args: Extract<{
readonly _tag: "http";
readonly host: string;
readonly port: number;
readonly path?: string | undefined;
readonly version?: string | undefined;
} | {
readonly _tag: "https";
readonly host: string;
readonly port: number;
readonly version?: string | undefined;
readonly path?: string | undefined;
readonly cert?: string | undefined;
readonly ca?: string | undefined;
readonly key?: string | undefined;
readonly passphrase?: string | undefined;
} | {
readonly _tag: "socket";
readonly socketPath: string;
readonly version?: string | undefined;
} | {
readonly _tag: "ssh";
readonly port?: number;
readonly forceIPv4?: boolean;
readonly forceIPv6?: boolean;
readonly hostHash?: string;
readonly hostVerifier?: import("ssh2").HostVerifier | import("ssh2").SyncHostVerifier | import("ssh2").HostFingerprintVerifier | import("ssh2").SyncHostFingerprintVerifier;
readonly username?: string;
readonly password?: string;
readonly agent?: import("ssh2").BaseAgent | string;
readonly privateKey?: Buffer | string;
readonly passphrase?: Buffer | string;
readonly localHostname?: string;
readonly localUsername?: string;
readonly tryKeyboard?: boolean;
readonly keepaliveInterval?: number;
readonly keepaliveCountMax?: number;
readonly readyTimeout?: number;
readonly strictVendor?: boolean;
readonly sock?: import("node:stream").Readable;
readonly agentForward?: boolean;
readonly algorithms?: import("ssh2").Algorithms;
readonly debug?: import("ssh2").DebugFunction;
readonly authHandler?: import("ssh2").AuthenticationType[] | import("ssh2").AuthHandlerMiddleware | import("ssh2").AuthMethod[];
readonly localAddress?: string;
readonly localPort?: number;
readonly timeout?: number;
readonly ident?: Buffer | string;
readonly remoteSocketPath: string;
readonly host: string;
readonly version?: string | undefined;
}, {
readonly _tag: Tag;
}>) => any; }>(cases: Cases): (value: {
readonly _tag: "http";
readonly host: string;
readonly port: number;
readonly path?: string | undefined;
readonly version?: string | undefined;
} | {
readonly _tag: "https";
readonly host: string;
readonly port: number;
readonly version?: string | undefined;
readonly path?: string | undefined;
readonly cert?: string | undefined;
readonly ca?: string | undefined;
readonly key?: string | undefined;
readonly passphrase?: string | undefined;
} | {
readonly _tag: "socket";
readonly socketPath: string;
readonly version?: string | undefined;
} | {
readonly _tag: "ssh";
readonly port?: number;
readonly forceIPv4?: boolean;
readonly forceIPv6?: boolean;
readonly hostHash?: string;
readonly hostVerifier?: import("ssh2").HostVerifier | import("ssh2").SyncHostVerifier | import("ssh2").HostFingerprintVerifier | import("ssh2").SyncHostFingerprintVerifier;
readonly username?: string;
readonly password?: string;
readonly agent?: import("ssh2").BaseAgent | string;
readonly privateKey?: Buffer | string;
readonly passphrase?: Buffer | string;
readonly localHostname?: string;
readonly localUsername?: string;
readonly tryKeyboard?: boolean;
readonly keepaliveInterval?: number;
readonly keepaliveCountMax?: number;
readonly readyTimeout?: number;
readonly strictVendor?: boolean;
readonly sock?: import("node:stream").Readable;
readonly agentForward?: boolean;
readonly algorithms?: import("ssh2").Algorithms;
readonly debug?: import("ssh2").DebugFunction;
readonly authHandler?: import("ssh2").AuthenticationType[] | import("ssh2").AuthHandlerMiddleware | import("ssh2").AuthMethod[];
readonly localAddress?: string;
readonly localPort?: number;
readonly timeout?: number;
readonly ident?: Buffer | string;
readonly remoteSocketPath: string;
readonly host: string;
readonly version?: string | undefined;
}) => import("effect/Unify").Unify<ReturnType<Cases["http" | "https" | "socket" | "ssh"]>>;
<Cases extends { readonly [Tag in "http" | "https" | "socket" | "ssh"]: (args: Extract<{
readonly _tag: "http";
readonly host: string;
readonly port: number;
readonly path?: string | undefined;
readonly version?: string | undefined;
} | {
readonly _tag: "https";
readonly host: string;
readonly port: number;
readonly version?: string | undefined;
readonly path?: string | undefined;
readonly cert?: string | undefined;
readonly ca?: string | undefined;
readonly key?: string | undefined;
readonly passphrase?: string | undefined;
} | {
readonly _tag: "socket";
readonly socketPath: string;
readonly version?: string | undefined;
} | {
readonly _tag: "ssh";
readonly port?: number;
readonly forceIPv4?: boolean;
readonly forceIPv6?: boolean;
readonly hostHash?: string;
readonly hostVerifier?: import("ssh2").HostVerifier | import("ssh2").SyncHostVerifier | import("ssh2").HostFingerprintVerifier | import("ssh2").SyncHostFingerprintVerifier;
readonly username?: string;
readonly password?: string;
readonly agent?: import("ssh2").BaseAgent | string;
readonly privateKey?: Buffer | string;
readonly passphrase?: Buffer | string;
readonly localHostname?: string;
readonly localUsername?: string;
readonly tryKeyboard?: boolean;
readonly keepaliveInterval?: number;
readonly keepaliveCountMax?: number;
readonly readyTimeout?: number;
readonly strictVendor?: boolean;
readonly sock?: import("node:stream").Readable;
readonly agentForward?: boolean;
readonly algorithms?: import("ssh2").Algorithms;
readonly debug?: import("ssh2").DebugFunction;
readonly authHandler?: import("ssh2").AuthenticationType[] | import("ssh2").AuthHandlerMiddleware | import("ssh2").AuthMethod[];
readonly localAddress?: string;
readonly localPort?: number;
readonly timeout?: number;
readonly ident?: Buffer | string;
readonly remoteSocketPath: string;
readonly host: string;
readonly version?: string | undefined;
}, {
readonly _tag: Tag;
}>) => any; }>(value: {
readonly _tag: "http";
readonly host: string;
readonly port: number;
readonly path?: string | undefined;
readonly version?: string | undefined;
} | {
readonly _tag: "https";
readonly host: string;
readonly port: number;
readonly version?: string | undefined;
readonly path?: string | undefined;
readonly cert?: string | undefined;
readonly ca?: string | undefined;
readonly key?: string | undefined;
readonly passphrase?: string | undefined;
} | {
readonly _tag: "socket";
readonly socketPath: string;
readonly version?: string | undefined;
} | {
readonly _tag: "ssh";
readonly port?: number;
readonly forceIPv4?: boolean;
readonly forceIPv6?: boolean;
readonly hostHash?: string;
readonly hostVerifier?: import("ssh2").HostVerifier | import("ssh2").SyncHostVerifier | import("ssh2").HostFingerprintVerifier | import("ssh2").SyncHostFingerprintVerifier;
readonly username?: string;
readonly password?: string;
readonly agent?: import("ssh2").BaseAgent | string;
readonly privateKey?: Buffer | string;
readonly passphrase?: Buffer | string;
readonly localHostname?: string;
readonly localUsername?: string;
readonly tryKeyboard?: boolean;
readonly keepaliveInterval?: number;
readonly keepaliveCountMax?: number;
readonly readyTimeout?: number;
readonly strictVendor?: boolean;
readonly sock?: import("node:stream").Readable;
readonly agentForward?: boolean;
readonly algorithms?: import("ssh2").Algorithms;
readonly debug?: import("ssh2").DebugFunction;
readonly authHandler?: import("ssh2").AuthenticationType[] | import("ssh2").AuthHandlerMiddleware | import("ssh2").AuthMethod[];
readonly localAddress?: string;
readonly localPort?: number;
readonly timeout?: number;
readonly ident?: Buffer | string;
readonly remoteSocketPath: string;
readonly host: string;
readonly version?: string | undefined;
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["http" | "https" | "socket" | "ssh"]>>;
};
readonly http: Data.TaggedEnum.ConstructorFrom<{
readonly _tag: "http";
readonly host: string;
readonly port: number;
readonly path?: string | undefined;
readonly version?: string | undefined;
}, "_tag">;
readonly https: Data.TaggedEnum.ConstructorFrom<{
readonly _tag: "https";
readonly host: string;
readonly port: number;
readonly version?: string | undefined;
readonly path?: string | undefined;
readonly cert?: string | undefined;
readonly ca?: string | undefined;
readonly key?: string | undefined;
readonly passphrase?: string | undefined;
}, "_tag">;
readonly socket: Data.TaggedEnum.ConstructorFrom<{
readonly _tag: "socket";
readonly socketPath: string;
readonly version?: string | undefined;
}, "_tag">;
readonly ssh: Data.TaggedEnum.ConstructorFrom<{
readonly _tag: "ssh";
readonly port?: number;
readonly forceIPv4?: boolean;
readonly forceIPv6?: boolean;
readonly hostHash?: string;
readonly hostVerifier?: import("ssh2").HostVerifier | import("ssh2").SyncHostVerifier | import("ssh2").HostFingerprintVerifier | import("ssh2").SyncHostFingerprintVerifier;
readonly username?: string;
readonly password?: string;
readonly agent?: import("ssh2").BaseAgent | string;
readonly privateKey?: Buffer | string;
readonly passphrase?: Buffer | string;
readonly localHostname?: string;
readonly localUsername?: string;
readonly tryKeyboard?: boolean;
readonly keepaliveInterval?: number;
readonly keepaliveCountMax?: number;
readonly readyTimeout?: number;
readonly strictVendor?: boolean;
readonly sock?: import("node:stream").Readable;
readonly agentForward?: boolean;
readonly algorithms?: import("ssh2").Algorithms;
readonly debug?: import("ssh2").DebugFunction;
readonly authHandler?: import("ssh2").AuthenticationType[] | import("ssh2").AuthHandlerMiddleware | import("ssh2").AuthMethod[];
readonly localAddress?: string;
readonly localPort?: number;
readonly timeout?: number;
readonly ident?: Buffer | string;
readonly remoteSocketPath: string;
readonly host: string;
readonly version?: string | undefined;
}, "_tag">;
};
/**
* @since 1.0.0
* @category Connection Constructors
*/
export declare const SocketConnectionOptions: Data.TaggedEnum.ConstructorFrom<{
readonly _tag: "socket";
readonly socketPath: string;
readonly version?: string | undefined;
}, "_tag">;
/**
* Connects to a remote machine over ssh. This specific ssh implementation uses
* the OpenSSH extension "ForwardOutLocalStream" (so you must being running an
* OpenSSH server or something that implements the "ForwardOutLocalStream"
* extension) that opens a connection to a UNIX domain socket at socketPath on
* the server.
*
* @since 1.0.0
* @category Connection Constructors
*/
export declare const SshConnectionOptions: Data.TaggedEnum.ConstructorFrom<{
readonly _tag: "ssh";
readonly port?: number;
readonly forceIPv4?: boolean;
readonly forceIPv6?: boolean;
readonly hostHash?: string;
readonly hostVerifier?: import("ssh2").HostVerifier | import("ssh2").SyncHostVerifier | import("ssh2").HostFingerprintVerifier | import("ssh2").SyncHostFingerprintVerifier;
readonly username?: string;
readonly password?: string;
readonly agent?: import("ssh2").BaseAgent | string;
readonly privateKey?: Buffer | string;
readonly passphrase?: Buffer | string;
readonly localHostname?: string;
readonly localUsername?: string;
readonly tryKeyboard?: boolean;
readonly keepaliveInterval?: number;
readonly keepaliveCountMax?: number;
readonly readyTimeout?: number;
readonly strictVendor?: boolean;
readonly sock?: import("node:stream").Readable;
readonly agentForward?: boolean;
readonly algorithms?: import("ssh2").Algorithms;
readonly debug?: import("ssh2").DebugFunction;
readonly authHandler?: import("ssh2").AuthenticationType[] | import("ssh2").AuthHandlerMiddleware | import("ssh2").AuthMethod[];
readonly localAddress?: string;
readonly localPort?: number;
readonly timeout?: number;
readonly ident?: Buffer | string;
readonly remoteSocketPath: string;
readonly host: string;
readonly version?: string | undefined;
}, "_tag">;
/**
* @since 1.0.0
* @category Connection Constructors
*/
export declare const HttpConnectionOptions: Data.TaggedEnum.ConstructorFrom<{
readonly _tag: "http";
readonly host: string;
readonly port: number;
readonly path?: string | undefined;
readonly version?: string | undefined;
}, "_tag">;
/**
* @since 1.0.0
* @category Connection Constructors
*/
export declare const HttpsConnectionOptions: Data.TaggedEnum.ConstructorFrom<{
readonly _tag: "https";
readonly host: string;
readonly port: number;
readonly version?: string | undefined;
readonly path?: string | undefined;
readonly cert?: string | undefined;
readonly ca?: string | undefined;
readonly key?: string | undefined;
readonly passphrase?: string | undefined;
}, "_tag">;
/**
* From
* https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-socket-option
*
* "The Docker client will honor the DOCKER_HOST environment variable to set the
* -H flag for the client"
*
* And then from
* https://docs.docker.com/engine/reference/commandline/dockerd/#bind-docker-to-another-hostport-or-a-unix-socket
*
* "-H accepts host and port assignment in the following format:
* `tcp://[host]:[port][path]` or `unix://path`
*
* For example:
*
* - `unix://path/to/socket` -> Unix socket located at path/to/socket
* - When -H is empty, it will default to the same value as when no -H was passed
* in
* - `http://host:port/path` -> HTTP connection on host:port and prepend path to
* all requests
* - `https://host:port/path` -> HTTPS connection on host:port and prepend path to
* all requests
* - `ssh://me@example.com:22/var/run/docker.sock` -> SSH connection to
* example.com on port 22
*
* @since 1.0.0
* @category Constructors
*/
export declare const connectionOptionsFromUrl: (dockerHost: string) => Effect.Effect<MobyConnection.MobyConnectionOptions, Config.ConfigError, never>;
/**
* Creates a MobyApi layer from the DOCKER_HOST environment variable as a url.
*
* @since 1.0.0
* @category Constructors
*/
export declare const connectionOptionsFromDockerHostEnvironmentVariable: Effect.Effect<MobyConnection.MobyConnectionOptions, Config.ConfigError, never>;
/**
* Creates a MobyApi layer from the platform default system socket location.
*
* @since 1.0.0
* @category Constructors
*/
export declare const connectionOptionsFromPlatformSystemSocketDefault: Effect.Effect<MobyConnection.MobyConnectionOptions, Config.ConfigError, never>;
/**
* Creates a MobyApi layer from the platform default system socket location.
*
* @since 1.0.0
* @category Constructors
*/
export declare const connectionOptionsFromUserSocketDefault: Effect.Effect<MobyConnection.MobyConnectionOptions, never, Path.Path>;
//# sourceMappingURL=connection.d.ts.map