Class BrokenClient
- java.lang.Object
-
- jetbrains.buildServer.clouds.server.impl.BrokenClient
-
- All Implemented Interfaces:
CloudClient
,CloudClientEx
,CloudErrorProvider
public class BrokenClient extends Object implements CloudClientEx
- Author:
- Eugene Petrenko Created: 21.10.2009 11:00:38
-
-
Constructor Summary
Constructors Constructor Description BrokenClient(CloudErrorInfo errorInfo)
BrokenClient(CloudErrorInfo errorInfo, boolean shouldCache)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canStartNewInstance(CloudImage image)
Call this method to check if it is possible (in theory) to start new instance of a given image in this profile.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.void
dispose()
Notifies client that it is no longer needed, This is a good time to release all resources allocated to implement the clientCloudImage
findImageById(String imageId)
Looks for an image with the specified identifier and returns its handle.CloudInstance
findInstanceByAgent(AgentDescription agent)
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.boolean
isShouldCache()
void
restartInstance(CloudInstance instance)
Restarts instance if possibleCloudInstance
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
getInstancesLimit
-
-
-
-
Constructor Detail
-
BrokenClient
public BrokenClient(@Nullable CloudErrorInfo errorInfo)
-
BrokenClient
public BrokenClient(@Nullable CloudErrorInfo errorInfo, boolean shouldCache)
-
-
Method Detail
-
isShouldCache
public boolean isShouldCache()
-
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
-
restartInstance
public void restartInstance(@NotNull CloudInstance instance)
Description copied from interface:CloudClientEx
Restarts instance if possible- Specified by:
restartInstance
in interfaceCloudClientEx
- Parameters:
instance
- instance to apply action to
-
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
-
dispose
public void dispose()
Description copied from interface:CloudClientEx
Notifies client that it is no longer needed, This is a good time to release all resources allocated to implement the client- Specified by:
dispose
in interfaceCloudClientEx
-
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.
-
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 agent)
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:
agent
- 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
-
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
-
canStartNewInstance
public boolean canStartNewInstance(@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. Deprecated since 2018.1. jetbrains.buildServer.clouds.CloudClient#canStartNewInstanceWithDetails(jetbrains.buildServer.clouds.CloudImage) is being used instead.- Specified by:
canStartNewInstance
in interfaceCloudClient
- Parameters:
image
- image to start new instance from- Returns:
- can start new instance or not
-
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
-
-