fix(core): update

This commit is contained in:
2019-08-14 14:19:45 +02:00
parent d12d595f21
commit 867dda8e7c
9 changed files with 605 additions and 380 deletions

View File

@ -11,9 +11,11 @@ export class DockerContainer {
/**
* get all containers
*/
static async getContainers(dockerHostArg: DockerHost): Promise<DockerContainer[]> {
public static async getContainers(dockerHostArg: DockerHost): Promise<DockerContainer[]> {
const result: DockerContainer[] = [];
const response = await dockerHostArg.request('GET', '/containers/json');
// TODO: Think about getting the config by inpsecting the container
for (const containerResult of response.body) {
result.push(new DockerContainer(containerResult));
}
@ -21,11 +23,17 @@ export class DockerContainer {
}
/**
*
* gets an container by Id
* @param containerId
*/
static async getContainerById(containerId: string) {}
static async create() {}
public static async getContainerById(containerId: string) {}
/**
* create a container
*/
public static async create(creationSpecifier: interfaces.IContainerCreationSpecifier) {
}
// ========
// INSTANCE

View File

@ -2,13 +2,36 @@ import * as plugins from './dockersock.plugins';
import { DockerHost } from './docker.classes.host';
export class DockerImage {
// STATIC
public static async createFromRegistry(dockerHostArg: DockerHost, dockerImageTag): Promise<DockerImage> {
const resultingImage = new DockerImage();
return resultingImage;
}
public static async createFromExistingImage(dockerHostArg: DockerHost, dockerImageTag) {}
// INSTANCE
/**
* the tags for an image
*/
tags: string[] = [];
public tags: string[] = [];
static async createFromRegsitry(dockerHostArg: DockerHost): Promise<DockerImage> {
const resultingImage = new DockerImage();
return resultingImage;
/**
* returns a boolean wether the image has a upstream image
*/
public isUpstreamImage (): boolean {
// TODO: implement isUpastreamImage
return true;
};
/**
*
*/
public async pullLatestImageFromRegistry() : Promise<boolean> {
// TODO: implement pullLatestImageFromRegistry
return true;
}
}

View File

@ -0,0 +1,8 @@
import * as plugins from './dockersock.plugins';
import * as interfaces from './interfaces';
import { DockerHost } from './docker.classes.host';
export class DockerNetwork {
}

View File

@ -0,0 +1,8 @@
import * as plugins from './dockersock.plugins';
import * as interfaces from './interfaces';
import { DockerHost } from './docker.classes.host';
export class DockerService {
}

View File

@ -1 +1,5 @@
export { DockerHost } from './docker.classes.host';
export * from './docker.classes.host';
export * from './docker.classes.container';
export * from './docker.classes.image';
export * from './docker.classes.network';
export * from './docker.classes.service';

View File

@ -0,0 +1,7 @@
import { DockerNetwork } from '../docker.classes.network';
export interface IContainerCreationSpecifier {
hostname: string;
domainName: string;
networks?: DockerNetwork[];
}

View File

@ -1,2 +1,3 @@
export * from './container';
export * from './label';
export * from './port';