mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
Merge pull request #31268 from P4sca1/master
[dockerode] Use classes instead of interfaces where possible + fix #19437
This commit is contained in:
Vendored
+191
-55
@@ -7,6 +7,7 @@
|
||||
// Marius Meisenzahl <https://github.com/meisenzahl>
|
||||
// Rob Moran <https://github.com/thegecko>
|
||||
// Cameron Diver <https://github.com/CameronDiver>
|
||||
// Pascal Sthamer <https://github.com/p4sca1>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -15,8 +16,16 @@
|
||||
import * as stream from 'stream';
|
||||
import * as events from 'events';
|
||||
|
||||
// The modem parameter is an instance of docker-modem, which is missing type declarations.
|
||||
// https://github.com/apocas/docker-modem
|
||||
|
||||
declare namespace Dockerode {
|
||||
interface Container {
|
||||
class Container {
|
||||
constructor(modem: any, id: string);
|
||||
|
||||
modem: any;
|
||||
id: string;
|
||||
|
||||
inspect(options: {}, callback: Callback<ContainerInspectInfo>): void;
|
||||
inspect(callback: Callback<ContainerInspectInfo>): void;
|
||||
inspect(options?: {}): Promise<ContainerInspectInfo>;
|
||||
@@ -100,18 +109,20 @@ declare namespace Dockerode {
|
||||
logs(callback: Callback<NodeJS.ReadableStream>): void;
|
||||
logs(options?: ContainerLogsOptions): Promise<NodeJS.ReadableStream>;
|
||||
|
||||
stats(options: {}, callback: Callback<any>): void;
|
||||
stats(callback: Callback<any>): void;
|
||||
stats(options?: {}): Promise<any>;
|
||||
stats(options: {}, callback: Callback<ContainerStats>): void;
|
||||
stats(callback: Callback<ContainerStats>): void;
|
||||
stats(options?: {}): Promise<ContainerStats>;
|
||||
|
||||
attach(options: {}, callback: Callback<NodeJS.ReadableStream>): void;
|
||||
attach(options: {}): Promise<NodeJS.ReadableStream>;
|
||||
|
||||
modem: any;
|
||||
id?: string;
|
||||
attach(options: {}, callback: Callback<NodeJS.ReadWriteStream>): void;
|
||||
attach(options: {}): Promise<NodeJS.ReadWriteStream>;
|
||||
}
|
||||
|
||||
interface Image {
|
||||
class Image {
|
||||
constructor(modem: any, name: string);
|
||||
|
||||
modem: any;
|
||||
id: string;
|
||||
|
||||
inspect(callback: Callback<ImageInspectInfo>): void;
|
||||
inspect(): Promise<ImageInspectInfo>;
|
||||
|
||||
@@ -132,24 +143,28 @@ declare namespace Dockerode {
|
||||
remove(options: {}, callback: Callback<ImageRemoveInfo>): void;
|
||||
remove(callback: Callback<ImageRemoveInfo>): void;
|
||||
remove(options?: {}): Promise<any>;
|
||||
|
||||
modem: any;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
interface Volume {
|
||||
class Volume {
|
||||
constructor(modem: any, name: string);
|
||||
|
||||
modem: any;
|
||||
name: string;
|
||||
|
||||
inspect(callback: Callback<any>): void;
|
||||
inspect(): Promise<any>;
|
||||
|
||||
remove(options: {}, callback: Callback<any>): void;
|
||||
remove(callback: Callback<any>): void;
|
||||
remove(options?: {}): Promise<any>;
|
||||
|
||||
modem: any;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
interface Service {
|
||||
class Service {
|
||||
constructor(modem: any, id: string);
|
||||
|
||||
modem: any;
|
||||
id: string;
|
||||
|
||||
inspect(callback: Callback<any>): void;
|
||||
inspect(): Promise<any>;
|
||||
|
||||
@@ -159,20 +174,24 @@ declare namespace Dockerode {
|
||||
|
||||
update(options: {}, callback: Callback<any>): void;
|
||||
update(options: {}): Promise<any>;
|
||||
|
||||
modem: any;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
interface Task {
|
||||
class Task {
|
||||
constructor(modem: any, id: string);
|
||||
|
||||
modem: any;
|
||||
id: string;
|
||||
|
||||
inspect(callback: Callback<any>): void;
|
||||
inspect(): Promise<any>;
|
||||
|
||||
modem: any;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
interface Node {
|
||||
class Node {
|
||||
constructor(modem: any, id: string);
|
||||
|
||||
modem: any;
|
||||
id: string;
|
||||
|
||||
inspect(callback: Callback<any>): void;
|
||||
inspect(): Promise<any>;
|
||||
|
||||
@@ -183,12 +202,11 @@ declare namespace Dockerode {
|
||||
remove(options: {}, callback: Callback<any>): void;
|
||||
remove(callback: Callback<any>): void;
|
||||
remove(options?: {}): Promise<any>;
|
||||
|
||||
modem: any;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
interface Plugin {
|
||||
class Plugin {
|
||||
constructor(modem: any, name: string, remote?: any);
|
||||
|
||||
modem: any;
|
||||
name: string;
|
||||
remote: any;
|
||||
@@ -227,7 +245,12 @@ declare namespace Dockerode {
|
||||
upgrade(auth: any, options?: {}): Promise<any>;
|
||||
}
|
||||
|
||||
interface Secret {
|
||||
class Secret {
|
||||
constructor(modem: any, id: string);
|
||||
|
||||
modem: any;
|
||||
id: string;
|
||||
|
||||
inspect(callback: Callback<SecretInfo>): void;
|
||||
inspect(): Promise<SecretInfo>;
|
||||
|
||||
@@ -238,12 +261,14 @@ declare namespace Dockerode {
|
||||
remove(options: {}, callback: Callback<any>): void;
|
||||
remove(callback: Callback<any>): void;
|
||||
remove(options?: {}): Promise<any>;
|
||||
|
||||
modem: any;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
interface Network {
|
||||
class Network {
|
||||
constructor(modem: any, id: string);
|
||||
|
||||
modem: any;
|
||||
id: string;
|
||||
|
||||
inspect(callback: Callback<any>): void;
|
||||
inspect(): Promise<any>;
|
||||
|
||||
@@ -258,12 +283,14 @@ declare namespace Dockerode {
|
||||
disconnect(options: {}, callback: Callback<any>): void;
|
||||
disconnect(callback: Callback<any>): void;
|
||||
disconnect(options?: {}): Promise<any>;
|
||||
|
||||
modem: any;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
interface Exec {
|
||||
class Exec {
|
||||
constructor(modem: any, id: string);
|
||||
|
||||
modem: any;
|
||||
id: string;
|
||||
|
||||
inspect(callback: Callback<any>): void;
|
||||
inspect(): Promise<any>;
|
||||
|
||||
@@ -272,9 +299,6 @@ declare namespace Dockerode {
|
||||
|
||||
resize(options: {}, callback: Callback<any>): void;
|
||||
resize(options: {}): Promise<any>;
|
||||
|
||||
modem: any;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
interface ImageInfo {
|
||||
@@ -446,20 +470,99 @@ declare namespace Dockerode {
|
||||
GlobalIPv6Address: string;
|
||||
GlobalIPv6PrefixLen: number;
|
||||
MacAddress: string;
|
||||
}
|
||||
};
|
||||
};
|
||||
Node?: {
|
||||
ID: string;
|
||||
IP: string;
|
||||
Addr: string;
|
||||
Name: string;
|
||||
Cpus: number;
|
||||
Memory: number;
|
||||
Labels: any;
|
||||
}
|
||||
ID: string;
|
||||
IP: string;
|
||||
Addr: string;
|
||||
Name: string;
|
||||
Cpus: number;
|
||||
Memory: number;
|
||||
Labels: any;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
interface NetworkStats {
|
||||
[name: string]: {
|
||||
rx_bytes: number;
|
||||
rx_dropped: number;
|
||||
rx_errors: number;
|
||||
rx_packets: number;
|
||||
tx_bytes: number;
|
||||
tx_dropped: number;
|
||||
tx_errors: number;
|
||||
tx_packets: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface CPUStats {
|
||||
cpu_usage: {
|
||||
percpu_usage: number[];
|
||||
usage_in_usermode: number;
|
||||
total_usage: number;
|
||||
usage_in_kernelmode: number;
|
||||
};
|
||||
system_cpu_usage: number;
|
||||
online_cpus: number;
|
||||
throttling_data: {
|
||||
periods: number;
|
||||
throttled_periods: number;
|
||||
throttled_time: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface MemoryStats {
|
||||
stats: {
|
||||
total_pgmajfault: number;
|
||||
cache: number;
|
||||
mapped_file: number;
|
||||
total_inactive_file: number;
|
||||
pgpgout: number;
|
||||
rss: number;
|
||||
total_mapped_file: number;
|
||||
writeback: number;
|
||||
unevictable: number;
|
||||
pgpgin: number;
|
||||
total_unevictable: number;
|
||||
pgmajfault: number;
|
||||
total_rss: number;
|
||||
total_rss_huge: number;
|
||||
total_writeback: number;
|
||||
total_inactive_anon: number;
|
||||
rss_huge: number;
|
||||
hierarchical_memory_limit: number;
|
||||
total_pgfault: number;
|
||||
total_active_file: number;
|
||||
active_anon: number;
|
||||
total_active_anon: number;
|
||||
total_pgpgout: number;
|
||||
total_cache: number;
|
||||
inactive_anon: number;
|
||||
active_file: number;
|
||||
pgfault: number;
|
||||
inactive_file: number;
|
||||
total_pgpgin: number;
|
||||
};
|
||||
max_usage: number;
|
||||
usage: number;
|
||||
failcnt: number;
|
||||
limit: number;
|
||||
}
|
||||
|
||||
interface ContainerStats {
|
||||
read: string;
|
||||
pid_stats: {
|
||||
current: number;
|
||||
};
|
||||
networks: NetworkStats;
|
||||
memory_stats: MemoryStats;
|
||||
blkio_stats: {};
|
||||
cpu_stats: CPUStats;
|
||||
precpu_stats: CPUStats;
|
||||
}
|
||||
|
||||
interface HostConfig {
|
||||
AutoRemove: boolean;
|
||||
Binds: string[];
|
||||
@@ -652,13 +755,45 @@ declare namespace Dockerode {
|
||||
GlobalIPv6Address?: string;
|
||||
GlobalIPV6PrefixLen?: number;
|
||||
MacAddress?: string;
|
||||
DriverOpts?: {[key: string]: string};
|
||||
DriverOpts?: { [key: string]: string };
|
||||
}
|
||||
|
||||
interface EndpointsConfig {
|
||||
[key: string]: EndpointSettings;
|
||||
}
|
||||
|
||||
type MountType =
|
||||
| "bind"
|
||||
| "volume"
|
||||
| "tmpfs";
|
||||
|
||||
type MountConsistency =
|
||||
| "default"
|
||||
| "consistent"
|
||||
| "cached"
|
||||
| "delegated";
|
||||
|
||||
type MountPropagation =
|
||||
| "private"
|
||||
| "rprivate"
|
||||
| "shared"
|
||||
| "rshared"
|
||||
| "slave"
|
||||
| "rslave";
|
||||
|
||||
interface MountSettings {
|
||||
Target: string;
|
||||
Source: string;
|
||||
Type: MountType;
|
||||
ReadOnly ?: boolean;
|
||||
Consistency ?: MountConsistency;
|
||||
BindOptions ?: {
|
||||
Propagation: MountPropagation;
|
||||
};
|
||||
}
|
||||
|
||||
type MountConfig = MountSettings[];
|
||||
|
||||
interface ContainerCreateOptions {
|
||||
name?: string;
|
||||
Hostname?: string;
|
||||
@@ -715,6 +850,7 @@ declare namespace Dockerode {
|
||||
DnsSearch?: string[];
|
||||
ExtraHosts?: any;
|
||||
VolumesFrom?: string[];
|
||||
Mounts?: MountConfig;
|
||||
CapAdd?: string[];
|
||||
CapDrop?: string[];
|
||||
GroupAdd?: string[];
|
||||
@@ -894,8 +1030,8 @@ declare namespace Dockerode {
|
||||
}
|
||||
|
||||
interface ImageBuildContext {
|
||||
context: string;
|
||||
src: string[];
|
||||
context: string;
|
||||
src: string[];
|
||||
}
|
||||
|
||||
interface DockerVersion {
|
||||
@@ -906,7 +1042,7 @@ declare namespace Dockerode {
|
||||
Details: {
|
||||
ApiVersion: string;
|
||||
Arch: string;
|
||||
BuilTime: Date;
|
||||
BuildTime: Date;
|
||||
Experimental: string;
|
||||
GitCommit: string;
|
||||
GoVersion: string;
|
||||
|
||||
Reference in New Issue
Block a user