Package io.github.pod4dev.java.core
Interface GenericContainer
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
KubePlayer
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Get API client.default StringGetting mapped hostgetMappedPort(String serviceName, Integer exposedPort) Getting mapped port for the given service's name and exposed port.booleanCheck if service is running.voidstart()Creates the pod or container and immediately starts it.voidstop()Stops the pod or container with clearing created volumes.withCleanup(boolean doCleanup) Do resources cleanup after stopping.withExposedService(String serviceName, Integer exposedPort) Specify service and its port for expose.withRemoveVolumes(boolean doRemoveVolumes) Do volumes cleanup after stopping.
-
Method Details
-
isRunning
boolean isRunning()Check if service is running.- Returns:
- check result.
-
getClient
PodmanClient getClient()Get API client.- Returns:
- API client.
-
start
Creates the pod or container and immediately starts it. All created resources will be cleared out when a SIGTERM is received or pods exit.- Throws:
PodmanException
-
stop
Stops the pod or container with clearing created volumes.- Throws:
PodmanException
-
withExposedService
Specify service and its port for expose.- Parameters:
serviceName- name of service to expose.exposedPort- port to expose.- Returns:
- container with exposed services.
- Throws:
PodmanException
-
withCleanup
Do resources cleanup after stopping.- Parameters:
doCleanup- default is true.- Returns:
- customised container.
-
withRemoveVolumes
Do volumes cleanup after stopping.- Parameters:
doRemoveVolumes- default is true.- Returns:
- customised container.
-
getMappedHost
Getting mapped host- Returns:
- mapped host.
- Throws:
PodmanException
-
getMappedPort
Getting mapped port for the given service's name and exposed port.- Parameters:
serviceName- the service name.exposedPort- the exposed port.- Returns:
- mapped host.
- Throws:
PodmanException
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-