Interface ElasticStackApi

  • All Superinterfaces:
    AutoCloseable, Closeable

    @Consumes("text/plain")
    public interface ElasticStackApi
    extends Closeable
    Provides synchronous access to elasticstack via their REST API.

    See Also:
    • Method Detail

      • listServers

        @GET
        @Path("/servers/list")
        Set<String> listServers()
        list of server uuids in your account
        Returns:
        or empty set if no servers are found
      • listServerInfo

        @GET
        @Path("/servers/info")
        Set<ServerInfo> listServerInfo()
        Get all servers info
        Returns:
        or empty set if no servers are found
      • getServerInfo

        @GET
        @Path("/servers/{uuid}/info")
        ServerInfo getServerInfo​(@PathParam("uuid")
                                 String uuid)
        Parameters:
        uuid - what to get
        Returns:
        null, if not found
      • createServer

        @POST
        @Path("/servers/create/stopped")
        ServerInfo createServer​(Server createServer)
        create a new server
        Parameters:
        createServer -
        Returns:
        newly created server
      • setServerConfiguration

        @POST
        @Path("/servers/{uuid}/set")
        ServerInfo setServerConfiguration​(@PathParam("uuid")
                                          String uuid,
                                          Server setServer)
        set server configuration
        Parameters:
        uuid - what server to change
        setServer - what values to change
        Returns:
        new data
      • destroyServer

        @POST
        @Path("/servers/{uuid}/destroy")
        void destroyServer​(@PathParam("uuid")
                           String uuid)
        Destroy a server
        Parameters:
        uuid - what to destroy
      • startServer

        @POST
        @Path("/servers/{uuid}/start")
        void startServer​(@PathParam("uuid")
                         String uuid)
        Start a server
        Parameters:
        uuid - what to start
      • stopServer

        @POST
        @Path("/servers/{uuid}/stop")
        void stopServer​(@PathParam("uuid")
                        String uuid)
        Stop a server

        Kills the server immediately, equivalent to a power failure. Server reverts to a stopped status if it is persistent and is automatically destroyed otherwise.

        Parameters:
        uuid - what to stop
      • shutdownServer

        @POST
        @Path("/servers/{uuid}/shutdown")
        void shutdownServer​(@PathParam("uuid")
                            String uuid)
        Shutdown a server

        Sends the server an ACPI power-down event. Server reverts to a stopped status if it is persistent and is automatically destroyed otherwise.

        note

        behaviour on shutdown depends on how your server OS is set up to respond to an ACPI power button signal.
        Parameters:
        uuid - what to shutdown
      • resetServer

        @POST
        @Path("/servers/{uuid}/reset")
        void resetServer​(@PathParam("uuid")
                         String uuid)
        Reset a server
        Parameters:
        uuid - what to reset
      • listDrives

        @GET
        @Path("/drives/list")
        Set<String> listDrives()
        list of drive uuids in your account
        Returns:
        or empty set if no drives are found
      • listDriveInfo

        @GET
        @Path("/drives/info")
        Set<DriveInfo> listDriveInfo()
        Get all drives info
        Returns:
        or empty set if no drives are found
      • listStandardDrives

        @GET
        @Path("/drives/list/standard")
        Set<String> listStandardDrives()
        Lists standard drive UUIDs in your account
        Returns:
        or empty set if no standard drives are found
      • listStandardDriveInfo

        @GET
        @Path("/drives/info/standard")
        Set<StandardDrive> listStandardDriveInfo()
        Gets information about all standard drives
        Returns:
        or empty set if no standard drives are found
      • getDriveInfo

        @GET
        @Path("/drives/{uuid}/info")
        DriveInfo getDriveInfo​(@PathParam("uuid")
                               String uuid)
        Parameters:
        uuid - what to get
        Returns:
        null, if not found
      • createDrive

        @POST
        @Path("/drives/create")
        DriveInfo createDrive​(Drive createDrive)
        create a new drive
        Parameters:
        createDrive - required parameters: name, size
        Returns:
        newly created drive
      • setDriveData

        @POST
        @Path("/drives/{uuid}/set")
        DriveInfo setDriveData​(@PathParam("uuid")
                               String uuid,
                               DriveData setDrive)
        set extra drive data
        Parameters:
        uuid - what drive to change
        setDrive - what values to change
        Returns:
        new data
      • destroyDrive

        @POST
        @Path("/drives/{uuid}/destroy")
        void destroyDrive​(@PathParam("uuid")
                          String uuid)
        Destroy a drive
        Parameters:
        uuid - what to delete
      • createAndStartServer

        @POST
        @Path("/servers/create")
        ServerInfo createAndStartServer​(Server createServer)
        create and start a new server
        Parameters:
        createServer -
        Returns:
        newly created server
      • imageDrive

        @POST
        @Path("/drives/{destination}/image/{source}")
        void imageDrive​(@PathParam("source")
                        String source,
                        @PathParam("destination")
                        String destination)
        Image a drive from another drive. The actual imaging process is asynchronous, with progress reported via drive info.
        Parameters:
        source - drive to copy from
        destination - drive to copy to
      • imageDrive

        @POST
        @Path("/drives/{destination}/image/{source}/{conversion}")
        void imageDrive​(@PathParam("source")
                        String source,
                        @PathParam("destination")
                        String destination,
                        @PathParam("conversion")
                        ImageConversionType conversionType)
        Parameters:
        conversionType - Supports 'gzip' or 'gunzip' conversions.
        See Also:
        imageDrive(String, String)
      • readDrive

        @POST
        @Consumes("application/octet-stream")
        @Path("/drives/{uuid}/read/{offset}/{size}")
        Payload readDrive​(@PathParam("uuid")
                          String uuid,
                          @PathParam("offset")
                          long offset,
                          @PathParam("size")
                          long size)
        Read binary data from a drive
        Parameters:
        uuid - drive to read
        offset - start at the specified offset in bytes
        size - the specified size in bytes; must be <=4096k
        Returns:
        binary content of the drive.
      • writeDrive

        @POST
        @Produces("application/octet-stream")
        @Path("/drives/{uuid}/write")
        void writeDrive​(@PathParam("uuid")
                        String uuid,
                        Payload content)
        Write binary data to a drive
        Parameters:
        uuid - drive to write
        content - what to write.
        • Binary data (Content-Type: application/octet-stream)
        • Supports raw data or Content-Encoding: gzip
        • Does not support Transfer-Encoding: chunked
      • writeDrive

        @POST
        @Produces("application/octet-stream")
        @Path("/drives/{uuid}/write/{offset}")
        void writeDrive​(@PathParam("uuid")
                        String uuid,
                        Payload content,
                        @PathParam("offset")
                        long offset)
        Parameters:
        offset - the byte offset in the target drive at which to start writing, not an offset in the input stream.
        See Also:
        writeDrive(String, Payload)