Class InstanceAllocationResource


  • @Path("/instanceallocation")
    @Produces("application/json")
    public class InstanceAllocationResource
    extends java.lang.Object
    Resource to control allocation of instances to a user or team

    Roles defined: ALLOCATE_INSTANCE

    • 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 an Instance for a user for a given challenge, attempting to comply with the Allocation restraints specified in the Challenge 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 an Instance for a user for a given challenge that is different from their last one, and avoiding the other instances they have been given previously.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 an Instance for a user for a given challenge, attempting to comply with the Allocation restraints specified in the Challenge 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 an Instance 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 the InstanceAllocator is unable to allocate an instance within the usual constraints
        Parameters:
        instanceRequest - the instance to replace
        Returns:
        a new instance