Class DockerSwarmClient
java.lang.Object
io.jenkins.plugins.swarmcloud.api.DockerSwarmClient
- All Implemented Interfaces:
Closeable,AutoCloseable
Client for Docker Swarm API operations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()createConfig(String name, byte[] data) createSecret(String name, byte[] data) createService(String agentName, SwarmAgentTemplate template, String jenkinsUrl, String networkName) Overloaded method for backwards compatibility.createService(String agentName, SwarmAgentTemplate template, String jenkinsUrl, String secret, String networkName) Creates a Docker Swarm service for a Jenkins agent.voiddeleteConfig(String configId) voiddeleteSecret(String secretId) com.github.dockerjava.api.DockerClientGets the underlying Docker client for advanced operations.intcom.github.dockerjava.api.model.ServicegetService(String serviceId) Gets information about a service.getServiceLogs(String serviceId, int tailLines) Gets logs from a service.List<com.github.dockerjava.api.model.Task> getServiceTasks(String serviceId) Gets tasks for a service.booleanisServiceRunning(String serviceId) Checks if a service is running (has at least one running task).List<com.github.dockerjava.api.model.Config> List<com.github.dockerjava.api.model.Service> Lists all Jenkins agent services.List<com.github.dockerjava.api.model.Secret> List<com.github.dockerjava.api.model.Service> listServicesForCloud(String cloudName) Lists services for a specific cloud.voidremoveService(String serviceId) Removes a Docker Swarm service.
-
Constructor Details
-
DockerSwarmClient
-
-
Method Details
-
getSwarmVersion
-
getNodeCount
public int getNodeCount() -
createService
@NonNull public String createService(@NonNull String agentName, @NonNull SwarmAgentTemplate template, @NonNull String jenkinsUrl, @NonNull String secret, @Nullable String networkName) Creates a Docker Swarm service for a Jenkins agent.- Parameters:
agentName- Unique name for the agenttemplate- Agent template configurationjenkinsUrl- URL for agents to connect to Jenkinssecret- Secret for agent authenticationnetworkName- Docker network to attach (optional)- Returns:
- Service ID
-
createService
@NonNull public String createService(@NonNull String agentName, @NonNull SwarmAgentTemplate template, @NonNull String jenkinsUrl, @Nullable String networkName) Overloaded method for backwards compatibility. -
removeService
Removes a Docker Swarm service. Handles 404 (not found) gracefully - if service is already gone, that's fine. -
getService
Gets information about a service. -
getServiceLogs
Gets logs from a service. -
listJenkinsServices
Lists all Jenkins agent services. -
listServicesForCloud
@NonNull public List<com.github.dockerjava.api.model.Service> listServicesForCloud(@NonNull String cloudName) Lists services for a specific cloud. -
getServiceTasks
@NonNull public List<com.github.dockerjava.api.model.Task> getServiceTasks(@NonNull String serviceId) Gets tasks for a service. -
isServiceRunning
Checks if a service is running (has at least one running task). -
createConfig
-
deleteConfig
-
listConfigs
-
createSecret
-
deleteSecret
-
listSecrets
-
getDockerClient
public com.github.dockerjava.api.DockerClient getDockerClient()Gets the underlying Docker client for advanced operations. -
getDockerHost
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-