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.
    • lookupEndpointJenkinsRootURL

      @Deprecated(since="937.0.0", forRemoval=true) @NonNull public static String lookupEndpointJenkinsRootURL(@CheckForNull String serverURL)
      Deprecated, for removal: This API element is subject to removal in a future version.
      This value depends on the underline BitbucketWebhookConfiguration configured for the endpoint.
      Jenkins Server Root URL to be used by the Bitbucket endpoint that matches the given serverURL. The global setting from Jenkins.get().getRootUrl() will be used if this field is null or equals an empty string.
      Parameters:
      serverURL - the server url to check.
      Returns:
      the verbatim setting provided by endpoint configuration
    • 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