Class BitbucketSeverMirrorHelper

java.lang.Object
com.atlassian.bamboo.plugins.stash.BitbucketSeverMirrorHelper

@Service public class BitbucketSeverMirrorHelper extends Object
  • Constructor Details

    • BitbucketSeverMirrorHelper

      public BitbucketSeverMirrorHelper()
  • Method Details

    • isBitbucketServerVersionMirrorsSupported

      public boolean isBitbucketServerVersionMirrorsSupported(com.atlassian.stash.rest.client.api.StashClient stashClient)

      Checks if given Bitbucket Server is supported.

      Smart mirroring is supported only for Bibtucket Server versions >= 5.0.0 with DC license.

    • getRepositoryMirrors

      public List<StashMirrorServerEntity> getRepositoryMirrors(com.atlassian.stash.rest.client.api.StashClient stashClient, String projectKey, String repositorySlug, String serverKey) throws IllegalArgumentException
      Reads all mirrors for a given repository
      Parameters:
      stashClient - stash client corresponding to the BBS instance serving the repository
      projectKey - key of the project containing the repository
      repositorySlug - slug of the repository
      serverKey - key that indicates the bitbucket instance
      Returns:
      list of mirrors for specified repository
      Throws:
      IllegalArgumentException - when can't find repository by projectKey and repositorySlug.
    • getRepositoryMirrors

      public List<StashMirrorServerEntity> getRepositoryMirrors(com.atlassian.stash.rest.client.api.StashClient stashClient, String projectKey, String repositorySlug, String serverKey, Predicate<com.atlassian.stash.rest.client.api.entity.MirrorServer> filter) throws IllegalArgumentException
      Reads all mirrors for a given repository
      Parameters:
      stashClient - stash client corresponding to the BBS instance serving the repository
      projectKey - key of the project containing the repository
      repositorySlug - slug of the repository
      serverKey - key that indicates the bitbucket instance
      filter - for mirror. Applied before ssh details fetching from BBS.
      Returns:
      list of mirrors for specified repository
      Throws:
      IllegalArgumentException - when can't find repository by projectKey and repositorySlug.
    • findSpecifiedMirror

      @NotNull public @NotNull Optional<StashMirrorServerEntity> findSpecifiedMirror(com.atlassian.stash.rest.client.api.StashClient stashClient, String projectKey, String repositorySlug, String serverKey, @NotNull @NotNull com.atlassian.bamboo.specs.model.repository.bitbucket.server.BitbucketServerMirrorProperties mirrorProperties)
      Finds mirror specified by mirrorProperties on the list
      Parameters:
      stashClient - stash client corresponding to the BBS instance serving the repository
      projectKey - key of the project containing the repository
      repositorySlug - slug of the repository
      mirrorProperties - mirror specification
      Returns:
      optional containing the mirror (if found)