Class ElasticImageConfigurationManagerImpl
java.lang.Object
com.atlassian.bamboo.agent.elastic.server.ElasticImageConfigurationManagerImpl
- All Implemented Interfaces:
ElasticImageConfigurationAccessor
,ElasticImageConfigurationManager
public class ElasticImageConfigurationManagerImpl
extends Object
implements ElasticImageConfigurationManager
-
Field Summary
Fields inherited from interface com.atlassian.bamboo.agent.elastic.server.ElasticImageConfigurationManager
DEFAULT_AVAILABILITY_ZONE, IMAGE_CAPABILITIES_FILE, WINDOWS_IMAGE_CAPABILITIES_FILE
-
Constructor Summary
ConstructorDescriptionElasticImageConfigurationManagerImpl
(ElasticImageConfigurationDao elasticImageConfigurationDao, ResourceResolver resourceResolver, ElasticImageConfigurationAccessor elasticImageConfigurationAccessor, ElasticInstanceScheduleManager elasticInstanceScheduleManager, AgentAssignmentService agentAssignmentService, com.atlassian.event.api.EventPublisher eventPublisher, AwsAccountBean awsAccountBean) -
Method Summary
Modifier and TypeMethodDescriptionvoid
disableElasticImageSchedules
(@NotNull ElasticImageConfiguration elasticImageConfiguration) Disable all enabled Elastic Image Schedules associated with the Elastic Image Configuration@NotNull List<ElasticImageConfiguration>
Retrieves all elastic images that are stored in database@NotNull List<ElasticImageConfiguration>
int
getBuildsCountForImageConfiguration
(long id) Returns how many builds have been built against the given build configuration.int
How many elastic agents are associated with a specific image configuration.@Nullable ElasticImageConfiguration
getElasticImageConfigurationById
(long configurationId) Retrieve an elastic image.@NotNull List<ElasticImageConfiguration>
getElasticImageConfigurationsByName
(@NotNull String configurationName, com.atlassian.aws.ec2.awssdk.AwsSupportConstants.Region region) Retrieve an elastic image by name in a given region.@NotNull List<ElasticImageConfiguration>
void
onInstanceFailedToStartEvent
(@NotNull ElasticImageFailedToStartEvent event) void
populateDefaultCapabilitySet
(CapabilitySet capabilitySet, ElasticImageConfiguration imageConfiguration) Populates capability set with default capabilities from fromElasticImageConfigurationManager.IMAGE_CAPABILITIES_FILE
.void
removeElasticImageConfiguration
(@NotNull ElasticImageConfiguration elasticImageConfiguration) Delete an elastic image configuration.void
saveElasticImageConfiguration
(@NotNull ElasticImageConfiguration elasticImageConfiguration) Save an elastic image configuration.void
Performs startup operations for setting up an elastic image, including retrieving capability information.
-
Constructor Details
-
ElasticImageConfigurationManagerImpl
public ElasticImageConfigurationManagerImpl(ElasticImageConfigurationDao elasticImageConfigurationDao, ResourceResolver resourceResolver, ElasticImageConfigurationAccessor elasticImageConfigurationAccessor, ElasticInstanceScheduleManager elasticInstanceScheduleManager, AgentAssignmentService agentAssignmentService, com.atlassian.event.api.EventPublisher eventPublisher, AwsAccountBean awsAccountBean)
-
-
Method Details
-
getElasticImageConfigurationById
@Nullable public @Nullable ElasticImageConfiguration getElasticImageConfigurationById(long configurationId) Description copied from interface:ElasticImageConfigurationAccessor
Retrieve an elastic image.- Specified by:
getElasticImageConfigurationById
in interfaceElasticImageConfigurationAccessor
- Parameters:
configurationId
- - id of the ElasticImageConfiguration to find- Returns:
- ElasticImageConfiguration if exists null otherwise.
-
getElasticImageConfigurationsByName
@NotNull public @NotNull List<ElasticImageConfiguration> getElasticImageConfigurationsByName(@NotNull @NotNull String configurationName, @NotNull com.atlassian.aws.ec2.awssdk.AwsSupportConstants.Region region) Description copied from interface:ElasticImageConfigurationAccessor
Retrieve an elastic image by name in a given region.- Specified by:
getElasticImageConfigurationsByName
in interfaceElasticImageConfigurationAccessor
- Parameters:
configurationName
- - name of the ElasticImageConfiguration to findregion
- the region to check- Returns:
- ElasticImageConfiguration if exists null otherwise.
-
getElasticImageConfigurationsShippedWithBamboo
@NotNull public @NotNull List<ElasticImageConfiguration> getElasticImageConfigurationsShippedWithBamboo()- Specified by:
getElasticImageConfigurationsShippedWithBamboo
in interfaceElasticImageConfigurationAccessor
-
getAllElasticImageConfigurations
Description copied from interface:ElasticImageConfigurationAccessor
Retrieves all elastic images that are stored in database- Specified by:
getAllElasticImageConfigurations
in interfaceElasticImageConfigurationAccessor
-
getAllElasticImageConfigurationsForCurrentRegion
@NotNull public @NotNull List<ElasticImageConfiguration> getAllElasticImageConfigurationsForCurrentRegion()- Specified by:
getAllElasticImageConfigurationsForCurrentRegion
in interfaceElasticImageConfigurationAccessor
-
saveElasticImageConfiguration
public void saveElasticImageConfiguration(@NotNull @NotNull ElasticImageConfiguration elasticImageConfiguration) Description copied from interface:ElasticImageConfigurationManager
Save an elastic image configuration.- Specified by:
saveElasticImageConfiguration
in interfaceElasticImageConfigurationManager
- Parameters:
elasticImageConfiguration
- Elastic Image Configuration to be saved.
-
getElasticAgentCountForImageConfiguration
public int getElasticAgentCountForImageConfiguration(long id) Description copied from interface:ElasticImageConfigurationManager
How many elastic agents are associated with a specific image configuration.- Specified by:
getElasticAgentCountForImageConfiguration
in interfaceElasticImageConfigurationManager
- Parameters:
id
- of the image configuration- Returns:
- count of the elastic agents.
-
getBuildsCountForImageConfiguration
public int getBuildsCountForImageConfiguration(long id) Description copied from interface:ElasticImageConfigurationManager
Returns how many builds have been built against the given build configuration.- Specified by:
getBuildsCountForImageConfiguration
in interfaceElasticImageConfigurationManager
- Parameters:
id
- of the elastic image configuration- Returns:
- count of build results.
-
removeElasticImageConfiguration
public void removeElasticImageConfiguration(@NotNull @NotNull ElasticImageConfiguration elasticImageConfiguration) throws com.atlassian.aws.AWSException Description copied from interface:ElasticImageConfigurationManager
Delete an elastic image configuration. That includes unscheduling and deleting relatedElasticInstanceSchedule
objects- Specified by:
removeElasticImageConfiguration
in interfaceElasticImageConfigurationManager
- Parameters:
elasticImageConfiguration
- Elastic Image Configuration to be deleted.- Throws:
com.atlassian.aws.AWSException
-
disableElasticImageSchedules
public void disableElasticImageSchedules(@NotNull @NotNull ElasticImageConfiguration elasticImageConfiguration) Description copied from interface:ElasticImageConfigurationManager
Disable all enabled Elastic Image Schedules associated with the Elastic Image Configuration- Specified by:
disableElasticImageSchedules
in interfaceElasticImageConfigurationManager
-
updateDefaultElasticImageConfiguration
Description copied from interface:ElasticImageConfigurationManager
Performs startup operations for setting up an elastic image, including retrieving capability information.- Specified by:
updateDefaultElasticImageConfiguration
in interfaceElasticImageConfigurationManager
- Throws:
Exception
- if it can not find the default image information to setup
-
onInstanceFailedToStartEvent
@EventListener public void onInstanceFailedToStartEvent(@NotNull @NotNull ElasticImageFailedToStartEvent event) -
populateDefaultCapabilitySet
public void populateDefaultCapabilitySet(CapabilitySet capabilitySet, ElasticImageConfiguration imageConfiguration) Description copied from interface:ElasticImageConfigurationManager
Populates capability set with default capabilities from fromElasticImageConfigurationManager.IMAGE_CAPABILITIES_FILE
. Will overwrite any existing capabilities.- Specified by:
populateDefaultCapabilitySet
in interfaceElasticImageConfigurationManager
- Parameters:
capabilitySet
- to populate with the defaults.
-