Class BitbucketEndpointProvider

java.lang.Object
com.cloudbees.jenkins.plugins.bitbucket.api.endpoint.BitbucketEndpointProvider

public final class BitbucketEndpointProvider extends Object
A provider of BitbucketEndpoints
Since:
936.4.0
  • Method Details

    • all

      @NonNull public static List<BitbucketEndpoint> all()
      Returns all configured Bitbucket endpoints in the global page.
      Returns:
      a list of Bitbucket endpoints.
    • listEndpoints

      @NonNull public static ListBoxModel listEndpoints()
      Populates a ListBoxModel with all Bitbucket endpoints in the global page.
      Returns:
      a ListBoxModel with all the endpoints
    • lookupEndpoint

      public static <T extends BitbucketEndpoint> Optional<T> lookupEndpoint(@CheckForNull String serverURL)
      Checks to see if the supplied server URL is defined in the global configuration.
      Parameters:
      serverURL - the server url to check.
      Returns:
      the global configuration for the specified server URL or Optional#empty() if not found.
    • lookupEndpoint

      public static <T extends BitbucketEndpoint> Optional<T> lookupEndpoint(@CheckForNull String serverURL, @NonNull Class<T> clazz)
      Checks to see if the supplied server URL is defined in the global configuration.
      Parameters:
      serverURL - the server url to check.
      clazz - the class to check.
      Returns:
      the global configuration for the specified server URL or Optional#empty() if not found.
    • lookupEndpoint

      @NonNull public static <T extends BitbucketEndpoint> Collection<T> lookupEndpoint(@NonNull EndpointType type)
      Checks to see if the supplied server URL is defined in the global configuration.
      Parameters:
      type - filter of the endpoint to return.
      Returns:
      a collection of endpoints of given type.
    • registerEndpoint

      public static BitbucketEndpoint registerEndpoint(@NonNull String name, @NonNull String serverURL, @Nullable UnaryOperator<BitbucketEndpoint> endpointCustomiser)
      Register a new BitbucketEndpoint to the global configuration. The endpoint is created with default values and could be customised by the given endpointCustomiser.

      The given customiser can also return a different implementation

      Parameters:
      name - of the endpoint, alias for label
      serverURL - the bitbucket endpoint URL
      endpointCustomiser - an optional customiser for the created endpoint
      Returns:
      the registered endpoint instance.
    • unregisterEndpoint

      public static boolean unregisterEndpoint(@NonNull String serverURL)
      Removes a BitbucketEndpoint that matches the given URl from the global configuration.
      Parameters:
      serverURL - the bitbucket endpoint URL
      Returns:
      true if the endpoint has been removed from the global configuration, false otherwise