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
  • Constructor Details

    • BitbucketEndpointConfiguration

      public BitbucketEndpointConfiguration()
      Constructor.
  • Method Details

    • get

      public static BitbucketEndpointConfiguration get()
      Gets the BitbucketEndpointConfiguration singleton.
      Returns:
      the BitbucketEndpointConfiguration singleton.
    • getRequiredGlobalConfigPagePermission

      @NonNull public Permission getRequiredGlobalConfigPagePermission()
      Overrides:
      getRequiredGlobalConfigPagePermission in class Descriptor<GlobalConfiguration>
    • readResolveServerUrl

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @NonNull public String readResolveServerUrl(@CheckForNull String bitbucketServerUrl)
      Called from a readResolve() method only to convert the old bitbucketServerUrl field into the new serverUrl field. When called from ACL.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()
      Returns true 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 a ListBoxModel 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 class GlobalConfiguration
      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.
    • normalizeServerUrl

      @NonNull public static String normalizeServerUrl(@CheckForNull String serverUrl)
      Fix a serverUrl.
      Parameters:
      serverUrl - the server URL.
      Returns:
      the normalized server URL.