import * as http from 'http';
import http__default from 'http';
import { Socket } from 'net';

type ModemDialMethod = "GET" | "POST" | "HEAD" | "PUT" | "DELETE" | "PATCH";
type ModemDialResponseResult = object | null;
type ModemDialStreamResult = http__default.IncomingMessage;
type ModemDialResult = ModemDialResponseResult | ModemDialStreamResult | Socket;
interface ModemDialOptions {
    path: string;
    method: ModemDialMethod;
    headers?: Map<string, string>;
    query?: Map<string, Array<string>>;
    body?: object | string;
    isStream?: boolean;
}
declare class Modem {
    private socketPath;
    private static version;
    private static responseStreamContentType;
    constructor(socketPath: string);
    private static responseIsStream;
    private static getResponseContentHandler;
    private static getQueryString;
    dial(options: ModemDialOptions): Promise<ModemDialResult>;
}

declare abstract class Handle {
    protected readonly modem: Modem;
    readonly id: string;
    constructor(modem: Modem, id: string);
}

interface Stackable {
    shouldThrowStackError(): boolean;
}

type WITHOUT<T extends any> = {
    [P in keyof T]?: undefined;
};
type XOR<T extends any, U extends any> = (WITHOUT<T> & U) | (WITHOUT<U> & T);
/**
 * @see https://github.com/microsoft/TypeScript/issues/14094#issuecomment-723571692
 */
type ALLXOR<T extends Array<any>> = T extends [infer Only] ? Only : T extends [infer A, infer B, ...infer Rest] ? ALLXOR<[XOR<A, B>, ...Rest]> : never;
type DockerOptions = {
    [option: string]: string;
};
type DockerLabels = {
    [label: string]: string;
};
type ObjectVersion = {
    Index: number;
};
interface SwarmBase<IDType> {
    ID: IDType;
    Version: ObjectVersion;
    CreatedAt: string;
    UpdatedAt: string;
}
type MountType = "bind" | "volume" | "tmpfs" | "npipe" | "cluster";
interface DockerResouceBase {
    NanoCPUs?: number;
    MemoryBytes?: number;
}
interface Limit extends DockerResouceBase {
    Pids?: number;
}
interface GenericResourcesSpec<ValueType> {
    Kind: string;
    Value: ValueType;
}
type NamedResourceSpec = {
    NamedResourceSpec: GenericResourcesSpec<string>;
};
type DiscreteResourceSpec = {
    DiscreteResourceSpec: GenericResourcesSpec<number>;
};
type GenericResource = XOR<NamedResourceSpec, DiscreteResourceSpec>;
interface ResourceObject extends DockerResouceBase {
    GenericResources?: Array<GenericResource>;
}
type DockerResources = {
    Limits?: Limit;
    Reservations?: ResourceObject;
};
type Platform = {
    Architecture: string;
    OS: string;
};
type Driver = {
    Name: string;
    Options?: DockerOptions;
};
type NetworkAttachementConfig = {
    Target: string;
    Aliases?: Array<string>;
    DriverOpts?: DockerOptions;
};
type PortType = "tcp" | "udp" | "sctp";
type Port = {
    IP?: string;
    PrivatePort: number;
    PublicPort?: number;
    Type: PortType;
};
type EndpointPortConfigPublishMode = "ingress" | "host";
type EndpointPortConfig = {
    Name?: string;
    Protocol: PortType;
    TargetPort: number;
    PublishedPort: number;
    PublishMode: EndpointPortConfigPublishMode;
};
type PortStatus = {
    Ports: Array<EndpointPortConfig>;
};
type EndpointSpecMode = "vip" | "dnsrr";
type EndpointSpec = {
    Mode: EndpointSpecMode;
    Ports: Array<EndpointPortConfig>;
};
type PluginPrivilege = {
    Name: string;
    Description: string;
    Value: Array<string>;
};
type MountBindOptionsPropagation = "private" | "rprivate" | "shared" | "rshared" | "slave" | "rslave";
type MountBindOptions = {
    Propagation: MountBindOptionsPropagation;
    NonRecursive: boolean;
    CreateMountpoint: boolean;
    ReadOnlyNonRecursive: boolean;
    ReadOnlyForceRecursive: boolean;
};
type MountVolumeOptionsDriverConfig = {
    Name: string;
    Options: DockerOptions;
};
type MountVolumeOptions = {
    NoCopy: boolean;
    Labels: DockerLabels;
    DriverConfig: MountVolumeOptionsDriverConfig;
};
type MountTmpfsOptions = {
    SizeBytes: number;
    Mode: number;
};
type MountConsistency = "default" | "consistent" | "cached" | "delegated";
type Mount = {
    Target: string;
    Source: string;
    Type: MountType;
    ReadOnly: boolean;
    Consistency: MountConsistency;
    BindOptions?: MountBindOptions;
    VolumeOptions?: MountVolumeOptions;
    TmpfsOptions?: MountTmpfsOptions;
};
type MountPoint = {
    Type: MountType;
    Name: string;
    Source: string;
    Destination: string;
    Driver: string;
    Mode: string;
    RW: boolean;
    Propagation: string;
};
type HealthCheckResult = {
    Start: string;
    End: string;
    ExitCode: number;
    Output: string;
};
type HealthStatus = "none" | "starting" | "healthy" | "unhealthy";
type Health = {
    Status: HealthStatus;
    FailingStreak: number;
    Log: Array<HealthCheckResult>;
};
/**
 * @see https://docs.docker.com/engine/api/v1.44/#tag/Service/operation/ServiceList
 */
type HealthConfig = {
    Test: Array<string>;
    Interval: number;
    Timeout: number;
    Retries: number;
    StartPeriod: number;
    StartInterval: number;
};
type IPAMConfigAuxiliaryAdresses = {
    [name: string]: string;
};
type IPAMConfig = {
    Subnet: string;
    IPRange: string;
    Gateway: string;
    AuxiliaryAdresses?: IPAMConfigAuxiliaryAdresses;
};
type IPAM = {
    Driver: string;
    Config: Array<IPAMConfig> | null;
    Options: DockerOptions;
};
type EndpointIPAMConfig = {
    IPv4Address: string;
    IPv6Address: string;
    LinkLocalIPs: Array<string>;
};
type EndpointSettings = {
    IPAMConfig: EndpointIPAMConfig | null;
    Links: Array<string>;
    MacAddress: string;
    Aliases: Array<string>;
    NetworkID: string;
    EndpointID: string;
    Gateway: string;
    IPAddress: string;
    IPPrefixLen: number;
    IPv6Gateway: string;
    GlobalIPv6Address: string;
    GlobalIPv6PrefixLen: number;
    DriverOpts: DockerOptions;
    DNSNames: Array<string>;
};
type Topology = {
    [name: string]: string;
};
type EngineDescriptionPlugin = {
    Type: string;
    Name: string;
};
type EngineDescription = {
    EngineVersion: string;
    Labels: DockerLabels;
    Plugins: Array<EngineDescriptionPlugin>;
};
type TLSInfo = {
    TrustRoot: string;
    CertIssuerSubject: string;
    CertIssuerPublicKey: string;
};
type RuntimeStatus = {
    [name: string]: string;
};
type Runtime = {
    path: string;
    runtimeArgs: Array<string> | null;
    status: RuntimeStatus;
};
type PeerNode = {
    NodeID: string;
    Addr: string;
};
type Isolation = "default" | "process" | "hyperv";
type Commit = {
    ID: string;
    Expected: string;
};
type BuildCacheType = "internal" | "frontend" | "source.local" | "source.git.checkout" | "exec.cachemount" | "regular";
type BuildCache = {
    ID: string;
    Parent: string | null;
    Parents: Array<string> | null;
    Type: BuildCacheType;
    Description: string;
    InUse: boolean;
    Shared: boolean;
    Size: number;
    CreatedAt: string;
    LastUsedAt: string | null;
    UsageCount: number;
};
type HostConfigBlkioWeightDevice = {
    Path: string;
    Weight: number;
};
type ThrottleDevice = {
    Path: string;
    Rate: number;
};
type DeviceMapping = {
    PathOnHost: string;
    PathInContainer: string;
    CgroupPermissions: string;
};
type DeviceRequest = {
    Driver: string;
    Count: number;
    DeviceIDs: Array<string>;
    Capabilities: Array<string>;
    Options: DockerOptions;
};
type HostConfigUlimit = {
    Name: string;
    Soft: number;
    Hard: number;
};
type LogConfigType = "json-file" | "syslog" | "journald" | "gelf" | "fluentd" | "awslogs" | "splunk" | "etwlogs" | "none";
type LogConfig = {
    Type: LogConfigType;
    Config: DockerOptions;
};
type PortBinding = {
    HostIp: string;
    HostPort: string;
};
type PortMap = {
    [name: string]: PortBinding;
};
type RestartPolicyName = "" | "no" | "always" | "unless-stopped" | "on-failure";
type RestartPolicy = {
    Name: RestartPolicyName;
    MaximumRetryCount: number;
};
type HostConfigAnnotations = {
    [name: string]: string;
};
type HostConfigCGroupNSMode = "private" | "host";
type HostConfigIpcMode = "none" | "private" | "shareable" | "host";
type HostConfigBase = {
    CpuShares: number;
    Memory: number;
    CgroupParent: string;
    BlkioWeight: number;
    BlkioWeightDevice: Array<HostConfigBlkioWeightDevice>;
    BlkioDeviceReadBps: Array<ThrottleDevice>;
    BlkioDeviceWriteBps: Array<ThrottleDevice>;
    BlkioDeviceReadIOps: Array<ThrottleDevice>;
    BlkioDeviceWriteIOps: Array<ThrottleDevice>;
    CpuPeriod: number;
    CpuQuota: number;
    CpuRealtimePeriod: number;
    CpuRealtimeRuntime: number;
    CpusetCpus: string;
    CpusetMems: string;
    Devices: Array<DeviceMapping>;
    DeviceCgroupRules: Array<string>;
    DeviceRequests: Array<DeviceRequest>;
    KernelMemoryTCP: number;
    MemoryReservation: number;
    MemorySwap: number;
    MemorySwappiness: number;
    NanoCpus: number;
    OomKillDisable: boolean;
    Init: boolean | null;
    PidsLimit: number | null;
    Ulimits: Array<HostConfigUlimit>;
    CpuCount: number;
    CpuPercent: number;
    IOMaximumIOps: number;
    IOMaximumBandwidth: number;
};
type HostConfig = HostConfigBase & {
    Binds: Array<string>;
    ContainerIDFile: string;
    LogConfig: LogConfig;
    NetworkMode: string;
    PortBindings: PortMap;
    RestartPolicy: RestartPolicy;
    AutoRemove: boolean;
    VolumeDriver: string;
    VolumesFrom: Array<string>;
    Mounts: Array<Mount>;
    ConsoleSize: Array<number> | null;
    Annotations: HostConfigAnnotations;
    CapAdd: Array<string>;
    CapDrop: Array<string>;
    CgroupnsMode: HostConfigCGroupNSMode;
    Dns: Array<string>;
    DnsOptions: Array<string>;
    DnsSearch: Array<string>;
    ExtraHosts: Array<string>;
    GroupAdd: Array<string>;
    IpcMode: HostConfigIpcMode;
    Cgroup: string;
    Links: Array<string>;
    OomScoreAdj: number;
    PidMode: string;
    Privileged: boolean;
    PublishAllPorts: boolean;
    ReadonlyRootfs: boolean;
    SecurityOpt: Array<string>;
    StorageOpt: DockerOptions;
    Tmpfs: DockerOptions;
    UTSMode: string;
    UsernsMode: string;
    ShmSize: number;
    Sysctls: DockerOptions;
    Runtime: string;
    Isolation: Isolation;
    MaskedPaths: Array<string>;
    ReadonlyPaths: Array<string>;
};
type GraphDriverData = {
    Name: string;
    Data: DockerOptions;
};
type Address = {
    Addr: string;
    PrefixLen: number;
};
type DockerEventType = "builder" | "config" | "container" | "deamon" | "image" | "network" | "node" | "plugin" | "secret" | "service" | "volume";
type DockerEventScope = "local" | "swarm";
type DockerEventActorAttributes = {
    [Name: string]: string;
};
type DockerEvent = {
    Type: DockerEventType;
    Action: string;
    Actor: {
        ID: string;
        Attributes: DockerEventActorAttributes;
    };
    scope: DockerEventScope;
    time: number;
    timeNano: number;
};

type ConfigId = string;
type ConfigSpec = {
    Name: string;
    Labels?: DockerLabels;
    Data: string;
    Templating?: Driver;
};
interface Config extends SwarmBase<ConfigId> {
    Spec: ConfigSpec;
}
declare class ConfigHandle extends Handle implements Stackable {
    inspect(): Promise<Config>;
    /**
     * @see https://docs.docker.com/engine/api/v1.44/#tag/Config/operation/ConfigUpdate
     * @param spec
     */
    update(spec: ConfigSpec): Promise<void>;
    remove(): Promise<void>;
    shouldThrowStackError(): boolean;
    static isPartOfStack(config: Config): boolean | undefined;
    static fromConfig(modem: Modem, config: Config): ConfigHandle;
}

type ConfigListFilterType = "id" | "label" | "name" | "names";
type ConfigListFilters = Map<ConfigListFilterType, Array<string>>;
type ConfigListResult = Array<Config>;
type ConfigListQueryOptions = {
    filters?: ConfigListFilters;
};
declare class Configs {
    static list(modem: Modem, queryOptions?: ConfigListQueryOptions): Promise<ConfigListResult>;
    static create(modem: Modem, spec: ConfigSpec): Promise<ConfigHandle>;
    static getHandle(modem: Modem, id: ConfigId): ConfigHandle;
}

type ContainerId = string;
type ContainerHostConfig = {
    NetworkMode?: string;
};
type ContainerSummaryNetworkSettings = {
    Networks: {
        [name: string]: EndpointSettings;
    };
};
interface ContainerBase {
    Id: ContainerId;
    Image: string;
    Mounts: Array<MountPoint>;
}
interface ContainerSummary extends ContainerBase {
    Names: Array<string>;
    ImageID: string;
    Command: string;
    Created: number;
    Ports: Array<Port>;
    SizeRw: number;
    SizeRootFs: number;
    Labels: DockerLabels;
    State: string;
    Status: string;
    HostConfig: ContainerHostConfig;
    NetworkSettings: ContainerSummaryNetworkSettings;
}
type ContainerStatus = {
    ContainerID: ContainerId;
    PID: string;
    ExitCode: number;
};
/**
 * Format: <port>/<tcp|udp|sctp>: {}
 */
type ContainerSpecExposedPorts = {
    [port: string]: object;
};
type ContainerVolumes = {
    [name: string]: object;
};
type ContainerSpecNetworkingConfig = {
    EndpointsConfig: EndpointSettings;
};
type ContainerConfig = {
    Hostname?: string;
    Domainname?: string;
    User?: string;
    AttachStdin?: boolean;
    AttachStdout?: boolean;
    AttachStderr?: boolean;
    ExposedPorts?: ContainerSpecExposedPorts;
    Tty?: boolean;
    OpenStdin?: boolean;
    StdinOnce?: boolean;
    Env?: Array<string>;
    Cmd?: Array<string>;
    Healthcheck?: HealthConfig;
    ArgsEscaped?: boolean | null;
    Image: string;
    Volumes?: ContainerVolumes;
    WorkingDir?: string;
    Entrypoint?: Array<string>;
    NetworkDisabled?: boolean | null;
    MacAddress?: string | null;
    OnBuild?: Array<string> | null;
    Labels?: DockerLabels;
    StopSignal?: string | null;
    StopTimeout?: number | null;
    Shell?: Array<string> | null;
};
type ContainerSpec = ContainerConfig & {
    HostConfig?: ContainerHostConfig;
    NetworkingConfig?: ContainerSpecNetworkingConfig;
};
type ContainerStateStatus = "created" | "running" | "paused" | "restarting" | "removing" | "exited" | "dead";
type ContainerState = {
    Status: ContainerStateStatus;
    Running: boolean;
    Paused: boolean;
    Restarting: boolean;
    OOMKilled: boolean;
    Dead: boolean;
    Pid: number;
    ExitCode: number;
    Error: string;
    StartedAt: string;
    FinishedAt: string;
    Health: Health;
};
type ContainerNetworkSettings = ContainerSummaryNetworkSettings & {
    Bridge: string;
    SandboxID: string;
    HairpinMode: boolean;
    LinkLocalIPv6Address: string;
    LinkLocalIPv6PrefixLen: number;
    Ports: PortMap;
    SandboxKey: string;
    SecondaryIPAddresses: Array<Address> | null;
    SecondaryIPv6Addresses: Array<Address> | null;
};
interface Container extends ContainerBase {
    Created: string;
    Path: string;
    Args: Array<string>;
    State: ContainerState;
    ResolvConfPath: string;
    HostnamePath: string;
    HostsPath: string;
    LogPath: string;
    Name: string;
    RestartCount: number;
    Driver: string;
    Platform: string;
    MountLabel: string;
    ProcessLabel: string;
    AppArmorProfile: string;
    ExecIds: Array<string> | null;
    HostConfig: HostConfig;
    GraphDriver: GraphDriverData;
    SizeRw: number;
    SizeRootFs: number;
    Mounts: Array<MountPoint>;
    Config: ContainerConfig;
    NetworkSettings: ContainerNetworkSettings;
}
type ContainerUpdateConfig = HostConfigBase & {
    RestartPolicy: RestartPolicy;
};
type ContainerInspectQueryOptions = {
    size?: boolean;
};
type ContainerListProcessesQueryOptions = {
    ps_args?: string;
};
type ContainerLogsQueryOptions = {
    follow?: boolean;
    stdout?: boolean;
    stderr?: boolean;
    since?: number;
    until?: number;
    timestamps?: boolean;
    tail?: "all" | number;
};
type ContainerListProcessesResult = {
    Titles: Array<string>;
    Processes: Array<Array<string>>;
};
type ContainerChangesResult = Array<{
    Path: string;
    Kind: 0 | 1 | 2;
}>;
type ContainerStatsQueryOptions = {
    stream?: boolean;
    /**
     * Has to be used with stream=false
     * Returns values immediately instead of waiting 2 cycles
     */
    oneShot?: boolean;
};
type ContainerResizeQueryOptions = {
    w: number;
    h: number;
};
type ContainerStartQueryOptions = {
    detachKeys?: string;
};
type ContainerKillQueryOptions = {
    signal?: string;
};
type ContainerStopQueryOptions = ContainerKillQueryOptions & {
    t?: number;
};
type ContainerRenameQueryOptions = {
    name: string;
};
type ContainerWaitQueryOptions = {
    condition?: "not-running" | "next-exit" | "removed";
};
type ContainerRemoveQueryOptions = {
    v?: boolean;
    force?: boolean;
    link?: boolean;
};
type ContainerUpdateResult = {
    Warnings: Array<string>;
};
declare class ContainerHandle extends Handle {
    inspect(queryOptions?: ContainerInspectQueryOptions): Promise<Container>;
    listProcesses(queryOptions?: ContainerListProcessesQueryOptions): Promise<ContainerListProcessesResult>;
    getLogs(queryOptions?: ContainerLogsQueryOptions): Promise<http.IncomingMessage>;
    changes(): Promise<ContainerChangesResult>;
    export(): Promise<http.IncomingMessage>;
    stats(queryOptions?: ContainerStatsQueryOptions): Promise<http.IncomingMessage>;
    resize(queryOptions: ContainerResizeQueryOptions): Promise<ModemDialResult>;
    start(queryOptions?: ContainerStartQueryOptions): Promise<ModemDialResult>;
    stop(queryOptions?: ContainerStopQueryOptions): Promise<ModemDialResult>;
    restart(queryOptions?: ContainerStopQueryOptions): Promise<ModemDialResult>;
    kill(queryOptions?: ContainerKillQueryOptions): Promise<ModemDialResult>;
    update(updateConfig: ContainerUpdateConfig): Promise<ContainerUpdateResult>;
    rename(queryOptions: ContainerRenameQueryOptions): Promise<ModemDialResult>;
    pause(): Promise<ModemDialResult>;
    unpause(): Promise<ModemDialResult>;
    wait(queryOptions?: ContainerWaitQueryOptions): Promise<ModemDialResult>;
    remove(queryOptions?: ContainerRemoveQueryOptions): Promise<void>;
    static fromContainer(modem: Modem, container: ContainerSummary): ContainerHandle;
}

type ContainerListFilterType = "ancestor" | "before" | "expose" | "exited" | "isolation" | "is-task" | "label" | "name" | "network" | "publish" | "since" | "status" | "volume";
type ContainerListFilters = Map<ContainerListFilterType, Array<string>>;
type ContainerPruneFilterType = "until" | "label";
type ContainerPruneFilters = Map<ContainerPruneFilterType, Array<string>>;
type ContainerListQueryOptions = {
    all?: boolean;
    limit?: number;
    size?: boolean;
    filters?: ContainerListFilters;
};
type ContainerPruneQueryOptions = {
    filters?: ContainerPruneFilters;
};
type ContainerListResult = Array<ContainerSummary>;
type ContainerPruneResult = {
    ContainersDeleted: Array<string>;
    SpaceReclaimed: number;
};
declare class Containers {
    static list(modem: Modem, queryOptions?: ContainerListQueryOptions): Promise<ContainerListResult>;
    static create(modem: Modem, spec: ContainerSpec): Promise<ContainerHandle>;
    static prune(modem: Modem, queryOptions?: ContainerPruneQueryOptions): Promise<ContainerPruneResult>;
    static getHandle(modem: Modem, id: ContainerId): ContainerHandle;
}

type ImageId = string;
type ImageConfig = ContainerConfig;
interface ImageBase {
    Id: ImageId;
    ParentId: ImageId;
    RepoTags: Array<string>;
    RepoDigests: Array<string>;
    Created: number;
    Size: number;
    VirtualSize?: number;
}
interface ImageSummary extends ImageBase {
    SharedSize: number;
    Labels: DockerLabels;
    Containers: number;
}
type ImageRootFS = {
    Type: string;
    Layers: Array<string>;
};
type ImageMetadata = {
    LastTagTime: string | null;
};
interface Image extends ImageBase {
    Comment: string;
    Container: string;
    ContainerConfig: ContainerConfig;
    DockerVersion: string;
    Author: string;
    Config: ImageConfig;
    Architecture: string;
    Variant: string;
    Os: string;
    OsVersion: string;
    GraphDriver: GraphDriverData;
    RootFS: ImageRootFS;
    Metadata: ImageMetadata;
}
type ImageLayer = {
    Id: string;
    Created: number;
    CreatedBy: string;
    Tags: Array<string>;
    Size: number;
    Comment: string;
};
type ImageHistoryResult = Array<ImageLayer>;
type ImagePushQueryOptions = {
    tag?: string;
};
type ImageTagQueryOptions = {
    repo: string;
    tag: string;
};
type ImageRemoveQueryOptions = {
    force?: boolean;
    noprune?: false;
};
declare class ImageHandle extends Handle {
    inspect(): Promise<Image>;
    history(): Promise<ImageHistoryResult>;
    push(queryOptions?: ImagePushQueryOptions, registryAuth?: string): Promise<ModemDialResult>;
    tag(queryOptions: ImageTagQueryOptions): Promise<ModemDialResult>;
    remove(queryOptions?: ImageRemoveQueryOptions): Promise<void>;
    static fromImage(modem: Modem, image: Image): ImageHandle;
}

declare class HandleLogWrapper<HandleType extends Handle> {
    private readonly handle;
    private readonly logStream?;
    private readonly logChunks;
    constructor(handle: HandleType, logStream?: ModemDialStreamResult);
    drainLogStream(): Promise<void>;
    get Handle(): HandleType;
    get LogChunks(): string[];
}

type ImageListFilterType = "before" | "dangling" | "label" | "reference" | "since" | "until";
type ImageBuildPruneFilterType = "until" | "id" | "parent" | "type" | "description" | "inuse" | "shared" | "private";
type ImageSearchFilterTypes = "is-official" | "stars";
type ImagePruneFilterType = "dangling" | "until" | "label";
type ImageListFilters = Map<ImageListFilterType, Array<string>>;
type ImageBuildPruneFilters = Map<ImageBuildPruneFilterType, Array<string>>;
type ImageSearchFilters = Map<ImageSearchFilterTypes, Array<string>>;
type ImagePruneFilters = Map<ImagePruneFilterType, Array<string>>;
type ImageListQueryOptions = {
    all?: boolean;
    filters?: ImageListFilters;
    sharedSize?: boolean;
    digests?: boolean;
};
type ImageBuildPruneQueryOptions = {
    keepStorage: number;
    all: boolean;
    filters?: ImageBuildPruneFilters;
};
type ImagePullQueryOptions = {
    fromImage: string;
    tag?: string;
    changes?: Array<string>;
    platform?: string;
};
type ImageImportQueryOptions = {
    fromSrc: string;
    repo: string;
    message?: string;
    changes?: Array<string>;
    platform?: string;
};
type ImageSearchQueryOptions = {
    term: string;
    limit: number;
    filters?: ImageSearchFilters;
};
type ImageCommitQueryOptions = {
    container?: string;
    repo: string;
    tag?: string;
    comment?: string;
    author?: string;
    pause?: boolean;
    changes?: string;
};
type ImageListResult = Array<ImageSummary>;
type ImageBuildPruneResult = {
    CachesDeleted: Array<string>;
    SpaceReclaimed: number;
};
type ImagePruneResultImageDeleted = {
    Untagged: string;
    Deleted: string;
};
type ImageSearchResult = Array<{
    description: string;
    is_official: boolean;
    name: string;
    star_count: number;
}>;
type ImagePruneResult = {
    ImagesDeleted: Array<ImagePruneResultImageDeleted>;
    SpaceReclaimed: number;
};
type ImageCommitResult = {
    Id: string;
};
declare class Images {
    static list(modem: Modem, queryOptions?: ImageListQueryOptions): Promise<ImageListResult>;
    static pruneBuilderCache(modem: Modem, queryOptions: ImageBuildPruneQueryOptions): Promise<ImageBuildPruneResult>;
    /**
     * @see https://docs.docker.com/reference/api/engine/version/v1.44/#tag/Image/operation/ImageCreate
     *
     * @param modem
     * @param queryOptions
     * @param registryAuth
     * @returns
     */
    static pull(modem: Modem, queryOptions: ImagePullQueryOptions, registryAuth?: string): Promise<HandleLogWrapper<ImageHandle>>;
    /**
     * @see https://docs.docker.com/reference/api/engine/version/v1.44/#tag/Image/operation/ImageCreate
     *
     * @param modem
     * @param queryOptions
     * @param image
     * @returns
     */
    static import(modem: Modem, queryOptions: ImageImportQueryOptions, image?: string): Promise<HandleLogWrapper<ImageHandle>>;
    static search(modem: Modem, queryOptions: ImageSearchQueryOptions): Promise<ImageSearchResult>;
    static prune(modem: Modem, filters?: ImagePruneFilters): Promise<ImagePruneResult>;
    /**
     * Creates a new image based on a container configuration
     * @param modem the modem to communicate with docker
     * @param queryOptions query specific options
     * @param containerConfig configuration of the container for the image
     */
    static commit(modem: Modem, queryOptions: ImageCommitQueryOptions, containerConfig?: ContainerConfig): Promise<ImageCommitResult>;
    static getHandle(modem: Modem, id: ImageId): ImageHandle;
}

type NetworkId = string;
type NetworkScope = "local" | "global" | "swarm";
type NetworkContainer = {
    Name: string;
    EndpointID: string;
    MacAddress: string;
    IPv4Address: string;
    IPv6Address: string;
};
type NetworkContainers = {
    [name: string]: NetworkContainer;
};
type NetworkConfigFrom = {
    Network: NetworkId;
};
interface NetworkSpec {
    Name: string;
    Driver?: string;
    EnableIPv6?: boolean;
    IPAM?: IPAM;
    Internal?: boolean;
    Attachable?: boolean;
    Ingress?: boolean;
    Options?: DockerOptions;
    Labels?: DockerLabels;
    Scope?: NetworkScope;
    ConfigOnly?: boolean;
    ConfigFrom?: NetworkConfigFrom;
}
interface Network extends NetworkSpec {
    Id: NetworkId;
    Created: string;
    Containers: NetworkContainers;
}
type NetworkInspectQueryOptions = {
    verbose?: boolean;
    scope?: NetworkScope;
};
type NetworkConnectContainerConfig = {
    Container: string;
    EndpointConfig: EndpointSettings;
};
type NetworkDisconnectContainerConfig = {
    Container: string;
    Force: boolean;
};
declare class NetworkHandle extends Handle implements Stackable {
    /**
     * @see https://docs.docker.com/engine/api/v1.44/#tag/Network/operation/NetworkInspect
     * @param queryOptions query options to use
     */
    inspect(queryOptions?: NetworkInspectQueryOptions): Promise<Network>;
    remove(): Promise<void>;
    connectContainer(connectConfig: NetworkConnectContainerConfig): Promise<ModemDialResult>;
    disconnectContainer(disconnectConfig: NetworkDisconnectContainerConfig): Promise<ModemDialResult>;
    shouldThrowStackError(): boolean;
    static isPartOfStack(network: Network): boolean | undefined;
    static fromNetwork(modem: Modem, network: Network): NetworkHandle;
}

type NetworkListFilterType = "dangling" | "driver" | "id" | "label" | "name" | "scope" | "type";
type NetworkPruneFilterType = "until" | "label";
type NetworkListFilters = Map<NetworkListFilterType, Array<string>>;
type NetworkPruneFilters = Map<NetworkPruneFilterType, Array<string>>;
type NetworkListQueryOptions = {
    filters?: NetworkListFilters;
};
type NetworkPruneQueryOptions = {
    filters?: NetworkPruneFilters;
};
type NetworkListResult = Array<Network>;
type NetworkPruneResult = {
    NetworksDeleted: Array<string>;
};
declare class Networks {
    /**
     * @see https://docs.docker.com/engine/api/v1.44/#tag/Network/operation/NetworkList
     */
    static list(modem: Modem, queryOptions?: NetworkListQueryOptions): Promise<NetworkListResult>;
    /**
     * @see https://docs.docker.com/engine/api/v1.44/#tag/Network/operation/NetworkCreate
     *
     * @param modem the modem to use
     * @param spec the spec to use to create the network
     */
    static create(modem: Modem, spec: NetworkSpec): Promise<NetworkHandle>;
    static prune(modem: Modem, queryOptions?: NetworkPruneQueryOptions): Promise<NetworkPruneResult>;
    static getHandle(modem: Modem, id: NetworkId): NetworkHandle;
}

type NodeId = string;
type NodeRole = "worker" | "manager";
type NodeAvailability = "active" | "pause" | "drain";
type NodeSpec = {
    Name: string;
    Labels?: DockerLabels;
    Role: NodeRole;
    Availability: NodeAvailability;
};
type NodeDescription = {
    Hostname: string;
    Platform: Platform;
    Resources: ResourceObject;
    Engine: EngineDescription;
    TLSInfo: TLSInfo;
};
type NodeState = "unknown" | "down" | "ready" | "disconnected";
type NodeStatus = {
    State: NodeState;
    Message: string;
    Addr: string;
};
type NodeManagerStatusReachability = "unknown" | "unreachable" | "reachable";
type NodeManagerStatus = {
    Leader: boolean;
    Reachability: NodeManagerStatusReachability;
    Addr: string;
};
interface Node extends SwarmBase<NodeId> {
    Spec: NodeSpec;
    Description: NodeDescription;
    Status: NodeStatus;
    ManagerStatus: NodeManagerStatus;
}
type NodeRemoveQueryOptions = {
    force?: boolean;
};
declare class NodeHandle extends Handle {
    inspect(): Promise<Node>;
    update(newSpec: NodeSpec): Promise<void>;
    remove(queryOptions: NodeRemoveQueryOptions): Promise<void>;
    static fromNode(modem: Modem, node: Node): NodeHandle;
}

type NodeListFilterType = "id" | "label" | "membership" | "name" | "node.label" | "role";
type NodeListFilters = Map<NodeListFilterType, Array<string>>;
type NodeListResult = Array<Node>;
type NodeListQueryOptions = {
    filters?: NodeListFilters;
};
declare class Nodes {
    static list(modem: Modem, queryOptions?: NodeListQueryOptions): Promise<NodeListResult>;
    static getHandle(modem: Modem, id: NodeId): NodeHandle;
}

type PluginId = string;
type PluginMount = {
    Name: string;
    Description: string;
    Settable: Array<string>;
    Source: string;
    Destination: string;
    Type: string;
    Options: Array<string>;
};
type PluginDevice = {
    Name: string;
    Description: string;
    Settable: Array<string>;
    Path: string;
};
type PluginSettings = {
    Mounts: Array<PluginMount>;
    Env: Array<string>;
    Args: Array<string>;
    Devices: Array<PluginDevice>;
};
type PluginInterfaceType = {
    Prefix: string;
    Capability: string;
    Version: string;
};
type PluginInterfaceProtocolScheme = "" | "moby.plugins.http/v1";
type PluginInterface = {
    Types: Array<PluginInterfaceType>;
    Socket: string;
    ProtocolScheme: PluginInterfaceProtocolScheme;
};
type PluginUser = {
    UID: number;
    GID: number;
};
type PluginNetwork = {
    Type: string;
};
type PluginLinux = {
    Capabilities: Array<string>;
    AllowAllDevices: boolean;
    Devices: Array<PluginDevice>;
};
type PluginEnv = {
    Name: string;
    Description: string;
    Settable: Array<string>;
    Value: string;
};
type PluginArgs = {
    Name: string;
    Description: string;
    Settable: Array<string>;
    Value: Array<string>;
};
type PluginRootfs = {
    type: string;
    diff_ids: Array<string>;
};
type PluginConfig = {
    Docker: string;
    Description: string;
    Documentation: string;
    Interface: PluginInterface;
    Entrypoint: Array<string>;
    WorkDir: string;
    User: PluginUser;
    Network: PluginNetwork;
    Linux: PluginLinux;
    PopagatedMount: string;
    IpcHost: boolean;
    PidHost: boolean;
    Mounts: Array<PluginMount>;
    Env: Array<PluginEnv>;
    Args: PluginArgs;
    rootfs: PluginRootfs;
};
interface Plugin {
    Id: PluginId;
    Name: string;
    Enabled: boolean;
    Settings: PluginSettings;
    PluginReference: string;
    Config: PluginConfig;
}
type PluginRemoveQueryOptions = {
    force?: boolean;
};
type PluginEnableQueryOptions = {
    timeout?: number;
};
type PluginDisableQueryOptions = {
    force?: boolean;
};
declare class PluginHandle extends Handle {
    inspect(): Promise<Plugin>;
    remove(queryOptions?: PluginRemoveQueryOptions): Promise<void>;
    enable(queryOptions?: PluginEnableQueryOptions): Promise<void>;
    disable(queryOptions?: PluginDisableQueryOptions): Promise<void>;
    static fromPlugin(modem: Modem, plugin: Plugin): PluginHandle;
}

type PluginListFilterType = "capability" | "enable";
type PluginListFilters = Map<PluginListFilterType, Array<string>>;
type PluginListResult = Array<Plugin>;
type PluginListQueryOptions = {
    filters?: PluginListFilters;
};
type PluginGetPrivilegesQueryOptions = {
    remote: string;
};
type PluginGetPrivilegesResult = Array<PluginPrivilege>;
type PluginInstallQueryOptions = PluginGetPrivilegesQueryOptions & {
    name?: string;
};
declare class Plugins {
    static list(modem: Modem, queryOptions?: PluginListQueryOptions): Promise<PluginListResult>;
    /**
     *
     * @param modem modem to use
     * @param queryOptions query options to use
     * @param registryAuth is not included in docker api docs but is required for private repos to correctly return privileges
     * @returns
     */
    static getPrivileges(modem: Modem, queryOptions: PluginGetPrivilegesQueryOptions, registryAuth?: string): Promise<PluginGetPrivilegesResult>;
    static install(modem: Modem, queryOptions: PluginInstallQueryOptions, privileges: Array<PluginPrivilege>, registryAuth?: string): Promise<HandleLogWrapper<PluginHandle>>;
    static installGrantAllPrivileges(modem: Modem, queryOptions: PluginInstallQueryOptions, registryAuth?: string): Promise<HandleLogWrapper<PluginHandle>>;
    static getHandle(modem: Modem, id: PluginId): PluginHandle;
}

type SwarmSpecOrchestration = {
    TaskHistoryRetentionLimit: number;
};
type SwarmSpecRaft = {
    SnapshotInterval: number;
    KeepOldSnapshots: number;
    LogEntriesForSlowFollowers: number;
    ElectionTick: number;
    HeartbeatTick: number;
};
type SwarmSpecDispatcher = {
    HeartbeatPeriod: number;
};
type SwamSpecCAConfigExternalCAProtocol = "cfssl";
type SwamSpecCAConfigExternalCA = {
    Protocol: SwamSpecCAConfigExternalCAProtocol;
    URL: string;
    Options: DockerOptions;
    CACert: string;
};
type SwarmSpecCAConfig = {
    NodeCertExpiry: number;
    ExternalCAs: Array<SwamSpecCAConfigExternalCA>;
    SigningCACert: string;
    SigningCAKey: string;
    ForceRotate: number;
};
type SwarmSpecEncryptionConfig = {
    AutoLockManagers: boolean;
};
type SwarmSpecTaskDefaults = {
    LogDriver: Driver;
};
type SwarmSpec = {
    Name: string;
    Labels: DockerLabels;
    Orchestration: SwarmSpecOrchestration | null;
    Raft: SwarmSpecRaft;
    Dispatcher: SwarmSpecDispatcher;
    CAConfig: SwarmSpecCAConfig;
    EncryptionConfig: SwarmSpecEncryptionConfig;
    TaskDefaults: SwarmSpecTaskDefaults;
};
interface SwarmCluster extends SwarmBase<string> {
    Spec: SwarmSpec;
    TLSInfo: TLSInfo;
    RootRotationInProgress: boolean;
    DataPathPort: number;
    DefaultAddrPool: Array<Array<string>>;
    SubnetSize: number;
}
type SwarmInitSpecBase = {
    ListenAddr: string;
    AdvertiseAddr: string;
    DataPathAddr?: string;
};
type SwarmInitSpec = SwarmInitSpecBase & {
    DataPathPort: number;
    DefaultAddrPool: Array<string>;
    ForceNewCluster: boolean;
    SubnetSize: number;
    Spec: SwarmSpec;
};
type SwarmJoinSpec = SwarmInitSpecBase & {
    RemoteAddrs: Array<string>;
    JoinToken: string;
};
type SwarmLeaveQueryOptions = {
    force?: boolean;
};
type SwarmUpdateQueryOptions = {
    rotateWorkerToken?: boolean;
    rotateManagerToken?: boolean;
    rotateManagerUnlockKey?: boolean;
};
type SwarmUnlockSpec = {
    UnlockKey: string;
};
declare class Swarm {
    static inspect(modem: Modem): Promise<SwarmCluster>;
    static initialize(modem: Modem, initSpec: SwarmInitSpec): Promise<ModemDialResult>;
    static join(modem: Modem, joinSpec: SwarmJoinSpec): Promise<ModemDialResult>;
    static leave(modem: Modem, queryOptions?: SwarmLeaveQueryOptions): Promise<ModemDialResult>;
    static update(modem: Modem, queryOptions: SwarmUpdateQueryOptions | undefined, spec: SwarmSpec): Promise<ModemDialResult>;
    static getUnlockKey(modem: Modem): Promise<ModemDialResult>;
    static unlock(modem: Modem, unlockSpec: SwarmUnlockSpec): Promise<ModemDialResult>;
}

type SecretId = string;
interface SecretSpecBase {
    Name: string;
    Labels?: DockerLabels;
    Driver?: Driver;
    Templating?: Driver;
}
interface SecretSpec extends SecretSpecBase {
    Data: string;
}
interface Secret extends SwarmBase<SecretId> {
    Spec: SecretSpecBase;
}
declare class SecretHandle extends Handle implements Stackable {
    inspect(): Promise<Secret>;
    /**
     * @see https://docs.docker.com/engine/api/v1.44/#tag/Secret/operation/SecretUpdate
     * @param spec
     */
    update(spec: SecretSpec): Promise<void>;
    remove(): Promise<void>;
    shouldThrowStackError(): boolean;
    static isPartOfStack(secret: Secret): boolean | undefined;
    static fromSecret(modem: Modem, secret: Secret): SecretHandle;
}

type SecretListFilterType = "id" | "label" | "name" | "names";
type SecretListFilters = Map<SecretListFilterType, Array<string>>;
type SecretListResult = Array<Secret>;
type SecretListQueryOptions = {
    filters?: SecretListFilters;
};
declare class Secrets {
    static list(modem: Modem, queryOptions?: SecretListQueryOptions): Promise<SecretListResult>;
    static create(modem: Modem, spec: SecretSpec): Promise<SecretHandle>;
    static getHandle(modem: Modem, id: SecretId): SecretHandle;
}

type TaskId = string;
type TaskPluginSpec = {
    Name: string;
    Remote: string;
    Disabled: boolean;
    PluginPrivileges: Array<PluginPrivilege>;
};
type TaskContainerPrivilegesCredentialSpec = {
    Config: string;
    File: string;
    Registry: string;
};
type TaskContainerPrivilegesSELinuxContext = {
    Disable: boolean;
    User: string;
    Role: string;
    Type: string;
    Level: string;
};
type TaskContainerPrivilegesSeccompMode = "default" | "unconfined" | "custom";
type TaskContainerPrivilegesSeccomp = {
    Mode: TaskContainerPrivilegesSeccompMode;
    Profile: string;
};
type TaskContainerPrivilegesAppArmorMode = "default" | "disabled";
type TaskContainerPrivilegesAppArmor = {
    Mode: TaskContainerPrivilegesAppArmorMode;
};
type TaskContainerPrivileges = {
    CredentialSpec: TaskContainerPrivilegesCredentialSpec;
    SELinuxContext: TaskContainerPrivilegesSELinuxContext;
    Seccomp: TaskContainerPrivilegesSeccomp;
    AppArmor: TaskContainerPrivilegesAppArmor;
    NoNewPrivileges: boolean;
};
type TaskContainerDNSConfig = {
    NameServers: Array<string>;
    Search: Array<string>;
    Options: Array<string>;
};
type TaskContainerFile = {
    Name: string;
    UID: string;
    GID: string;
    Mode: number;
};
type TaskContainerSecret = {
    File: TaskContainerFile;
    SecretID: string;
    SecretName: string;
};
type TaskContainerConfigFile = {
    File: TaskContainerFile;
};
type TaskContainerConfigRuntime = {
    Runtime: object;
};
type TaskContainerConfigBase = {
    ConfigID: string;
    ConfigName: string;
};
type TaskContainerConfig = XOR<TaskContainerConfigFile, TaskContainerConfigRuntime> & TaskContainerConfigBase;
type TaskContainerSysctls = {
    [name: string]: string;
};
type TaskContainerUlimit = {
    Name: string;
    Soft: number;
    Hard: number;
};
type TaskContainerSpec = {
    Image: string;
    Labels?: DockerLabels;
    Command?: Array<string>;
    Args?: Array<string>;
    Hostname?: string;
    Env?: Array<string>;
    Dir?: string;
    User?: string;
    Groups?: Array<string>;
    Privileges?: TaskContainerPrivileges;
    TTY?: boolean;
    OpenStdin?: boolean;
    ReadOnly?: boolean;
    Mounts?: Array<Mount>;
    StopSignal?: string;
    StopGracePeriod?: number;
    HealthCheck?: HealthConfig;
    Hosts?: Array<string>;
    DNSConfig?: TaskContainerDNSConfig;
    Secrets?: Array<TaskContainerSecret>;
    Configs?: Array<TaskContainerConfig>;
    Isolation?: Isolation;
    Init?: boolean | null;
    Sysctls?: TaskContainerSysctls;
    CapabilityAdd?: Array<string>;
    CapabilityDrop?: Array<string>;
    Ulimits?: Array<TaskContainerUlimit>;
};
type TaskNetworkAttachmentSpec = {
    ContainerID: ContainerId;
};
type TaskRestartPolicyCondition = "none" | "on-failure" | "any";
type TaskRestartPolicy = {
    Condition: TaskRestartPolicyCondition;
    Delay: number;
    MaxAttempts: number;
    Window: number;
};
type TaskPlacementPreferenceSpread = {
    SpreadDescriptor: string;
};
type TaskPlacementPreference = {
    Spread: TaskPlacementPreferenceSpread;
};
/**
 * @see https://docs.docker.com/engine/api/v1.44/#tag/Service/operation/ServiceList
 */
type TaskPlacement = {
    Constraints: Array<string>;
    Preferences: Array<TaskPlacementPreference>;
    MaxReplicas: number;
    Platforms: Array<Platform>;
};
type TaskSpecBase = {
    Resources?: DockerResources;
    RestartPolicy?: TaskRestartPolicy;
    Placement?: TaskPlacement;
    ForceUpdate?: number;
    Runtime?: string;
    Networks?: Array<NetworkAttachementConfig>;
    LogDriver?: Driver;
};
type PluginTaskSpec = {
    PluginSpec: TaskPluginSpec;
};
type ContainerTaskSpec = {
    ContainerSpec: TaskContainerSpec;
};
type NetworkAttachmentTaskSpec = {
    NetworkAttachmentSpec: TaskNetworkAttachmentSpec;
};
type TaskSpec = ALLXOR<[PluginTaskSpec, ContainerTaskSpec, NetworkAttachmentTaskSpec]> & TaskSpecBase;
type TaskState = "new" | "allocated" | "pending" | "assigned" | "accepted" | "preparing" | "ready" | "starting" | "running" | "complete" | "shutdown" | "failed" | "rejected" | "remove" | "orphaned";
type TaskStatus = {
    Timestamp: string;
    State: TaskState;
    Message: string;
    Err: string;
    ContainerStatus?: ContainerStatus;
    PortStatus: PortStatus;
};
interface Task extends SwarmBase<TaskId> {
    Name: string;
    Labels: DockerLabels;
    Spec: TaskSpec;
    ServiceID: ServiceId;
    Slot: number;
    NodeID: NodeId;
    AssignedGenericResources: Array<GenericResource>;
    Status: TaskStatus;
    Desired: TaskState;
    JobIteration: ObjectVersion;
}
type TaskLogsQueryOptions = {
    details?: boolean;
    follow?: boolean;
    stdout?: boolean;
    stderr?: boolean;
    since?: number;
    timestamps?: boolean;
    tail?: string | "all";
};
declare class TaskHandle extends Handle {
    inspect(): Promise<Task>;
    getLogs(queryOptions?: TaskLogsQueryOptions): Promise<http.IncomingMessage>;
    static fromTask(modem: Modem, task: Task): TaskHandle;
}

type ServiceId = string;
type ServiceModeReplicated = {
    Replicas: number;
};
type ServiceModeReplicatedJob = {
    MaxConcurrent: number;
    TotalCompletions: number;
};
type ServiceModeReplicatedWrapper = {
    Replicated: ServiceModeReplicated;
};
type ServiceModeReplicatedJobWrapper = {
    ReplicatedJob: ServiceModeReplicatedJob;
};
type ServiceModeGlobalWrapper = {
    Global: object;
};
type ServiceModeGlobalJobWrapper = {
    GlobalJob: object;
};
type ServiceMode = ALLXOR<[ServiceModeReplicatedWrapper, ServiceModeReplicatedJobWrapper, ServiceModeGlobalWrapper, ServiceModeGlobalJobWrapper]>;
type ServiceConfigOrder = "stop-first" | "start-first";
interface ServiceConfig<FailureActionType extends string> {
    Parallelism: number;
    Delay: number;
    FailureAction: FailureActionType;
    Monitor: number;
    MaxFailureRatio: number;
    Order: ServiceConfigOrder;
}
type ServiceUpdateConfigFailureAction = "continue" | "pause" | "rollback";
type ServiceRollbackConfigFailureAction = "continue" | "pause";
type ServiceSpec = {
    Name?: string;
    Labels?: DockerLabels;
    TaskTemplate: TaskSpec;
    Mode?: ServiceMode;
    UpdateConfig?: ServiceConfig<ServiceUpdateConfigFailureAction>;
    RollbackConfig?: ServiceConfig<ServiceRollbackConfigFailureAction>;
    Networks?: Array<NetworkAttachementConfig>;
    EndpointSpec?: EndpointSpec;
};
type ServiceEndpointVirtualIP = {
    NetworkID: NetworkId;
    Addr: string;
};
type ServiceEndpoint = {
    Spec: EndpointSpec;
    Ports?: Array<EndpointPortConfig>;
    VirtualIPs?: Array<ServiceEndpointVirtualIP>;
};
type ServiceUpdateStatusState = "updating" | "paused" | "completed";
type ServiceUpdateStatus = {
    State: ServiceUpdateStatusState;
    StartedAt: string;
    CompletedAt: string;
    Message: string;
};
type ServiceServiceStatus = {
    RunningTasks: number;
    DesiredTasks: number;
    CompletedTasks: number;
};
type ServiceJobStatus = {
    JobIteration: ObjectVersion;
    LastExecution: string;
};
interface Service extends SwarmBase<ServiceId> {
    Spec: ServiceSpec;
    PreviousSpec?: ServiceSpec;
    Endpoint: ServiceEndpoint;
    UpdateStatus: ServiceUpdateStatus;
    ServiceStatus: ServiceServiceStatus;
    JobStatus: ServiceJobStatus;
}
type ServiceInspectQueryOptions = {
    insertDefaults?: boolean;
};
type ServiceLogsQueryOptions = {
    details?: boolean;
    follow?: boolean;
    stdout?: boolean;
    stderr?: boolean;
    since?: number;
    timestamps?: boolean;
    tail?: number | "all";
};
type ServiceUpdateQueryOptionsRegistryAuthFrom = "spec" | "previous-spec";
type ServiceRollbackQueryOptions = {
    registryAuthFrom?: ServiceUpdateQueryOptionsRegistryAuthFrom;
};
type ServiceUpdateQueryOptions = ServiceRollbackQueryOptions & {
    rollback?: string;
};
type ServiceUpdateResult = {
    Warnings: Array<string>;
};
declare class ServiceHandle extends Handle implements Stackable {
    inspect(queryOptions?: ServiceInspectQueryOptions): Promise<Service>;
    /**
     * @see https://docs.docker.com/engine/api/v1.44/#tag/Service/operation/ServiceLogs
     *
     * @param queryOptions the query options to use
     */
    getLogs(queryOptions?: ServiceLogsQueryOptions): Promise<http.IncomingMessage>;
    /**
     * @see https://docs.docker.com/engine/api/v1.44/#tag/Service/operation/ServiceUpdate
     *
     * @param newSpec the new spec for the service
     * @param queryOptions the query options to use
     * @param registryAuth the authentication to connect to a private registry if needed
     */
    update(newSpec: ServiceSpec, queryOptions?: ServiceUpdateQueryOptions, registryAuth?: string): Promise<ServiceUpdateResult>;
    /**
     * Removes this service and creates a new one with the same spec
     * @param registryAuth
     */
    redeploy(registryAuth?: string): Promise<ServiceHandle>;
    rollback(queryOptions?: ServiceRollbackQueryOptions, registryAuth?: string): Promise<ServiceUpdateResult>;
    stop(): Promise<ServiceUpdateResult>;
    /**
     * This will start a stopped service.
     * Be careful tho, because it does a server side redeploy to the last running spec.
     * And it only does that if the service is not running
     */
    start(): Promise<ServiceUpdateResult>;
    remove(): Promise<ModemDialResult>;
    shouldThrowStackError(): boolean;
    static isPartOfStack(service: Service): boolean | undefined;
    static fromService(modem: Modem, service: Service): ServiceHandle;
}

type ServiceListFilterType = "id" | "label" | "mode" | "name";
type ServiceListFilters = Map<ServiceListFilterType, Array<string>>;
type ServiceListResult = Array<Service>;
type ServiceListQueryOptions = {
    filters?: ServiceListFilters;
    status?: boolean;
};
declare class Services {
    /**
     * @see https://docs.docker.com/engine/api/v1.44/#tag/Service/operation/ServiceList
     *
     * @param modem the modem to use
     * @param filters the filters to use
     * @param status include service status
     */
    static list(modem: Modem, queryOptions?: ServiceListQueryOptions): Promise<ServiceListResult>;
    static create(modem: Modem, spec: ServiceSpec, registryAuth?: string): Promise<ServiceHandle>;
    static getHandle(modem: Modem, id: ServiceId): ServiceHandle;
}

type DockerVolumeStatus = {
    [key: string]: string;
};
type VolumeScope = "local" | "global";
type VolumeUsageData = {
    Size: number;
    RefCount: number;
};
interface VolumeSpec {
    Name?: string;
    Driver?: string;
    DriverOpts?: DockerOptions;
    Labels?: DockerLabels;
}
interface Volume {
    Name: string;
    Driver: string;
    Mountpoint: string;
    CreatedAt: string;
    Status: DockerVolumeStatus;
    Labels: DockerLabels;
    Scope: VolumeScope;
    Options: DockerOptions;
    UsageData: VolumeUsageData | null;
}
type VolumeRemoveQueryOptions = {
    force?: boolean;
};
declare class VolumeHandle extends Handle {
    constructor(modem: Modem, name: string);
    protected inspectResult(): Promise<ModemDialResult>;
    inspect(): Promise<Volume>;
    remove(queryOptions?: VolumeRemoveQueryOptions): Promise<void>;
    protected shouldThrowStackError(): boolean;
    static isPartOfStack(volume: Volume): boolean;
    static fromVolume(modem: Modem, volume: Volume): VolumeHandle;
}

type ClusterVolumeId = string;
type ClusterVolumeAccesModeScope = "single" | "multi";
type ClusterVolumeAccesModeSharing = "none" | "readonly" | "onewriter" | "all";
type ClusterVolumeAvailability = "active" | "pause" | "drain";
type ClusterVolumeDataPublishStatusState = "pending-publish" | "published" | "pending-node-unpublish" | "pending-controller-unpublish";
type ClusterVolumeAccessModeBase = {
    Scope?: ClusterVolumeAccesModeScope;
    Sharing?: ClusterVolumeAccesModeSharing;
};
type ClusterVolumeAccessModeMountVolume = {
    MountVolume: object;
};
type ClusterVolumeAccessModeBlockVolume = {
    BlockVolume: object;
};
type ClusterVolumeAccessMode = ClusterVolumeAccessModeBase & XOR<ClusterVolumeAccessModeMountVolume, ClusterVolumeAccessModeBlockVolume>;
type ClusterVolumeSecret = {
    Key: string;
    Secret: string;
};
type ClusterVolumeAccessibilityRequirements = {
    Requisite: Array<object>;
    Preferred: Array<object>;
};
type ClusterVolumeCapacityRange = {
    RequiredBytes: number;
    LimitBytes: number;
};
type ClusterVolumeSpecBase = {
    Group?: string;
    AccessMode: ClusterVolumeAccessMode;
    Secrets?: Array<ClusterVolumeSecret>;
    AccessibilityRequirements?: ClusterVolumeAccessibilityRequirements;
    CapacityRange?: ClusterVolumeCapacityRange;
    Availability?: ClusterVolumeAvailability;
};
type ClusterVolumeDataInfo = {
    CapacityBytes: number;
    VolumeContext: object;
    VolumeID: string;
    AccessibleTopology: Array<Topology>;
};
type ClusterVolumeDataPublishStatusContext = {
    [name: string]: string;
};
type ClusterVolumeDataPublishStatus = {
    NodeID: string;
    State: ClusterVolumeDataPublishStatusState;
    PublishContext: ClusterVolumeDataPublishStatusContext;
};
interface ClusterVolumeData extends SwarmBase<ClusterVolumeId> {
    Spec: ClusterVolumeSpecBase;
    Info: ClusterVolumeDataInfo;
    PublishStatus: Array<ClusterVolumeDataPublishStatus>;
}
interface ClusterVolumeSpec extends VolumeSpec {
    ClusterVolumeSpec: ClusterVolumeSpecBase;
}
interface ClusterVolume extends Volume {
    ClusterVolume: ClusterVolumeData;
}
declare class ClusterVolumeHandle extends VolumeHandle {
    inspect(): Promise<ClusterVolume>;
    /**
     * CHECK when docker implements options to change more settings maybe update this to accept a ClusterVolumeSpec object
     */
    update(spec: ClusterVolumeSpec): Promise<void>;
    remove(): Promise<void>;
    static isPartOfStack(volume: ClusterVolume): boolean;
    static fromClusterVolume(modem: Modem, clusterVolume: ClusterVolume): ClusterVolumeHandle;
}

interface AuthCredentials {
    username: string;
    password: string;
    email: string;
    serveraddress: string;
}
type AuthResult = {
    Status: string;
    IdentityToken: string;
};
type SystemPluginsInfo = {
    Volume: Array<string>;
    Network: Array<string>;
    Authroization: Array<string>;
    Log: Array<string>;
};
type SystemCgroupDriver = "cgroupfs" | "systemd" | "none";
type SystemCgroupVersion = "1" | "2";
type SystemRegistryServiceConfigIndexConfig = {
    [name: string]: object | null;
};
type SystemRegistryServiceConfig = {
    AllowNondistributableArtifactsCIDRs: Array<string>;
    AllowNondistributableArtifactsHostnames: Array<string>;
    InsecureRegistryCIDRs: Array<string>;
    IndexConfig: SystemRegistryServiceConfigIndexConfig;
    Mirrors: Array<string>;
};
type SystemRuntimes = {
    [name: string]: Runtime;
};
type SystemSwarmInfoLocalNodeState = "" | "inactive" | "pending" | "active" | "error" | "locked";
type SystemSwarmInfo = {
    NodeID: string;
    NodeAddr: string;
    LocalNodeState: SystemSwarmInfoLocalNodeState;
    ControlAvailable: boolean;
    Error: string;
    RemoteManagers: Array<PeerNode> | null;
    Nodes: number | null;
    Managers: number | null;
    Cluster: SwarmCluster;
};
type SystemDefaultAddressPool = {
    Base: string;
    Site: number;
};
type SystemInformation = {
    ID: string;
    Containers: number;
    ContainersRunning: number;
    ContainersPaused: number;
    ContainersStopped: number;
    Images: number;
    Driver: string;
    DriverStatus: Array<Array<string>>;
    DockerRootDir: string;
    Plugins: SystemPluginsInfo;
    MemoryLimit: boolean;
    SwapLimit: boolean;
    KernelMemoryTCP: boolean;
    CpuCfsPeriod: boolean;
    CpuCfsQuota: boolean;
    CPUShares: boolean;
    CPUSet: boolean;
    PidsLimit: boolean;
    OomKillDisable: boolean;
    IPv4Forwarding: boolean;
    BridgeNfIptables: boolean;
    BridgeNfIp6tables: boolean;
    Debug: boolean;
    NFd: number;
    NGoroutines: number;
    SystemTime: string;
    LoggingDriver: string;
    CgroupDriver: SystemCgroupDriver;
    CgroupVersion: SystemCgroupVersion;
    NEventsListener: number;
    KernelVersion: string;
    OperatingSystem: string;
    OSVersion: string;
    OSType: string;
    Architecture: string;
    NCPU: number;
    MemTotal: number;
    IndexServerAddress: string;
    RegistryConfig: SystemRegistryServiceConfig;
    GenericResources: Array<GenericResource>;
    HttpProxy: string;
    HttpsProxy: string;
    NoProxy: string;
    Name: string;
    Labels: Array<string>;
    ExperimentalBuild: boolean;
    ServerVersion: string;
    Runtimes: SystemRuntimes;
    DefaultRuntime: string;
    Swarm: SystemSwarmInfo;
    LiveRestoreEnabled: boolean;
    Isolation: Isolation;
    InitBinary: string;
    ContainerdCommit: Commit;
    RuncCommit: Commit;
    InitCommit: Commit;
    SecurityOptions: Array<string>;
    ProductLicense: string;
    DefaultAddressPools: Array<SystemDefaultAddressPool>;
    Warnings: Array<string>;
    CDISpecDirs: Array<string>;
};
type SystemVersionPlatform = {
    Name: string;
};
type SystemVersionComponent = {
    Name: string;
    Version: string;
    Details: object | null;
};
interface SystemVersion {
    Platform: SystemVersionPlatform;
    Components: Array<SystemVersionComponent>;
    Version: string;
    ApiVersion: string;
    MinAPIVersion: string;
    GitCommit: string;
    GoVersion: string;
    Os: string;
    Arch: string;
    KernelVersion: string;
    Experimental: boolean;
    BuildTime: string;
}
type SystemUsageDataType = "container" | "image" | "volume" | "build-cache";
type SystemUsageDataQueryOptions = {
    type?: Array<SystemUsageDataType>;
};
type SystemMonitorEventsFilterType = "config" | "container" | "daemon" | "event" | "image" | "label" | "network" | "node" | "plugin" | "scope" | "secret" | "service" | "type" | "volume";
/**
 * Query options for minitoring events
 * @see https://docs.docker.com/reference/api/engine/version/v1.44/#tag/System/operation/SystemEvents
 */
type SystemMonitorEventsQueryOptions = {
    since?: string;
    until?: string;
    filters?: Map<SystemMonitorEventsFilterType, Array<string>>;
};
type SystemUsageData = {
    LayerSize: number;
    Images: Array<ImageSummary>;
    Containers: Array<ContainerSummary>;
    Volumes: Array<Volume | ClusterVolume>;
    BuildCache: Array<BuildCache>;
};
declare class System {
    static auth(modem: Modem, credentials: AuthCredentials): Promise<AuthResult>;
    static info(modem: Modem): Promise<SystemInformation>;
    static version(modem: Modem): Promise<SystemVersion>;
    static ping(modem: Modem): Promise<void>;
    /**
     * @see https://docs.docker.com/engine/api/v1.44/#tag/System/operation/SystemEvents
     *
     * @param modem
     * @param queryOptions
     */
    static monitorEvents(modem: Modem, queryOptions?: SystemMonitorEventsQueryOptions): Promise<http.IncomingMessage>;
    static usageData(modem: Modem, queryOptions?: SystemUsageDataQueryOptions): Promise<SystemUsageData>;
}

type TaskListFilterType = "desired-state" | "id" | "label" | "name" | "node" | "service";
type TaskListFilters = Map<TaskListFilterType, Array<string>>;
type TaskListQueryOptions = {
    filters?: TaskListFilters;
};
type TaskListResult = Array<Task>;
declare class Tasks {
    static list(modem: Modem, queryOptions?: TaskListQueryOptions): Promise<TaskListResult>;
    static getHandle(modem: Modem, id: TaskId): TaskHandle;
}

type VolumeListFilterType = "dangling" | "driver" | "label" | "name";
type VolumePruneFilterType = "label" | "all";
type VolumeListFilters = Map<VolumeListFilterType, Array<string>>;
type VolumePruneFilters = Map<VolumePruneFilterType, Array<string>>;
type VolumeListQueryOptions = {
    filters?: VolumeListFilters;
};
type VolumePruneQueryOptions = {
    filters?: VolumePruneFilters;
};
type VolumesListResult<ListType extends Volume | ClusterVolume = Volume | ClusterVolume> = {
    Volumes: Array<ListType>;
    Warnings: Array<string>;
};
type VolumePruneResult = {
    VolumesDeleted: Array<string>;
    SpaceReclaimed: number;
};
declare class Volumes {
    private static _list;
    private static _create;
    /**
     * @see https://docs.docker.com/engine/api/v1.44/#tag/Volume/operation/VolumeList
     *
     * @param modem the modem to use
     * @param filters a map of filters to use
     * @returns
     */
    static list(modem: Modem, queryOptions?: VolumeListQueryOptions): Promise<VolumesListResult<Volume>>;
    static listCluster(modem: Modem, queryOptions?: VolumeListQueryOptions): Promise<VolumesListResult<ClusterVolume>>;
    static create(modem: Modem, spec: VolumeSpec): Promise<VolumeHandle>;
    static createCluster(modem: Modem, spec: ClusterVolumeSpec): Promise<ClusterVolumeHandle>;
    static prune(modem: Modem, queryOptions?: VolumePruneQueryOptions): Promise<VolumePruneResult>;
    static getHandle(modem: Modem, name: string): VolumeHandle;
    static getClusterHandle(modem: Modem, name: string): ClusterVolumeHandle;
}

type StackServices = Array<Service>;
type StackConfigs = Array<Config>;
type StackNetworks = Array<Network>;
type StackSecrets = Array<Secret>;
type StackVolumes = Array<Volume>;
type StackClusterVolumes = Array<ClusterVolume>;
type StackSpec = {
    Name: string;
    Yaml?: string;
};
interface Stack {
    Spec: StackSpec;
    Services: StackServices;
    Networks: StackNetworks;
    Configs: StackConfigs;
    Secrets: StackSecrets;
    Volumes: StackVolumes;
    ClusterVolumes: StackClusterVolumes;
}
declare class StackHandle extends Handle {
    constructor(modem: Modem, name: string);
    inspect(): Promise<Stack>;
    remove(): Promise<void>;
}

type StackListResult = Array<Stack>;
declare class Stacks {
    static list(modem: Modem): Promise<StackListResult>;
    static create(modem: Modem, spec: StackSpec): Promise<StackHandle>;
    static getHandle(modem: Modem, name: string): StackHandle;
}

export { type ClusterVolume, type ClusterVolumeAccesModeScope, type ClusterVolumeAccesModeSharing, type ClusterVolumeAvailability, ClusterVolumeHandle, type ClusterVolumeId, type ClusterVolumeSecret, type ClusterVolumeSpec, type Config, ConfigHandle, type ConfigId, type ConfigListResult, type ConfigSpec, Configs, type Container, ContainerHandle, type ContainerId, type ContainerListResult, type ContainerSpec, type ContainerSummary, Containers, type DockerEvent, type DockerEventActorAttributes, type DockerEventScope, type DockerEventType, type DockerLabels, type DockerOptions, type Driver, type EndpointPortConfig, type GenericResource, Handle, type HealthConfig as HealthCheck, type IPAMConfig, type Image, ImageHandle, type ImageId, type ImageListResult, type ImageSummary, Images, Modem, type Mount, type Network, NetworkHandle, type NetworkId, type NetworkListResult, type NetworkSpec, Networks, type Node, NodeHandle, type NodeId, type NodeListResult, type NodeSpec, Nodes, type Platform, type Plugin, PluginHandle, type PluginId, type PluginListResult, Plugins, type Secret, SecretHandle, type SecretId, type SecretListResult, type SecretSpec, Secrets, type Service, type ServiceConfig, type ServiceEndpointVirtualIP, ServiceHandle, type ServiceId, type ServiceListResult, type ServiceSpec, Services, type Stack, StackHandle, type StackListResult, Stacks, Swarm, System, type Task, type TaskContainerConfig, type TaskContainerSecret, TaskHandle, type TaskId, type TaskListResult, type TaskPlacement, type TaskPlacementPreference, type TaskSpec, Tasks, type Volume, VolumeHandle, type VolumeSpec, Volumes, type VolumesListResult };
