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

org.voovan.docker.command.Auth.CmdAuth 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.Auth;

import org.voovan.docker.DockerGlobal;
import org.voovan.docker.command.Cmd;
import org.voovan.docker.message.auth.AuthRequest;
import org.voovan.docker.message.auth.AuthResult;
import org.voovan.docker.network.DockerClientException;
import org.voovan.docker.network.Result;

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

* JDocker Framework. * WebSite: https://github.com/helyho/JDocker * Licence: Apache v2 License */ public class CmdAuth extends Cmd{ private AuthRequest authRequest; public CmdAuth() { super(); this.authRequest = new AuthRequest(); } public CmdAuth serveraddress(String serveraddress){ authRequest.setServeraddress(serveraddress); return this; } public CmdAuth email(String email){ authRequest.setEmail(email); return this; } public CmdAuth username(String username){ authRequest.setUsername(username); return this; } public CmdAuth password(String password){ authRequest.setPassword(password); return this; } public static CmdAuth newInstance(){ return new CmdAuth(); } public AuthRequest getEntity(){ return authRequest; } @Override public AuthResult send() throws Exception { Result result = getDockerHttpClient().run("POST","/auth", getParameters(),authRequest); if(result!=null && result.getStatus()>=300){ throw new DockerClientException(result.getMessage()); }else{ DockerGlobal.DOCKER_AUTH_RESULT = AuthResult.load(result.getMessage()); return DockerGlobal.DOCKER_AUTH_RESULT; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy