Interface AgentPoolManager

    • Method Detail

      • getAllAgentPoolsEx

        @NotNull
        List<AgentPool> getAllAgentPoolsEx​(boolean includeProjectPools)
        returns list of agent pools (see options)
        Parameters:
        includeProjectPools - - true to include project pools
        Returns:
      • getAllAgentPools

        @NotNull
        List<AgentPool> getAllAgentPools()
        Returns all agent pools. Sorting is by name, but default pool is always the last.
        Returns:
        see above
      • getNumberOfAgentPools

        int getNumberOfAgentPools()
        Returns number of agent pools.
        Returns:
        see above
      • hasSeveralPools

        boolean hasSeveralPools()
        Returns true if number of agent pools is greater than one.
        Returns:
        see above
      • findAgentPoolById

        @Nullable
        AgentPool findAgentPoolById​(int agentPoolId)
        Returns agent pool with the specified identifier.
        Parameters:
        agentPoolId - agent pool id
        Returns:
        agent pool or null if it does not exist
      • findAgentPoolsByIds

        @NotNull
        Map<Integer,​AgentPool> findAgentPoolsByIds​(@NotNull
                                                         Collection<Integer> agentPoolIds)
        Returns a map of agent pools corresponding to the specified agent pool ids
        Parameters:
        agentPoolIds -
        Returns:
        see above
        Since:
        2024.12
      • createUnknownPool

        @NotNull
        AgentPool createUnknownPool​(int agentPoolId)
        Creates an instance of "unknown" pool without writing anything to DB. Used in special cases
        Parameters:
        agentPoolId - agent pool id
        Returns:
        identifier of the created agent pool
        Since:
        2017.2.4
      • addListener

        void addListener​(@NotNull
                         AgentPoolListener listener)
        Adds listener for agent pool events.
        Parameters:
        listener - listener
      • checkAgentPoolCanBeUsedByCloudProfile

        @Nullable
        String checkAgentPoolCanBeUsedByCloudProfile​(@NotNull
                                                     String cloudProfileId,
                                                     @NotNull
                                                     AgentPool agentPool)
        Checks if agent from the given cloud profile can be used with a specified pool.
        Parameters:
        cloudProfileId - - agent's cloud profile id
        agentPool - - destination pool
        Returns:
        - reason why agents from the given cloud profile cannot be used with specified pool or 'null' otherwise
        Since:
        2024.03
      • associateProjectsWithPool

        void associateProjectsWithPool​(int agentPoolId,
                                       @NotNull
                                       Set<String> projectIds)
                                throws NoSuchAgentPoolException
        Associates specified projects with the specified pool. Does not affect projects which are not specified in parameters.
        Parameters:
        agentPoolId - agent pool id
        projectIds - project ids to associate with the specified pool
        Throws:
        NoSuchAgentPoolException - if the specified agent pool does not exist
      • dissociateProjectsFromPool

        void dissociateProjectsFromPool​(int agentPoolId,
                                        @NotNull
                                        Set<String> projectIds)
                                 throws NoSuchAgentPoolException
        Dissociates specified projects from the specified pool. Does not affect projects which are not specified in parameters.
        Parameters:
        agentPoolId - agent pool id
        projectIds - project ids to dissociate from the specified pool
        Throws:
        NoSuchAgentPoolException - if the specified agent pool does not exist
      • dissociateProjectsFromOtherPools

        void dissociateProjectsFromOtherPools​(int agentPoolId,
                                              @NotNull
                                              Set<String> projectIds)
        Dissociates specified projects from all the pools except the specified one. Does not affect projects which are not specified in parameters. Does not affect agent pool which is specified in parameters.
        Parameters:
        agentPoolId - agent pool id
        projectIds - project ids to dissociate from all the pools except the specified one
      • copyPoolAssociations

        void copyPoolAssociations​(@NotNull
                                  String sourceProjectId,
                                  @NotNull
                                  String targetProjectId)
        Copies set of pools associations from one project to the other.
        Parameters:
        sourceProjectId - source
        targetProjectId - target
      • getAllPoolProjectRelations

        @NotNull
        Collection<Pair<Integer,​String>> getAllPoolProjectRelations()
        Returns all pool--project relations.
        Returns:
        pool--project relations as an unsorted collection of pairs where first element is a pool id and second element is a project id.
      • getAgentPoolsWithProject

        @NotNull
        Set<Integer> getAgentPoolsWithProject​(@NotNull
                                              String projectId)
        Returns all associated pools for the specified project.
        Parameters:
        projectId - project id
        Returns:
        set of agent pool ids
        Since:
        2018.1
      • getProjectOwnedAgentPools

        @NotNull
        Collection<AgentPool> getProjectOwnedAgentPools​(@NotNull
                                                        String projectExternalId)
        Returns agent pools that include only projects that are under this project's tree (including the project itself).
        Parameters:
        projectExternalId -
        Returns:
      • getProjectAgentTypes

        @NotNull
        Set<Integer> getProjectAgentTypes​(@NotNull
                                          String projectId)
        Returns all agents from pools the given projects associated with.
        Parameters:
        projectId - project id
        Returns:
        set of agent tyeps ids
      • getPoolProjects

        @NotNull
        Set<String> getPoolProjects​(int poolId)
        Returns projects that are associated with the specified pool.
        Parameters:
        poolId - pool identifier we want projects for.
        Returns:
        set of internal project ids.
      • agentPoolContainsProject

        boolean agentPoolContainsProject​(int poolId,
                                         @NotNull
                                         String projectId)
        Returns true if agent pool with specified id exists and contains project with specified internal id.
        Parameters:
        poolId - pool id
        projectId - project id
        Returns:
        see above
        Since:
        2020.2
      • canAddAgents

        boolean canAddAgents​(int poolId,
                             int count)
                      throws NoSuchAgentPoolException
        Returns true if this pool can add desired # of agents
        Parameters:
        count - number of agents to add
        Returns:
        Throws:
        NoSuchAgentPoolException
        Since:
        10.0
      • getAgentTypeIdsByPool

        @NotNull
        Collection<Integer> getAgentTypeIdsByPool​(int agentPoolId)
        Returns agent type ids associated with the specified pool
        Parameters:
        agentPoolId - - agent pool internal id
        Since:
        10.0
      • findAgentPoolByTypeId

        @Nullable
        AgentPool findAgentPoolByTypeId​(int agentTypeId)
        Searches for agent pool by agent type id.
        Parameters:
        agentTypeId - agent type id
        Returns:
        found agent pool or null
        Since:
        2018.1
      • findAgentPoolIdByTypeId

        int findAgentPoolIdByTypeId​(int agentTypeId)
        Returns agent pool id for the specified agent type id or -1 if there is no such pool or agent type.
        Parameters:
        agentTypeId - agent type id
        Returns:
        found agent pool id or -1
        Since:
        2018.1.2
      • getOrCreateProjectPool

        @NotNull
        AgentPool getOrCreateProjectPool​(@NotNull
                                         String projectId)
        Creates pool for project in memory, without persisting it to DB
        Parameters:
        projectId -
        Since:
        2017.1
      • findProjectPoolByProjectId

        @Nullable
        AgentPool findProjectPoolByProjectId​(@NotNull
                                             String projectId)
        Creates pool for project in memory, without persisting it to DB
        Parameters:
        projectId -
        Since:
        2017.1.3
      • ensureAgentTypeIsAssignedToPool

        void ensureAgentTypeIsAssignedToPool​(int agentTypeId)
        This method ensures that agent type with specified id belongs at least to the default agent pool. A call of this method is required for every new agent type, because newly created agent types no longer belong to default pool by default.
        Parameters:
        agentTypeId -