Class ElasticFunctionalityFacadeImpl
java.lang.Object
com.atlassian.bamboo.agent.elastic.server.ElasticFunctionalityFacadeImpl
- All Implemented Interfaces:
ElasticFunctionalityFacade
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.bamboo.agent.elastic.server.ElasticFunctionalityFacade
ElasticFunctionalityFacade.Ec2PrivateKeyValidationStatus
-
Field Summary
Fields inherited from interface com.atlassian.bamboo.agent.elastic.server.ElasticFunctionalityFacade
DEFAULT_ALLOWED_AGENTS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addElasticLogEntry
(org.apache.log4j.Logger log, String logEntry) void
addElasticLogEntry
(org.apache.logging.log4j.Logger log, String logEntry) void
adjustElasticInstanceNumbers
(@NotNull ElasticInstanceSchedule instanceSchedule) Given theElasticInstanceSchedule
startup or bring down the correct number of agentsprotected void
attemptShutdownInstances
(Collection<RemoteElasticInstance> instances, int agentsToShutdown, ElasticImageConfiguration elasticImageConfiguration) void
Cleanup EC2 credentials and disable EC2 support@NotNull String
int
@NotNull io.atlassian.fugue.Either<ElasticFunctionalityFacade.Ec2PrivateKeyValidationStatus,
Optional<String>> getPassword
(RemoteElasticInstance instance) @NotNull String
@NotNull io.atlassian.fugue.Either<ElasticFunctionalityFacade.Ec2PrivateKeyValidationStatus,
File> Returns the location of the AWS private keyboolean
boolean
isElasticSupportPossible
(@NotNull ErrorCollection errorCollection) void
persistTunnelDataOfInstance
(@NotNull ElasticAgentDefinition pipelineDefinition) Persist data related to tunnel configuration of an elastic instance.void
void
void
restoreAgent
(@NotNull ElasticAgentDefinition elasticAgentDefinition, @NotNull com.amazonaws.services.ec2.model.Instance instance, @NotNull com.atlassian.aws.AWSAccount awsAccount) void
setElasticSupportEnabled
(boolean elasticSupportEnabled) Enable/disable Elastic Bamboo functionalityvoid
void
shutdownInstance
(@NotNull RemoteElasticInstance elasticInstance) void
shutdownInstance
(String instanceId) void
startupAgents
(@NotNull Collection<ElasticImageConfiguration> elasticImageConfigurations) Starts the given number of agentsvoid
updateAgentPendingStatus
(@NotNull String instanceId) Set the agent pending status to true for the given instance idboolean
validateAgentCreation
(int numAgentsRequired, ErrorCollection errorCollection) Validates whether the requested number of agents can be created and adds any errors to the error collection.
-
Constructor Details
-
ElasticFunctionalityFacadeImpl
public ElasticFunctionalityFacadeImpl()
-
-
Method Details
-
postConstruct
@PostConstruct public void postConstruct() -
recheckElasticSupportEnabledFlag
public void recheckElasticSupportEnabledFlag()- Specified by:
recheckElasticSupportEnabledFlag
in interfaceElasticFunctionalityFacade
-
shutdownInstance
- Specified by:
shutdownInstance
in interfaceElasticFunctionalityFacade
-
shutdownInstance
- Specified by:
shutdownInstance
in interfaceElasticFunctionalityFacade
- Throws:
com.atlassian.aws.AWSException
-
shutdownAllInstances
public void shutdownAllInstances()- Specified by:
shutdownAllInstances
in interfaceElasticFunctionalityFacade
-
startupAgents
@Transactional public void startupAgents(@NotNull @NotNull Collection<ElasticImageConfiguration> elasticImageConfigurations) throws com.atlassian.aws.AWSException Starts the given number of agents- Specified by:
startupAgents
in interfaceElasticFunctionalityFacade
- Throws:
com.atlassian.aws.AWSException
-
restoreAgent
public void restoreAgent(@NotNull @NotNull ElasticAgentDefinition elasticAgentDefinition, @NotNull @NotNull com.amazonaws.services.ec2.model.Instance instance, @NotNull @NotNull com.atlassian.aws.AWSAccount awsAccount) - Specified by:
restoreAgent
in interfaceElasticFunctionalityFacade
-
persistTunnelDataOfInstance
@Nullable public void persistTunnelDataOfInstance(@NotNull @NotNull ElasticAgentDefinition pipelineDefinition) Description copied from interface:ElasticFunctionalityFacade
Persist data related to tunnel configuration of an elastic instance.- Specified by:
persistTunnelDataOfInstance
in interfaceElasticFunctionalityFacade
-
isElasticSupportEnabled
public boolean isElasticSupportEnabled()- Specified by:
isElasticSupportEnabled
in interfaceElasticFunctionalityFacade
- Returns:
- true, if elastic support is turned on
-
isElasticSupportPossible
- Specified by:
isElasticSupportPossible
in interfaceElasticFunctionalityFacade
- Returns:
- true, if all preconditions for turning elastic support on are met
-
setElasticSupportEnabled
public void setElasticSupportEnabled(boolean elasticSupportEnabled) Description copied from interface:ElasticFunctionalityFacade
Enable/disable Elastic Bamboo functionality- Specified by:
setElasticSupportEnabled
in interfaceElasticFunctionalityFacade
- Parameters:
elasticSupportEnabled
- Specifies if Elastc Baboo shall be enabled or disabled.
-
validateAgentCreation
Description copied from interface:ElasticFunctionalityFacade
Validates whether the requested number of agents can be created and adds any errors to the error collection.- Specified by:
validateAgentCreation
in interfaceElasticFunctionalityFacade
- Parameters:
numAgentsRequired
- - number of agents to be createderrorCollection
- - error collection to add any validation errors to.
-
updateAgentPendingStatus
Description copied from interface:ElasticFunctionalityFacade
Set the agent pending status to true for the given instance id- Specified by:
updateAgentPendingStatus
in interfaceElasticFunctionalityFacade
-
addElasticLogEntry
- Specified by:
addElasticLogEntry
in interfaceElasticFunctionalityFacade
-
addElasticLogEntry
- Specified by:
addElasticLogEntry
in interfaceElasticFunctionalityFacade
-
adjustElasticInstanceNumbers
@Transactional public void adjustElasticInstanceNumbers(@NotNull @NotNull ElasticInstanceSchedule instanceSchedule) throws com.atlassian.aws.AWSException Description copied from interface:ElasticFunctionalityFacade
Given theElasticInstanceSchedule
startup or bring down the correct number of agents- Specified by:
adjustElasticInstanceNumbers
in interfaceElasticFunctionalityFacade
- Throws:
com.atlassian.aws.AWSException
-
attemptShutdownInstances
protected void attemptShutdownInstances(Collection<RemoteElasticInstance> instances, int agentsToShutdown, ElasticImageConfiguration elasticImageConfiguration) -
getMaxConcurrentInstances
public int getMaxConcurrentInstances()- Specified by:
getMaxConcurrentInstances
in interfaceElasticFunctionalityFacade
- Returns:
- max number of elastic instances allowed for this instance. It's based on license restrictions.
-
getPkFileLocation
- Specified by:
getPkFileLocation
in interfaceElasticFunctionalityFacade
-
getPrivateKeyLocation
@NotNull public @NotNull io.atlassian.fugue.Either<ElasticFunctionalityFacade.Ec2PrivateKeyValidationStatus,File> getPrivateKeyLocation()Description copied from interface:ElasticFunctionalityFacade
Returns the location of the AWS private key- Specified by:
getPrivateKeyLocation
in interfaceElasticFunctionalityFacade
- Returns:
-
getPassword
@NotNull public @NotNull io.atlassian.fugue.Either<ElasticFunctionalityFacade.Ec2PrivateKeyValidationStatus,Optional<String>> getPassword(RemoteElasticInstance instance) - Specified by:
getPassword
in interfaceElasticFunctionalityFacade
-
getKeyPairName
- Specified by:
getKeyPairName
in interfaceElasticFunctionalityFacade
-
cleanupCredentials
public void cleanupCredentials()Description copied from interface:ElasticFunctionalityFacade
Cleanup EC2 credentials and disable EC2 support- Specified by:
cleanupCredentials
in interfaceElasticFunctionalityFacade
-