diff --git a/types/dockerode/dockerode-tests.ts b/types/dockerode/dockerode-tests.ts index b010b68fe0..4b4e406839 100644 --- a/types/dockerode/dockerode-tests.ts +++ b/types/dockerode/dockerode-tests.ts @@ -56,3 +56,69 @@ docker.createContainer({ Tty: true }, (err, container) => { // NOOP }); }); + +docker.pruneContainers((err, response) => { + // NOOP +}); + +docker.pruneImages((err, response) => { + // NOOP +}); + +docker.pruneNetworks((err, response) => { + // NOOP +}); + +docker.pruneVolumes((err, response) => { + // NOOP +}); + +const plugin = docker.getPlugin('pluginName', 'remoteName'); +plugin.configure((err, response) => { + // NOOP; +}); + +plugin.disable((err, response) => { + // NOOP +}); + +plugin.enable((err, response) => { + // NOOP +}); + +plugin.inspect((err, response) => { + // NOOP +}); + +plugin.privileges((err, response) => { + // NOOP +}); + +plugin.pull({}, (err, response) => { + // NOOP +}); + +plugin.push((err, response) => { + // NOOP +}); + +plugin.remove((err, response) => { + // NOOP +}); + +plugin.upgrade({}, (err, response) => { + // NOOP +}); + +const secret = docker.getSecret('secretName'); +secret.inspect((err, response) => { + // NOOP +}); + +secret.remove((err, response) => { + // NOOP +}); + +secret.update((err, response) => { + // NOOP +}); diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index e35cd8b466..2e834f0b3b 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for dockerode 2.3 +// Type definitions for dockerode 2.4 // Project: https://github.com/apocas/dockerode -// Definitions by: Carl Winkler +// Definitions by: Carl Winkler , Nicolas Laplante // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -93,8 +93,8 @@ declare namespace Dockerode { tag(options: {}, callback: Callback): void; tag(callback: Callback): void; - remove(options: {}, callback: Callback): void; - remove(callback: Callback): void; + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; modem: any; id?: string; @@ -136,6 +136,49 @@ declare namespace Dockerode { id?: string; } + interface Plugin { + modem: any; + name: string; + remote: any; + + inspect(callback: Callback): void; + + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; + + privileges(callback: Callback): void; + + pull(options: {}, callback: Callback): void; + + enable(options: {}, callback: Callback): void; + enable(callback: Callback): void; + + disable(options: {}, callback: Callback): void; + disable(callback: Callback): void; + + push(options: {}, callback: Callback): void; + push(callback: Callback): void; + + configure(options: {}, callback: Callback): void; + configure(callback: Callback): void; + + upgrade(auth: any, options: {}, callback: Callback): void; + upgrade(auth: any, callback: Callback): void; + } + + interface Secret { + inspect(callback: Callback): void; + + update(options: {}, callback: Callback): void; + update(callback: Callback): void; + + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; + + modem: any; + id?: string; + } + interface Network { inspect(callback: Callback): void; @@ -545,6 +588,137 @@ declare namespace Dockerode { protocol?: "https" | "http"; timeout?: number; } + + interface SecretVersion { + Index: number; + } + + interface ServiceSpec { + Name: string; + } + + interface SecretInfo { + ID: string; + Version: SecretVersion; + CreatedAt: string; + UpdatedAt?: string; + Spec?: ServiceSpec; + } + + interface PluginInfo { + Id?: string; + Name: string; + Enabled: boolean; + Settings: PluginSettings; + PluginReference?: string; + Config: PluginConfig; + } + + type PluginInspectInfo = PluginInfo; + + interface PluginSettings { + Mounts: PluginMount[]; + Env: string[]; + Args: string[]; + Devices: PluginDevice[]; + } + + interface PluginConfig { + Description: string; + Documentation: string; + Interface: any; + Entrypoint: string[]; + WorkDir: string; + User?: User; + Network: Network; + Linux: Linux; + PropagatedMount: string; + Mounts: PluginMount[]; + Env: PluginEnv[]; + Args: Args; + rootfs: any; + } + + interface Interface { + Types: PluginInterfaceType[]; + Socket: string; + } + + interface PluginInterfaceType { + Prefix: string; + Capability: string; + Version: string; + } + + interface PluginMount { + Name: string; + Description: string; + Settable: string[]; + Source: string; + Destination: string; + Type: string; + Options: string[]; + } + + interface Linux { + Capabilities: string[]; + AllowAllDevices: boolean; + Devices: PluginDevice[]; + } + + interface PluginDevice { + Name: string; + Description: string; + Settable: string[]; + Path: string; + } + + interface Network { + Type: string; + } + + interface PluginEnv { + Name: string; + Description: string; + Settable: string[]; + Value: string; + } + + interface Args { + Name: string; + Description: string; + Settable: string[]; + Value: string; + } + + interface User { + UID: number; + GID: number; + } + + interface ImageRemoveInfo { + Untagged: string; + Deleted: string; + } + + interface PruneImagesInfo { + ImagesDeleted: ImageRemoveInfo[]; + SpaceReclaimed: number; + } + + interface PruneVolumesInfo { + VolumesDeleted: string[]; + SpaceReclaimed: number; + } + + interface PruneContainersInfo { + ContainersDeleted: string[]; + SpaceReclaimed: number; + } + + interface PruneNetworksInfo { + NetworksDeleted: string[]; + } } type Callback = (error?: any, result?: T) => void; @@ -574,6 +748,8 @@ declare class Dockerode { getVolume(name: string): Dockerode.Volume; + getPlugin(name: string, remote: any): Dockerode.Plugin; + getService(id: string): Dockerode.Service; getTask(id: string): Dockerode.Task; @@ -582,6 +758,8 @@ declare class Dockerode { getNetwork(id: string): Dockerode.Network; + getSecret(id: string): Dockerode.Secret; + getExec(id: string): Dockerode.Exec; listContainers(options: {}, callback: Callback): void; @@ -599,12 +777,22 @@ declare class Dockerode { listTasks(options: {}, callback: Callback): void; listTasks(callback: Callback): void; + listSecrets(options: {}, callback: Callback): void; + listSecrets(callback: Callback): void; + + listPlugins(options: {}, callback: Callback): void; + listPlugins(callback: Callback): void; + listVolumes(options: {}, callback: Callback): void; listVolumes(callback: Callback): void; listNetworks(options: {}, callback: Callback): void; listNetworks(callback: Callback): void; + createSecret(options: {}, callback: Callback): void; + + createPlugin(options: {}, callback: Callback): void; + createVolume(options: {}, callback: Callback): void; createService(options: {}, callback: Callback): void; @@ -613,6 +801,18 @@ declare class Dockerode { searchImages(options: {}, callback: Callback): void; + pruneImages(options: {}, callback: Callback): void; + pruneImages(callback: Callback): void; + + pruneContainers(options: {}, callback: Callback): void; + pruneContainers(callback: Callback): void; + + pruneVolumes(options: {}, callback: Callback): void; + pruneVolumes(callback: Callback): void; + + pruneNetworks(options: {}, callback: Callback): void; + pruneNetworks(callback: Callback): void; + info(callback: Callback): void; version(callback: Callback): void; @@ -637,6 +837,8 @@ declare class Dockerode { swarmUpdate(options: {}, callback: Callback): void; + swarmInspect(callback: Callback): void; + modem: any; }