All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.voovan.docker.command.Node.CmdNodeUpdate Maven / Gradle / Ivy

Go to download

By encapsulating the Docker API enables developers to use Java can quickly developed the control and operation of the Docker application, using streaming operation, simple and clear.

The newest version!
package org.voovan.docker.command.Node;

import org.voovan.docker.command.Cmd;
import org.voovan.docker.message.node.NodeUpdate;
import org.voovan.docker.message.task.TaskInfo;
import org.voovan.docker.network.DockerClientException;
import org.voovan.docker.network.Result;

import java.util.List;

/**
 * 类文字命名
 *
 * @author helyho
 *         

* JDocker Framework. * WebSite: https://github.com/helyho/JDocker * Licence: Apache v2 License */ public class CmdNodeUpdate extends Cmd { private String nameOrId; private NodeUpdate nodeUpdate; public CmdNodeUpdate(String nameOrId,Integer version) { this.nameOrId = nameOrId; addParameter("version",version); this.nodeUpdate = new NodeUpdate(); } public CmdNodeUpdate name(String name){ nodeUpdate.setName(name); return this; } public CmdNodeUpdate role(String role){ nodeUpdate.setRole(role); return this; } public CmdNodeUpdate availability(String availability){ nodeUpdate.setAvailability(availability); return this; } public CmdNodeUpdate label(String key,String value){ nodeUpdate.getLabels().put(key, value); return this; } public NodeUpdate getEntity(){ return nodeUpdate; } public static CmdNodeUpdate newInstance(String id, Integer version){ return new CmdNodeUpdate(id,version); } @Override public List send() throws Exception { Result result = getDockerHttpClient().run("POST","/nodes/"+nameOrId+"/update",getParameters(),nodeUpdate); if(result!=null && result.getStatus()>=300){ throw new DockerClientException(result.getMessage()); }else{ return TaskInfo.load(result.getMessage()); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy