Class AutoScalerFactoryRestApi


  • @Path("/")
    @Consumes("application/json")
    @Produces("application/json")
    public class AutoScalerFactoryRestApi
    extends java.lang.Object
    A JAX-RS REST response handler web resource that provides a remote management API for an AutoScalerFactory and its set of AutoScaler instances.

    This REST API is a thin wrapper on top of the AutoScalerFactory and AutoScaler APIs.

    See Also:
    AutoScalerFactory, AutoScaler
    • Constructor Summary

      Constructors 
      Constructor Description
      AutoScalerFactoryRestApi​(com.elastisys.autoscaler.core.autoscaler.factory.AutoScalerFactory autoScalerFactory)
      Constructs a new AutoScalerFactoryRestApi with a given backing AutoScalerFactory.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.ws.rs.core.Response createInstance​(com.google.gson.JsonObject jsonBlueprint)
      Creates an AutoScaler from a JSON-formatted AutoScalerBlueprint.
      javax.ws.rs.core.Response deleteInstance​(java.lang.String autoScalerId)
      Returns the AutoScalerBlueprint from which a given AutoScaler instance was created.
      com.elastisys.autoscaler.core.autoscaler.factory.AutoScalerFactory getAutoScalerFactory()
      Returns the AutoScalerFactory backing this REST endpoint.
      javax.ws.rs.core.Response getInstanceBlueprint​(java.lang.String autoScalerId)
      Returns the AutoScalerBlueprint from which a given AutoScaler instance was created.
      javax.ws.rs.core.Response getInstanceConfig​(java.lang.String autoScalerId)
      Retrieves the full (JSON) configuration document of a certain AutoScaler instance and all its subsystems.
      javax.ws.rs.core.Response getInstances()
      Returns URLs to all available AutoScaler instances.
      javax.ws.rs.core.Response getInstanceStatus​(java.lang.String autoScalerId)
      Retrieves the ServiceStatus for a certain AutoScaler instance and all its subsystems.
      javax.ws.rs.core.Response getInstanceUuid​(java.lang.String autoScalerId)
      Retrieves the universally unique identifier (UUID) assigned to the AutoScaler instance at the time of creation.
      javax.ws.rs.core.Response postInstanceConfig​(java.lang.String autoScalerId, com.google.gson.JsonObject config)
      Sets a new configuration for all subsystems of a certain AutoScaler instance.
      void start()  
      javax.ws.rs.core.Response startInstance​(java.lang.String autoScalerId)
      Starts an AutoScaler instance and all its subsystems.
      void stop()  
      javax.ws.rs.core.Response stopInstance​(java.lang.String autoScalerId)
      Stops an AutoScaler instance and all its subsystems.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AutoScalerFactoryRestApi

        public AutoScalerFactoryRestApi​(com.elastisys.autoscaler.core.autoscaler.factory.AutoScalerFactory autoScalerFactory)
        Constructs a new AutoScalerFactoryRestApi with a given backing AutoScalerFactory.
        Parameters:
        autoScalerFactory - The AutoScalerFactory backing this REST endpoint.
    • Method Detail

      • start

        public void start()
      • stop

        public void stop()
      • getInstances

        @GET
        @Path("/autoscaler/instances")
        public javax.ws.rs.core.Response getInstances()
        Returns URLs to all available AutoScaler instances.
        Returns:
        A list of AutoScaler instance URLs.
      • createInstance

        @POST
        @Path("/autoscaler/instances")
        public javax.ws.rs.core.Response createInstance​(com.google.gson.JsonObject jsonBlueprint)
        Creates an AutoScaler from a JSON-formatted AutoScalerBlueprint. The AutoScalerBlueprint specifies the implementation classes to use for the various AutoScaler subsystems.

        For cases where the provided blueprint doesn't explicitly provide an implementation class for a certain subsystem, the factory will fall back to using defaults as specified in the AutoScaler.Defaults.

        The created AutoScaler instance is in an unconfigured and unstarted state.

        Parameters:
        systemBlueprint - A JSON-formatted AutoScalerBlueprint that specifies the implementation classes to use for the various AutoScaler subsystems.
        Returns:
        The URL to the created AutoScaler instance.
      • getInstanceBlueprint

        @GET
        @Path("/autoscaler/instances/{id}/blueprint")
        public javax.ws.rs.core.Response getInstanceBlueprint​(@PathParam("id")
                                                              java.lang.String autoScalerId)
        Returns the AutoScalerBlueprint from which a given AutoScaler instance was created.

        The blueprint could, for example, be used as factory input to produce a clone of a certain AutoScaler instance.

        Parameters:
        id - The identifier of the AutoScaler instance of interest.
        Returns:
        The blueprint from which the AutoScaler instance was created.
      • deleteInstance

        @DELETE
        @Path("/autoscaler/instances/{id}")
        public javax.ws.rs.core.Response deleteInstance​(@PathParam("id")
                                                        java.lang.String autoScalerId)
        Returns the AutoScalerBlueprint from which a given AutoScaler instance was created.

        The blueprint could, for example, be used as factory input to produce a clone of a certain AutoScaler instance.

        Parameters:
        id - The identifier of the AutoScaler instance of interest.
        Returns:
        The blueprint from which the AutoScaler instance was created.
      • getInstanceUuid

        @GET
        @Path("/autoscaler/instances/{id}/uuid")
        public javax.ws.rs.core.Response getInstanceUuid​(@PathParam("id")
                                                         java.lang.String autoScalerId)
        Retrieves the universally unique identifier (UUID) assigned to the AutoScaler instance at the time of creation.
        Parameters:
        autoScalerId -
        Returns:
      • postInstanceConfig

        @POST
        @Path("/autoscaler/instances/{id}/config")
        public javax.ws.rs.core.Response postInstanceConfig​(@PathParam("id")
                                                            java.lang.String autoScalerId,
                                                            com.google.gson.JsonObject config)
        Sets a new configuration for all subsystems of a certain AutoScaler instance.
        Parameters:
        autoScalerId -
        config -
        Returns:
      • getInstanceConfig

        @GET
        @Path("/autoscaler/instances/{id}/config")
        public javax.ws.rs.core.Response getInstanceConfig​(@PathParam("id")
                                                           java.lang.String autoScalerId)
        Retrieves the full (JSON) configuration document of a certain AutoScaler instance and all its subsystems.

        Note: an AutoScaler instance clone could be produced by instantiating another AutoScaler instance with the same blueprint and then applying the same configuration document to the created instance.

        Parameters:
        autoScalerId -
        Returns:
      • getInstanceStatus

        @GET
        @Path("/autoscaler/instances/{id}/status")
        @Consumes("application/json")
        @Produces("application/json")
        public javax.ws.rs.core.Response getInstanceStatus​(@PathParam("id")
                                                           java.lang.String autoScalerId)
        Retrieves the ServiceStatus for a certain AutoScaler instance and all its subsystems.
        Parameters:
        autoScalerId -
        Returns:
      • startInstance

        @POST
        @Path("/autoscaler/instances/{id}/start")
        public javax.ws.rs.core.Response startInstance​(@PathParam("id")
                                                       java.lang.String autoScalerId)
        Starts an AutoScaler instance and all its subsystems.
        Parameters:
        autoScalerId -
        Returns:
      • stopInstance

        @POST
        @Path("/autoscaler/instances/{id}/stop")
        public javax.ws.rs.core.Response stopInstance​(@PathParam("id")
                                                      java.lang.String autoScalerId)
        Stops an AutoScaler instance and all its subsystems.
        Parameters:
        autoScalerId -
        Returns:
      • getAutoScalerFactory

        public com.elastisys.autoscaler.core.autoscaler.factory.AutoScalerFactory getAutoScalerFactory()
        Returns the AutoScalerFactory backing this REST endpoint.
        Returns: