Class BitbucketEndpointConfiguration
- java.lang.Object
-
- hudson.model.Descriptor<GlobalConfiguration>
-
- jenkins.model.GlobalConfiguration
-
- com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketEndpointConfiguration
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<GlobalConfiguration>
,Saveable
,OnMaster
@Extension public class BitbucketEndpointConfiguration extends GlobalConfiguration
Represents the global configuration of Bitbucket Cloud and Bitbucket Server endpoints.- Since:
- 2.2.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class hudson.model.Descriptor
Descriptor.FormException, Descriptor.PropertyType, Descriptor.Self
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
-
Fields inherited from class hudson.model.Descriptor
clazz
-
-
Constructor Summary
Constructors Constructor Description BitbucketEndpointConfiguration()
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addEndpoint(AbstractBitbucketEndpoint endpoint)
Adds an endpoint.boolean
configure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject json)
AbstractBitbucketEndpoint
findEndpoint(String serverUrl)
Checks to see if the supplied server URL is defined in the global configuration.Optional<AbstractBitbucketEndpoint>
findEndpoint(String serverUrl, Class<? extends AbstractBitbucketEndpoint> clazz)
Checks to see if the supplied server URL is defined in the global configuration.static BitbucketEndpointConfiguration
get()
Gets theBitbucketEndpointConfiguration
singleton.ListBoxModel
getEndpointItems()
Populates aListBoxModel
with the endpoints.List<AbstractBitbucketEndpoint>
getEndpoints()
Gets the list of endpoints.boolean
isEndpointSelectable()
Returnstrue
if and only if there is more than one configured endpoint.static String
normalizeServerUrl(String serverUrl)
Fix a serverUrl.String
readResolveServerUrl(String bitbucketServerUrl)
Called from areadResolve()
method only to convert the oldbitbucketServerUrl
field into the newserverUrl
field.boolean
removeEndpoint(AbstractBitbucketEndpoint endpoint)
Removes an endpoint.boolean
removeEndpoint(String serverUrl)
Removes an endpoint.void
setEndpoints(List<? extends AbstractBitbucketEndpoint> endpoints)
Sets the list of endpoints.void
updateEndpoint(AbstractBitbucketEndpoint endpoint)
Updates an existing endpoint (or adds if missing).-
Methods inherited from class jenkins.model.GlobalConfiguration
all, getDescriptor, getGlobalConfigPage
-
Methods inherited from class hudson.model.Descriptor
addHelpFileRedirect, calcAutoCompleteSettings, calcFillSettings, configure, doHelp, find, find, findByDescribableClassName, findById, getCategory, getCheckMethod, getCheckUrl, getConfigFile, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getDisplayName, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, getRequiredGlobalConfigPagePermission, getT, getViewPage, isInstance, isSubTypeOf, load, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, save, self, toArray, toList, toMap
-
-
-
-
Method Detail
-
get
public static BitbucketEndpointConfiguration get()
Gets theBitbucketEndpointConfiguration
singleton.- Returns:
- the
BitbucketEndpointConfiguration
singleton.
-
readResolveServerUrl
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @NonNull public String readResolveServerUrl(@CheckForNull String bitbucketServerUrl)
Called from areadResolve()
method only to convert the oldbitbucketServerUrl
field into the newserverUrl
field. When called fromACL.SYSTEM
this will update the configuration with the missing definitions of resolved URLs.- Parameters:
bitbucketServerUrl
- the value of the old url field.- Returns:
- the value of the new url field.
-
isEndpointSelectable
public boolean isEndpointSelectable()
Returnstrue
if and only if there is more than one configured endpoint.- Returns:
true
if and only if there is more than one configured endpoint.
-
getEndpointItems
public ListBoxModel getEndpointItems()
Populates aListBoxModel
with the endpoints.- Returns:
- A
ListBoxModel
with all the endpoints
-
configure
public boolean configure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject json) throws Descriptor.FormException
- Overrides:
configure
in classGlobalConfiguration
- Throws:
Descriptor.FormException
-
getEndpoints
@NonNull public List<AbstractBitbucketEndpoint> getEndpoints()
Gets the list of endpoints.- Returns:
- the list of endpoints
-
setEndpoints
public void setEndpoints(@CheckForNull List<? extends AbstractBitbucketEndpoint> endpoints)
Sets the list of endpoints.- Parameters:
endpoints
- the list of endpoints.
-
addEndpoint
public boolean addEndpoint(@NonNull AbstractBitbucketEndpoint endpoint)
Adds an endpoint.- Parameters:
endpoint
- the endpoint to add.- Returns:
true
if the list of endpoints was modified
-
updateEndpoint
public void updateEndpoint(@NonNull AbstractBitbucketEndpoint endpoint)
Updates an existing endpoint (or adds if missing).- Parameters:
endpoint
- the endpoint to update.
-
removeEndpoint
public boolean removeEndpoint(@NonNull AbstractBitbucketEndpoint endpoint)
Removes an endpoint.- Parameters:
endpoint
- the endpoint to remove.- Returns:
true
if the list of endpoints was modified
-
removeEndpoint
public boolean removeEndpoint(@CheckForNull String serverUrl)
Removes an endpoint.- Parameters:
serverUrl
- the server URL to remove.- Returns:
true
if the list of endpoints was modified
-
findEndpoint
@CheckForNull public AbstractBitbucketEndpoint findEndpoint(@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
null
if not defined.
-
findEndpoint
public Optional<AbstractBitbucketEndpoint> findEndpoint(@CheckForNull String serverUrl, Class<? extends AbstractBitbucketEndpoint> 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
null
if not defined.
-
-