Class ReadonlyClient
- java.lang.Object
-
- jetbrains.buildServer.clouds.server.impl.ReadonlyClient
-
- All Implemented Interfaces:
CloudClient
,CloudClientEx
,CloudErrorProvider
public class ReadonlyClient extends Object implements CloudClientEx
-
-
Constructor Summary
Constructors Constructor Description ReadonlyClient(CloudStateHolder cloudStateHolder, String projectId, String profileId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CanStartNewInstanceResult
canStartNewInstanceWithDetails(CloudImage image)
Call this method to check if it is possible (in theory) to start new instance of a given image in this profile.CloudImage
findImageById(String imageId)
Looks for an image with the specified identifier and returns its handle.CloudInstance
findInstanceByAgent(AgentDescription agentDescription)
Checks if the agent is an instnce of one of the running instances of that cloud profile.String
generateAgentName(AgentDescription agent)
Generated name for build agent that is thought to be running as instance of this cloud client.CloudErrorInfo
getErrorInfo()
Returns currect error info if there was any or null.Collection<? extends CloudImage>
getImages()
Lists all user selected images.boolean
isInitialized()
Checks if the client data is fully ready to be queried by the system.CloudInstance
startNewInstance(CloudImage image, CloudInstanceUserData tag)
Starts a new virtual machine instancevoid
terminateInstance(CloudInstance instance)
Terminates instance.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.clouds.CloudClient
canStartNewInstance, getInstancesLimit
-
Methods inherited from interface jetbrains.buildServer.clouds.CloudClientEx
dispose, restartInstance
-
-
-
-
Constructor Detail
-
ReadonlyClient
public ReadonlyClient(@NotNull CloudStateHolder cloudStateHolder, @NotNull String projectId, @NotNull String profileId)
-
-
Method Detail
-
getErrorInfo
@Nullable public CloudErrorInfo getErrorInfo()
Description copied from interface:CloudClient
Returns currect error info if there was any or null. Can be null. Returning error info marks this profile as error-containing and not relayable.- Specified by:
getErrorInfo
in interfaceCloudClient
- Specified by:
getErrorInfo
in interfaceCloudErrorProvider
- Returns:
- error info or null
-
isInitialized
public boolean isInitialized()
Description copied from interface:CloudClient
Checks if the client data is fully ready to be queried by the system. Actually, it may take some time to communicate to the cloud service. All interface members may not return full information if false was returned from this method.- Specified by:
isInitialized
in interfaceCloudClient
- Returns:
- true if the cloud is fully initialized.
-
startNewInstance
@NotNull public CloudInstance startNewInstance(@NotNull CloudImage image, @NotNull CloudInstanceUserData tag) throws QuotaException
Description copied from interface:CloudClientEx
Starts a new virtual machine instance- Specified by:
startNewInstance
in interfaceCloudClientEx
- Parameters:
image
- image to start instancetag
- portion of agent setup-replated data.- Returns:
- just started instance handle.
- Throws:
QuotaException
- if start can not be performed due to a quota lack
-
terminateInstance
public void terminateInstance(@NotNull CloudInstance instance)
Description copied from interface:CloudClientEx
Terminates instance.- Specified by:
terminateInstance
in interfaceCloudClientEx
- Parameters:
instance
- instance to apply action to
-
findImageById
@Nullable public CloudImage findImageById(@NotNull String imageId) throws CloudException
Description copied from interface:CloudClient
Looks for an image with the specified identifier and returns its handle.- Specified by:
findImageById
in interfaceCloudClient
- Parameters:
imageId
- idetifier of the image to look for. SeeCloudImage.getId()
.- Returns:
- image handle.
- Throws:
CloudException
- on error
-
findInstanceByAgent
@Nullable public CloudInstance findInstanceByAgent(@NotNull AgentDescription agentDescription)
Description copied from interface:CloudClient
Checks if the agent is an instnce of one of the running instances of that cloud profile.- Specified by:
findInstanceByAgent
in interfaceCloudClient
- Parameters:
agentDescription
- agent description of an agent that is going to connect- Returns:
- corresponding
CloudInstance
if found or null
-
getImages
@NotNull public Collection<? extends CloudImage> getImages() throws CloudException
Description copied from interface:CloudClient
Lists all user selected images. The method should either return an unmodifiable snapshot of the images or a thread-safe collection.- Specified by:
getImages
in interfaceCloudClient
- Returns:
- list of all available images; their order is undefined.
- Throws:
CloudException
- on error
-
canStartNewInstanceWithDetails
@NotNull public CanStartNewInstanceResult canStartNewInstanceWithDetails(@NotNull CloudImage image)
Description copied from interface:CloudClient
Call this method to check if it is possible (in theory) to start new instance of a given image in this profile.- Specified by:
canStartNewInstanceWithDetails
in interfaceCloudClient
- Parameters:
image
- image to start new instance from- Returns:
- can start new instance result with details
-
generateAgentName
@Nullable public String generateAgentName(@NotNull AgentDescription agent)
Description copied from interface:CloudClient
Generated name for build agent that is thought to be running as instance of this cloud client.- Specified by:
generateAgentName
in interfaceCloudClient
- Parameters:
agent
- agent instance- Returns:
- proposed build agent name or null
-
-