Class BitbucketEndpointProvider
java.lang.Object
com.cloudbees.jenkins.plugins.bitbucket.api.endpoint.BitbucketEndpointProvider
A provider of
BitbucketEndpoint
s- Since:
- 936.4.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<BitbucketEndpoint>
all()
Returns all configured Bitbucket endpoints in the global page.static ListBoxModel
Populates aListBoxModel
with all Bitbucket endpoints in the global page.static <T extends BitbucketEndpoint>
Collection<T>lookupEndpoint
(EndpointType type) Checks to see if the supplied server URL is defined in the global configuration.static <T extends BitbucketEndpoint>
Optional<T>lookupEndpoint
(String serverURL) Checks to see if the supplied server URL is defined in the global configuration.static <T extends BitbucketEndpoint>
Optional<T>lookupEndpoint
(String serverURL, Class<T> clazz) Checks to see if the supplied server URL is defined in the global configuration.static String
lookupEndpointJenkinsRootURL
(String serverURL) Deprecated, for removal: This API element is subject to removal in a future version.static BitbucketEndpoint
registerEndpoint
(String name, String serverURL, UnaryOperator<BitbucketEndpoint> endpointCustomiser) Register a newBitbucketEndpoint
to the global configuration.static boolean
unregisterEndpoint
(String serverURL) Removes aBitbucketEndpoint
that matches the given URl from the global configuration.
-
Method Details
-
all
Returns all configured Bitbucket endpoints in the global page.- Returns:
- a list of Bitbucket endpoints.
-
listEndpoints
Populates aListBoxModel
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 underlineBitbucketWebhookConfiguration
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 newBitbucketEndpoint
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 labelserverURL
- the bitbucket endpoint URLendpointCustomiser
- an optional customiser for the created endpoint- Returns:
- the registered endpoint instance.
-
unregisterEndpoint
Removes aBitbucketEndpoint
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
-
BitbucketWebhookConfiguration
configured for the endpoint.