implement start and stop for containers
This commit is contained in:
parent
188c7af749
commit
4eae29cec9
5
dist/dockersock.classes.dockersock.d.ts
vendored
5
dist/dockersock.classes.dockersock.d.ts
vendored
@ -2,11 +2,16 @@ import "typings-global";
|
||||
export declare class Dockersock {
|
||||
sockPath: string;
|
||||
constructor(pathArg?: string);
|
||||
auth(userArg: string, passArg: string): any;
|
||||
listContainers(): any;
|
||||
listContainersDetailed(): any;
|
||||
listContainersRunning(): any;
|
||||
listContainersStopped(): any;
|
||||
listImages(): any;
|
||||
getContainerId(): void;
|
||||
startContainer(containerNameArg: any): any;
|
||||
stopContainer(): any;
|
||||
clean(): any;
|
||||
getChange(): void;
|
||||
request(methodArg: string, routeArg: string, dataArg?: {}): any;
|
||||
}
|
||||
|
25
dist/dockersock.classes.dockersock.js
vendored
25
dist/dockersock.classes.dockersock.js
vendored
File diff suppressed because one or more lines are too long
@ -8,6 +8,11 @@ export class Dockersock {
|
||||
}
|
||||
|
||||
// methods
|
||||
auth(userArg:string,passArg:string){
|
||||
let done = plugins.q.defer();
|
||||
this.request("POST","");
|
||||
return done.promise;
|
||||
}
|
||||
listContainers() {
|
||||
let done = plugins.q.defer();
|
||||
this.request("GET","/containers")
|
||||
@ -49,17 +54,30 @@ export class Dockersock {
|
||||
let done = plugins.q.defer();
|
||||
return done.promise;
|
||||
}
|
||||
getContainerId(){
|
||||
|
||||
}
|
||||
startContainer(containerNameArg){
|
||||
return this.request("POST","/containers/"+ containerNameArg +"/start");
|
||||
};
|
||||
stopContainer(){
|
||||
return this.request("POST","/containers/"+ containerNameArg +"/stop");
|
||||
}
|
||||
clean() {
|
||||
let done = plugins.q.defer();
|
||||
return done.promise;
|
||||
}
|
||||
};
|
||||
getChange(){
|
||||
|
||||
};
|
||||
request(methodArg:string,routeArg:string,dataArg = {}){
|
||||
let done = plugins.q.defer();
|
||||
let jsonArg:string = JSON.stringify(dataArg);
|
||||
let suffix:string = ""
|
||||
if(methodArg == "GET") suffix = "/json";
|
||||
let options = {
|
||||
method:methodArg,
|
||||
url:this.sockPath + routeArg + "/json",
|
||||
url:this.sockPath + routeArg + suffix,
|
||||
headers:{
|
||||
"Content-Type":"application/json"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user