Class AutomaticAgentAuthorizationTokens

    • Method Detail

      • generateTokens

        @NotNull
        public List<String> generateTokens​(@NotNull
                                           AgentPool agentPool,
                                           @Nullable
                                           Integer timeToLiveSeconds,
                                           boolean singleUse,
                                           int count)
        Generates a list of tokens that can be used to authorize agent in the provided agent pool. Generated tokens can later be resolved using resolveToken(String).
        Parameters:
        agentPool - agent pool to associate generated tokens with
        timeToLiveSeconds - tokens expiration time in seconds
        singleUse - whether generated tokens shoul be invalidated after successful resolution
        count - number of expected tokens
        Returns:
        list of generated tokens
        Throws:
        AccessDeniedException - in case the current authority does not have enogh permissions to authorize agents in the provided pool
      • isValidTokenFormat

        public boolean isValidTokenFormat​(@NotNull
                                          String token)
        Checks if the provided token conforms to the format of the tokens produced by generateTokens(AgentPool, Integer, boolean, int).
        Parameters:
        token -
        Returns:
        true if token conforms to the defined format and false otherwise
      • afterCleanup

        public void afterCleanup​(@NotNull
                                 CleanupProcessState cleanupState)
                          throws Exception
        Description copied from interface: AfterBuildsCleanupExtension
        Invoked upon finishing of the main cleanup process. At this point all data for specific builds is deleted.
        Note: This extension might not be called for every cleanup run as cleanup process can be interrupted earlier. Extension must check cleanup process state and if it is interrupted, complete its operations and return as quick as possible.
        Specified by:
        afterCleanup in interface AfterBuildsCleanupExtension
        Parameters:
        cleanupState - cleanup process state
        Throws:
        CleanupInterruptedException - if the cleanup process was interrupted
        Exception - on any other error