BREAKING CHANGE(DockerHost): Rename array-returning get* methods to list* on DockerHost and related resource classes; update docs, tests and changelog
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@apiclient.xyz/docker',
|
||||
version: '3.0.2',
|
||||
version: '5.0.0',
|
||||
description: 'Provides easy communication with Docker remote API from Node.js, with TypeScript support.'
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ export class DockerContainer extends DockerResource {
|
||||
|
||||
/**
|
||||
* Internal: Get all containers
|
||||
* Public API: Use dockerHost.getContainers() instead
|
||||
* Public API: Use dockerHost.listContainers() instead
|
||||
*/
|
||||
public static async _list(
|
||||
dockerHostArg: DockerHost,
|
||||
|
||||
@@ -129,9 +129,9 @@ export class DockerHost {
|
||||
// ==============
|
||||
|
||||
/**
|
||||
* Gets all networks
|
||||
* Lists all networks
|
||||
*/
|
||||
public async getNetworks() {
|
||||
public async listNetworks() {
|
||||
return await DockerNetwork._list(this);
|
||||
}
|
||||
|
||||
@@ -156,9 +156,9 @@ export class DockerHost {
|
||||
// ==============
|
||||
|
||||
/**
|
||||
* Gets all containers
|
||||
* Lists all containers
|
||||
*/
|
||||
public async getContainers() {
|
||||
public async listContainers() {
|
||||
return await DockerContainer._list(this);
|
||||
}
|
||||
|
||||
@@ -183,9 +183,9 @@ export class DockerHost {
|
||||
// ==============
|
||||
|
||||
/**
|
||||
* Gets all services
|
||||
* Lists all services
|
||||
*/
|
||||
public async getServices() {
|
||||
public async listServices() {
|
||||
return await DockerService._list(this);
|
||||
}
|
||||
|
||||
@@ -210,9 +210,9 @@ export class DockerHost {
|
||||
// ==============
|
||||
|
||||
/**
|
||||
* Gets all images
|
||||
* Lists all images
|
||||
*/
|
||||
public async getImages() {
|
||||
public async listImages() {
|
||||
return await DockerImage._list(this);
|
||||
}
|
||||
|
||||
@@ -259,9 +259,9 @@ export class DockerHost {
|
||||
// ==============
|
||||
|
||||
/**
|
||||
* Gets all secrets
|
||||
* Lists all secrets
|
||||
*/
|
||||
public async getSecrets() {
|
||||
public async listSecrets() {
|
||||
return await DockerSecret._list(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ export class DockerImage extends DockerResource {
|
||||
|
||||
/**
|
||||
* Internal: Get all images
|
||||
* Public API: Use dockerHost.getImages() instead
|
||||
* Public API: Use dockerHost.listImages() instead
|
||||
*/
|
||||
public static async _list(dockerHost: DockerHost) {
|
||||
const images: DockerImage[] = [];
|
||||
|
||||
@@ -129,7 +129,7 @@ export class DockerNetwork extends DockerResource {
|
||||
);
|
||||
}
|
||||
|
||||
public async getContainersOnNetwork(): Promise<
|
||||
public async listContainersOnNetwork(): Promise<
|
||||
Array<{
|
||||
Name: string;
|
||||
EndpointID: string;
|
||||
@@ -151,7 +151,7 @@ export class DockerNetwork extends DockerResource {
|
||||
}
|
||||
|
||||
public async getContainersOnNetworkForService(serviceArg: DockerService) {
|
||||
const containersOnNetwork = await this.getContainersOnNetwork();
|
||||
const containersOnNetwork = await this.listContainersOnNetwork();
|
||||
const containersOfService = containersOnNetwork.filter((container) => {
|
||||
return container.Name.startsWith(serviceArg.Spec.Name);
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ export class DockerSecret extends DockerResource {
|
||||
|
||||
/**
|
||||
* Internal: Get all secrets
|
||||
* Public API: Use dockerHost.getSecrets() instead
|
||||
* Public API: Use dockerHost.listSecrets() instead
|
||||
*/
|
||||
public static async _list(dockerHostArg: DockerHost) {
|
||||
const response = await dockerHostArg.request('GET', '/secrets');
|
||||
|
||||
@@ -12,7 +12,7 @@ export class DockerService extends DockerResource {
|
||||
|
||||
/**
|
||||
* Internal: Get all services
|
||||
* Public API: Use dockerHost.getServices() instead
|
||||
* Public API: Use dockerHost.listServices() instead
|
||||
*/
|
||||
public static async _list(dockerHost: DockerHost) {
|
||||
const services: DockerService[] = [];
|
||||
|
||||
Reference in New Issue
Block a user