Class LockableResourcesRootAction
java.lang.Object
org.jenkins.plugins.lockableresources.actions.LockableResourcesRootAction
- All Implemented Interfaces:
ExtensionPoint,Action,ModelObject,RootAction
@Extension
@ExportedBean
public class LockableResourcesRootAction
extends Object
implements RootAction
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic final classRoutes/lockable-resources/remote/v1/*toRemoteApiV1Action.static final classNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Permissionstatic final Stringstatic final PermissionGroupstatic final Permissionstatic final PermissionGates the remote lock REST API (/lockable-resources/remote/v1/).static final Permissionstatic final Permissionstatic final Permissionstatic final Permission -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoChangeQueueOrder(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Change queue order (item position)voiddoCreateResource(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Create a new lockable resource from the management page.voiddoDeleteResource(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Delete a lockable resource from the management page.voiddoEditResource(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Edit an existing lockable resource from the management page.voiddoGetQueuePage(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Returns a page of queue items as JSON for server-side pagination.voiddoGetResourcesByLabelExpression(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Returns resource names matching a Jenkins label expression as JSON.voiddoReassign(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) voiddoRecycleDeadLocks(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) voiddoReleaseRemoteLock(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Force-releases a resource that is held by a remote lock (e.g.voiddoReserve(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) voiddoReset(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) voiddoSaveNote(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) voiddoSteal(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) voiddoUnlock(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) voiddoUnreserve(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Deprecated.getApi()intgetAssignedResourceAmount(String labelString) Deprecated.Deprecated.What the delegated target publishes, as last observed, ornullwhen nothing has been fetched yet.getDynamic(String token) Routes/lockable-resources/remote/*to the remote lock API.getElapsedSince(long timestampMillis) Human-readable age of a timestamp, for the remote view.The serverId every lock() on this controller is routed to, or empty when not delegating.Base URL of the delegated target, for the badge; empty when not delegating or unknown.intgetFreeResourceAmount(String labelString) Deprecated.intgetFreeResourcePercentage(String labelString) Deprecated.Get a list of all labelsReturns the ManagementLink instance for use by the Jelly view when rendering within the Manage Jenkins layout.intDeprecated.Deprecated.getQueue()Remote locks this controller currently holds or waits for on other controllers.getResource(String resourceName) Get a list of resourcesReturns a summary of resource states for the overview tab.booleanTrue when this controller delegates every lock() to one remote server.booleanTrue when this controller serves resources remotely but has stopped handing out new locks.booleanTrue when this controller has any remote relation at all - server side or client side.booleanisServerDisabled(String serverId) True when a connection exists for this serverId but has been switched off.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hudson.model.RootAction
getBadge, isPrimaryAction
-
Field Details
-
PERMISSIONS_GROUP
-
UNLOCK
-
RESERVE
-
STEAL
-
VIEW
-
QUEUE
-
CONFIGURE
-
REMOTE
Gates the remote lock REST API (/lockable-resources/remote/v1/). Grant this to the machine users whose API tokens remote client controllers use ascredentialsId; this makes remote clients auditable in the authorization matrix instead of being implied by plain READ. -
ICON
- See Also:
-
-
Constructor Details
-
LockableResourcesRootAction
public LockableResourcesRootAction()
-
-
Method Details
-
getIconFileName
- Specified by:
getIconFileNamein interfaceAction
-
getManagementLink
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public LockableResourcesManagementLink getManagementLink()Returns the ManagementLink instance for use by the Jelly view when rendering within the Manage Jenkins layout. Used byindex.jelly. -
getApi
-
getUserName
-
getDisplayName
- Specified by:
getDisplayNamein interfaceAction- Specified by:
getDisplayNamein interfaceModelObject
-
getUrlName
- Specified by:
getUrlNamein interfaceAction
-
getSummary
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public LockableResourcesRootAction.Summary getSummary()Returns a summary of resource states for the overview tab. -
getResources
@Exported @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public List<LockableResource> getResources()Get a list of resources- Returns:
- All resources.
-
getLabelsList
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public LinkedHashMap<String,LockableResourcesRootAction.LockableResourcesLabel> getLabelsList()Get a list of all labels- Returns:
- All possible labels.
-
getResource
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public LockableResource getResource(String resourceName) -
getFreeResourceAmount
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Deprecated public int getFreeResourceAmount(String labelString) Deprecated.Get amount of free resources assigned to given *labelString*- Parameters:
labelString- Label to search.- Returns:
- Amount of free labels.
-
getFreeResourcePercentage
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Deprecated public int getFreeResourcePercentage(String labelString) Deprecated.Get percentage (0-100) usage of resources assigned to given *labelString*Used by
actions/LockableResourcesRootAction/index.jelly- Parameters:
labelString- Label to search.- Returns:
- Percentage usages of *labelString* around all resources
- Since:
- 2.19
-
getAllLabels
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Deprecated public Set<String> getAllLabels()Deprecated.Get all existing labels as list.- Returns:
- All possible labels.
-
getNumberOfAllLabels
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Deprecated public int getNumberOfAllLabels()Deprecated.Get amount of all labels.- Returns:
- Amount of all labels.
-
getAssignedResourceAmount
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Deprecated public int getAssignedResourceAmount(String labelString) Deprecated.Get amount of resources assigned to given *labelString*Used by
actions/LockableResourcesRootAction/index.jelly- Parameters:
labelString- Label to search.- Returns:
- Amount of assigned resources.
-
getRemoteLocks
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public List<RemoteClientRegistry.Entry> getRemoteLocks()Remote locks this controller currently holds or waits for on other controllers.This is the client side of the picture: the resources listed elsewhere on this page belong to this controller, while these belong to someone else. The state shown here is what this controller last observed, not the remote's own record - the view says so.
-
isRemoteAcquiresPaused
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean isRemoteAcquiresPaused()True when this controller serves resources remotely but has stopped handing out new locks.Only interesting while the remote API is on: with it off, nothing is being served either way, and a banner about paused acquires would be noise.
-
isDelegatedMode
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean isDelegatedMode()True when this controller delegates every lock() to one remote server. -
getDelegatedCatalog
@CheckForNull @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public RemoteCatalog getDelegatedCatalog()What the delegated target publishes, as last observed, ornullwhen nothing has been fetched yet. Never blocks: a stale snapshot is refreshed in the background. -
isServerDisabled
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean isServerDisabled(String serverId) True when a connection exists for this serverId but has been switched off. -
getElapsedSince
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public String getElapsedSince(long timestampMillis) Human-readable age of a timestamp, for the remote view. -
isRemoteConfigured
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean isRemoteConfigured()True when this controller has any remote relation at all - server side or client side. -
getForcedServerId
The serverId every lock() on this controller is routed to, or empty when not delegating. -
getForcedServerUrl
Base URL of the delegated target, for the badge; empty when not delegating or unknown. -
getQueue
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public LockableResourcesRootAction.Queue getQueue() throws Descriptor.FormException- Throws:
Descriptor.FormException
-
getCurrentQueuedContext
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Deprecated public List<QueuedContextStruct> getCurrentQueuedContext()Deprecated.Returns current queue -
getOldestQueue
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @CheckForNull @Deprecated public LockableResourcesStruct getOldestQueue()Deprecated.Returns current queue -
doUnlock
public void doUnlock(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException - Throws:
IOExceptionjakarta.servlet.ServletException
-
doReleaseRemoteLock
public void doReleaseRemoteLock(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Force-releases a resource that is held by a remote lock (e.g. STALE lock with no active client). Called by the "Force Release Remote Lock" button in the resource table.- Throws:
IOExceptionjakarta.servlet.ServletException
-
doReserve
public void doReserve(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException - Throws:
IOExceptionjakarta.servlet.ServletException
-
doSteal
public void doSteal(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException - Throws:
IOExceptionjakarta.servlet.ServletException
-
doReassign
public void doReassign(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException - Throws:
IOExceptionjakarta.servlet.ServletException
-
doUnreserve
public void doUnreserve(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException - Throws:
IOExceptionjakarta.servlet.ServletException
-
doReset
public void doReset(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException - Throws:
IOExceptionjakarta.servlet.ServletException
-
doRecycleDeadLocks
public void doRecycleDeadLocks(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException - Throws:
IOExceptionjakarta.servlet.ServletException
-
doSaveNote
public void doSaveNote(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException - Throws:
IOExceptionjakarta.servlet.ServletException
-
doGetResourcesByLabelExpression
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @GET public void doGetResourcesByLabelExpression(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException Returns resource names matching a Jenkins label expression as JSON.- Throws:
IOException
-
doChangeQueueOrder
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doChangeQueueOrder(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Change queue order (item position)- Throws:
IOExceptionjakarta.servlet.ServletException
-
doGetQueuePage
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doGetQueuePage(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Returns a page of queue items as JSON for server-side pagination.- Throws:
IOExceptionjakarta.servlet.ServletException
-
doCreateResource
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doCreateResource(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Create a new lockable resource from the management page.- Throws:
IOExceptionjakarta.servlet.ServletException
-
doEditResource
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doEditResource(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Edit an existing lockable resource from the management page.- Throws:
IOExceptionjakarta.servlet.ServletException
-
doDeleteResource
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doDeleteResource(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Delete a lockable resource from the management page.- Throws:
IOExceptionjakarta.servlet.ServletException
-
getDynamic
Routes/lockable-resources/remote/*to the remote lock API.
-