Interface CloudManager
-
- All Superinterfaces:
CloudInstanceManager
- All Known Implementing Classes:
CloudManagerFacade
,SecuredCloudManager
public interface CloudManager extends CloudInstanceManager
Provides access to cloud clients. Performs looking up from registry, creating an caching.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description CloudImageParameters
createImage(String projectId, CloudImageData imageData)
CloudProfile
createProfile(String projectId, CloudProfileData profileData)
void
deleteImage(String projectId, String profileId, String imageId)
Deletes a cloud image with the specified imageId from a cloud profilevoid
deleteImageAndInstances(String projectId, String profileId, String imageId, TerminateInstanceReason reason)
Deletes a cloud image with the specified imageId from a cloud profile.void
disposeClient(String projectId, String profileId)
Disposes of the client associated to the cloud profile with the given project and profile IDs.void
disposeClientAndRemoveInstances(String projectId, String profileId, TerminateInstanceReason reason)
Disposes of the client associated to the cloud profile with the given project and profile IDs.Collection<SBuildAgent>
findAgentByInstance(String profileId, String instanceId)
default Collection<SBuildAgent>
findAgentByInstance(CloudProfile profile, CloudInstance instance)
Deprecated.usefindAgentByInstance(String, String)
insteadCloudType
findCloudType(String cloudName)
Returns cloud type for name or nullCloudImageParameters
findImageByInternalId(String projectId, String imageInternalId)
Pair<CloudProfile,CloudInstance>
findInstanceByAgent(AgentDescription agent)
Checks if the agent is an instnce of one of the running instances.CloudInstance
findInstanceById(String projectId, String profileId, String instanceId)
Returns instance by the specified identifier.Map<AgentDescription,Pair<CloudProfile,CloudInstance>>
findInstancesByAgents(Collection<? extends AgentDescription> agents)
Finds cloud instances (if any) for the collection of agentsCloudProfile
findProfileById(String projectId, String profileId)
Returns profile by the specified identifier in a certain project.CloudProfile
findProfileByImageId(String imageId)
CloudProfile
findProfileGloballyById(String profileId)
Returns profile by the specified identifier.String
generateAgentName(AgentDescription agent)
Generated name for build agent that is thought to be running as instance of this cloud client.CloudClientEx
getClient(String projectId, String profileId)
Provides a client for the specified profile.CloudClientEx
getClientIfExists(String projectId, String profileId)
Provides a client for the specified profile.Collection<? extends CloudType>
getCloudTypes()
Returns all available "Real" cloud types, excluding ReadOnlyClient (which is not a "real" cloud type, but rather used to show instances on the secondary nodes).SAgentType
getDescriptionFor(CloudProfile profile, String imageId)
Fetches recorded agent descriptionProjectCloudIntegrationStatus
getProjectIntegrationStatus(String projectId)
String
getServerUrlForAgent(CloudProfile profile, CloudImage image)
Server url that will be sent to new created build agentboolean
isConfigurable(String projectId)
Returns true if user can enable/disable configuration in the current project's treeboolean
isImageWithAgent(CloudProfile profile, CloudImage image)
Checks if the image is configured to start agent.boolean
isInstanceExpired(String profileId, String instanceId)
Returns true, if instance will be terminated after current build finishesdefault boolean
isInstanceExpired(CloudProfile profile, CloudInstance instance)
Deprecated.boolean
isIntegrationEnabled(String projectId)
Collection<CloudProfile>
listAllProfiles()
Returns all cloud profiles.Collection<CloudImageParameters>
listImagesByProject(String projectId)
Collection<CloudProfile>
listProfilesByProject(String projectId, boolean includeFromSubprojects)
Returns cloud profiles defined in the current project.void
markInstanceExpired(String profileId, String instanceId)
Marks the instance as expired, so it should be terminated after current build finishesdefault void
markInstanceExpired(CloudProfile profile, CloudInstance instance)
Deprecated.boolean
removeProfile(String projectId, String profileId)
default void
removeProfileAndInstances(String projectId, String profileId, TerminateInstanceReason reason)
Terminate all running instance for the profile and then removes the profile itselfvoid
setProfileEnabled(String projectId, String profileId, boolean enabled)
CloudProfile
updateProfile(String projectId, String profileId, CloudProfileData profileData)
void
updateStatus(String projectId, ProjectCloudIntegrationStatus newStatus)
Updates enabled/disabled status of integration-
Methods inherited from interface jetbrains.buildServer.clouds.server.CloudInstanceManager
canStartNewInstance, iterateInstances, iterateInstances, iterateProfileInstances, startInstance, startInstance, terminateInstance, terminateInstance, terminateProfileInstances, terminateProfileInstances, terminateProjectInstances
-
-
-
-
Method Detail
-
isIntegrationEnabled
boolean isIntegrationEnabled(String projectId)
- Parameters:
projectId
-- Returns:
- false if user decided to disabled cloud integration at all
-
isConfigurable
boolean isConfigurable(@NotNull String projectId)
Returns true if user can enable/disable configuration in the current project's tree- Parameters:
projectId
- project internal id- Returns:
- see above
-
updateStatus
void updateStatus(String projectId, @NotNull ProjectCloudIntegrationStatus newStatus)
Updates enabled/disabled status of integration- Parameters:
isDisabled
- true to make integration enabledprojectId
-newStatus
-
-
getProjectIntegrationStatus
@Nullable ProjectCloudIntegrationStatus getProjectIntegrationStatus(String projectId)
- Parameters:
projectId
- - project internal id- Returns:
- returns cloud integration status information in this project; null, if project doesn't have any information (inherits from parent project)
-
listProfilesByProject
@NotNull Collection<CloudProfile> listProfilesByProject(String projectId, boolean includeFromSubprojects)
Returns cloud profiles defined in the current project.- Parameters:
projectId
-includeFromSubprojects
-- Returns:
- list of profiles; order of items is not specified (or depend on this interface implementation); empty list when no ones.
-
listAllProfiles
@NotNull Collection<CloudProfile> listAllProfiles()
Returns all cloud profiles.- Parameters:
projectId
-- Returns:
- list of profiles; order of items is not specified (or depend on this interface implementation); empty list when no ones.
-
getCloudTypes
@NotNull Collection<? extends CloudType> getCloudTypes()
Returns all available "Real" cloud types, excluding ReadOnlyClient (which is not a "real" cloud type, but rather used to show instances on the secondary nodes).- Returns:
- list of types. No order specified
-
findCloudType
@Nullable CloudType findCloudType(@Nullable String cloudName)
Returns cloud type for name or null- Parameters:
cloudName
- cloud type ID- Returns:
- registered cloud type or null
-
findProfileById
@Nullable CloudProfile findProfileById(@NotNull String projectId, @NotNull String profileId)
Returns profile by the specified identifier in a certain project.- Parameters:
profileId
- , seeCloudProfile.getProfileId()
.projectId
- internal project id- Returns:
- found profile or null if no such ones.
-
findProfileGloballyById
@Nullable CloudProfile findProfileGloballyById(@NotNull String profileId)
Returns profile by the specified identifier.- Parameters:
profileId
- , seeCloudProfile.getProfileId()
.projectId
-- Returns:
- found profile or null if no such ones.
-
findInstanceById
@Nullable CloudInstance findInstanceById(@NotNull String projectId, @NotNull String profileId, @NotNull String instanceId)
Returns instance by the specified identifier.- Parameters:
profileId
-- Returns:
- found instance or null if no such ones.
-
getClient
@NotNull CloudClientEx getClient(String projectId, @NotNull String profileId) throws CloudException, IllegalArgumentException
Provides a client for the specified profile. Creates a new client or gets a cached one if exists.- Parameters:
projectId
-profileId
- id of profile, seeCloudProfile.getProfileId()
.- Returns:
- correct ready for use cloud client.
- Throws:
IllegalArgumentException
- eCloudException
- e
-
getClientIfExists
@Nullable CloudClientEx getClientIfExists(String projectId, @NotNull String profileId) throws CloudException, IllegalArgumentException
Provides a client for the specified profile. Creates gets a cached one if exists, returns null otherwise- Parameters:
projectId
-profileId
- id of profile, seeCloudProfile.getProfileId()
.- Returns:
- correct ready for use cloud client.
- Throws:
IllegalArgumentException
- eCloudException
- e
-
findInstanceByAgent
@Nullable Pair<CloudProfile,CloudInstance> findInstanceByAgent(@NotNull AgentDescription agent)
Checks if the agent is an instnce of one of the running instances.- Parameters:
agent
- agent description of an agent that is going to connect- Returns:
- corresponding
CloudInstance
if found or null
-
findInstancesByAgents
@NotNull Map<AgentDescription,Pair<CloudProfile,CloudInstance>> findInstancesByAgents(@NotNull Collection<? extends AgentDescription> agents)
Finds cloud instances (if any) for the collection of agents- Parameters:
agents
- agent descriptions of agents- Returns:
- found pairs of agents and cloud instances. For agents that we don't find cloud instance for there's no entry in this collection
-
getDescriptionFor
@Nullable SAgentType getDescriptionFor(@NotNull CloudProfile profile, @NotNull String imageId)
Fetches recorded agent description- Parameters:
profile
- profileimageId
- image id- Returns:
- description if found
-
findAgentByInstance
@Deprecated @NotNull default Collection<SBuildAgent> findAgentByInstance(@NotNull CloudProfile profile, @NotNull CloudInstance instance)
Deprecated.usefindAgentByInstance(String, String)
instead- Parameters:
profile
- profileinstance
- instance- Returns:
- agent, if any, that associated with the instance, profile pair
-
findAgentByInstance
@NotNull Collection<SBuildAgent> findAgentByInstance(@NotNull String profileId, @NotNull String instanceId)
- Parameters:
profile
- profileinstance
- instance- Returns:
- agent, if any, that associated with the instance, profile pair
- Since:
- 2020.2
-
isImageWithAgent
boolean isImageWithAgent(@NotNull CloudProfile profile, @NotNull CloudImage image)
Checks if the image is configured to start agent. If unknown - true is returned- Parameters:
profile
- profileimage
- image- Returns:
- true is this image may contain agent, false if it is definitly broken
-
getServerUrlForAgent
@NotNull String getServerUrlForAgent(@NotNull CloudProfile profile, @NotNull CloudImage image)
Server url that will be sent to new created build agent- Parameters:
profile
- profileimage
- image- Returns:
- server url
-
generateAgentName
@Nullable String generateAgentName(@NotNull AgentDescription agent)
Generated name for build agent that is thought to be running as instance of this cloud client.- Parameters:
agent
- agent instance- Returns:
- proposed build agent name or null
- Since:
- 6.0
-
isInstanceExpired
@Deprecated default boolean isInstanceExpired(@NotNull CloudProfile profile, @NotNull CloudInstance instance)
Deprecated.Returns true, if instance will be terminated after current build finishes- Parameters:
instance
-- Returns:
- true, if no other buids will be run on this instance. False otherwise
- Since:
- 10.0
-
isInstanceExpired
boolean isInstanceExpired(@NotNull String profileId, @NotNull String instanceId)
Returns true, if instance will be terminated after current build finishes- Parameters:
profileId
-instanceId
-- Returns:
- true, if no other buids will be run on this instance. False otherwise
- Since:
- 2020.2
-
markInstanceExpired
@Deprecated default void markInstanceExpired(@NotNull CloudProfile profile, @NotNull CloudInstance instance)
Deprecated.Marks the instance as expired, so it should be terminated after current build finishes- Parameters:
profile
-instance
-- Since:
- 10.0
-
markInstanceExpired
void markInstanceExpired(@NotNull String profileId, @NotNull String instanceId)
Marks the instance as expired, so it should be terminated after current build finishes- Parameters:
profileId
-instanceId
-- Since:
- 2020.2
-
createProfile
@NotNull CloudProfile createProfile(@NotNull String projectId, @NotNull CloudProfileData profileData)
-
updateProfile
@NotNull CloudProfile updateProfile(@NotNull String projectId, @NotNull String profileId, @NotNull CloudProfileData profileData)
-
removeProfileAndInstances
default void removeProfileAndInstances(@NotNull String projectId, @NotNull String profileId, TerminateInstanceReason reason)
Terminate all running instance for the profile and then removes the profile itself- Parameters:
projectId
- projectIdprofileId
- profileIdreason
- reason of temination
-
setProfileEnabled
void setProfileEnabled(@NotNull String projectId, @NotNull String profileId, boolean enabled)
-
listImagesByProject
@NotNull Collection<CloudImageParameters> listImagesByProject(@NotNull String projectId)
-
createImage
@NotNull CloudImageParameters createImage(@NotNull String projectId, @NotNull CloudImageData imageData)
-
deleteImageAndInstances
void deleteImageAndInstances(@NotNull String projectId, @NotNull String profileId, @NotNull String imageId, @NotNull TerminateInstanceReason reason)
Deletes a cloud image with the specified imageId from a cloud profile. Will also remove any instances running of this image- Parameters:
projectId
- The ID of the project that the image belongs to. Cannot be null.profileId
- The ID of the profile that the image belongs to. Cannot be null.imageId
- The ID of the image to be deleted. Cannot be null.reason
- reason of termination
-
deleteImage
void deleteImage(@NotNull String projectId, @NotNull String profileId, @NotNull String imageId)
Deletes a cloud image with the specified imageId from a cloud profile- Parameters:
projectId
- The ID of the project that the image belongs to. Cannot be null.profileId
- The ID of the profile that the image belongs to. Cannot be null.imageId
- The ID of the image to be deleted. Cannot be null.
-
disposeClientAndRemoveInstances
void disposeClientAndRemoveInstances(@NotNull String projectId, @NotNull String profileId, @NotNull TerminateInstanceReason reason)
Disposes of the client associated to the cloud profile with the given project and profile IDs. Will terminate all running instances- Parameters:
projectId
- the unique identifier of the projectprofileId
- the unique identifier of the profilereason
- reason of termination- Since:
- 2024.12
-
disposeClient
void disposeClient(@NotNull String projectId, @NotNull String profileId)
Disposes of the client associated to the cloud profile with the given project and profile IDs.- Parameters:
projectId
- the unique identifier of the projectprofileId
- the unique identifier of the profile- Since:
- 2024.12
-
findImageByInternalId
@Nullable CloudImageParameters findImageByInternalId(@NotNull String projectId, @NotNull String imageInternalId)
-
findProfileByImageId
@Nullable CloudProfile findProfileByImageId(@NotNull String imageId)
-
-