Class InstanceAllocationResource
- java.lang.Object
-
- uk.co.ractf.polaris.controller.resources.InstanceAllocationResource
-
@Path("/instanceallocation") @Produces("application/json") public class InstanceAllocationResource extends java.lang.Object
Resource to control allocation of instances to a user or teamRoles defined: ALLOCATE_INSTANCE
-
-
Constructor Summary
Constructors Constructor Description InstanceAllocationResource(Controller controller, ClusterState clusterState)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description uk.co.ractf.polaris.api.instanceallocation.InstanceResponse
getInstance(uk.co.ractf.polaris.api.instanceallocation.InstanceRequest instanceRequest)
Gets anInstance
for a user for a given challenge, attempting to comply with theAllocation
restraints specified in theChallenge
config, if the user or a user on the same team has already requested a challenge, they may be routed back to the same instance.uk.co.ractf.polaris.api.instanceallocation.InstanceResponse
newInstance(uk.co.ractf.polaris.api.instanceallocation.InstanceRequest instanceRequest)
Gets anInstance
for a user for a given challenge that is different from their last one, and avoiding the other instances they have been given previously.
-
-
-
Constructor Detail
-
InstanceAllocationResource
@Inject public InstanceAllocationResource(Controller controller, ClusterState clusterState)
-
-
Method Detail
-
getInstance
@POST @Timed @ExceptionMetered @RolesAllowed("ALLOCATE_INSTANCE") public uk.co.ractf.polaris.api.instanceallocation.InstanceResponse getInstance(uk.co.ractf.polaris.api.instanceallocation.InstanceRequest instanceRequest)
Gets anInstance
for a user for a given challenge, attempting to comply with theAllocation
restraints specified in theChallenge
config, if the user or a user on the same team has already requested a challenge, they may be routed back to the same instance.- Parameters:
instanceRequest
- the details of the request for instance- Returns:
- the instance and host ip
-
newInstance
@POST @Path("/new") @Timed @ExceptionMetered @RolesAllowed("ALLOCATE_INSTANCE") public uk.co.ractf.polaris.api.instanceallocation.InstanceResponse newInstance(uk.co.ractf.polaris.api.instanceallocation.InstanceRequest instanceRequest)
Gets anInstance
for a user for a given challenge that is different from their last one, and avoiding the other instances they have been given previously. The user will no longer be served this instance unless theInstanceAllocator
is unable to allocate an instance within the usual constraints- Parameters:
instanceRequest
- the instance to replace- Returns:
- a new instance
-
-