Interface GridServerApi


  • public interface GridServerApi
    Provides synchronous access to GoGrid.

    See Also:
    • Method Detail

      • getServerList

        @GET
        @Path("/grid/server/list")
        Set<Server> getServerList​(GetServerListOptions... getServerListOptions)
        Returns the list of all servers. The result can be narrowed down by providing the options.
        Parameters:
        getServerListOptions - options to narrow down the result
        Returns:
        servers found by the request
      • getServersByName

        @GET
        @Path("/grid/server/get")
        Set<Server> getServersByName​(String... names)
        Returns the server(s) by unique name(s). Given a name or a set of names, finds one or multiple servers.
        Parameters:
        names - to get the servers
        Returns:
        server(s) matching the name(s)
      • getServersById

        @GET
        @Path("/grid/server/get")
        Set<Server> getServersById​(long... ids)
        Returns the server(s) by unique id(s). Given an id or a set of ids, finds one or multiple servers.
        Parameters:
        ids - to get the servers
        Returns:
        server(s) matching the ids
      • getServerCredentialsList

        @GET
        @Path("/support/password/list")
        Map<String,​Credentials> getServerCredentialsList()
        Returns a map of running servers' names to the log in credentials.
        Returns:
        map Credentials>
      • getServerCredentials

        @GET
        @Path("/support/grid/password/get")
        Credentials getServerCredentials​(@QueryParam("id")
                                         long id)
        Returns:
        the login user and password of a server, or null if none found
      • addServer

        @GET
        @Path("/grid/server/add")
        Server addServer​(@QueryParam("name")
                         String name,
                         @QueryParam("image")
                         String image,
                         @QueryParam("server.ram")
                         String ram,
                         @QueryParam("ip")
                         String ip,
                         AddServerOptions... addServerOptions)
        Adds a server with specified attributes
        Parameters:
        name - name of the server
        image - image (id or name)
        ram - ram type (id or name)
        ip - ip address
        addServerOptions - options to make it a sandbox instance or/and description
        Returns:
        created server
      • power

        @GET
        @Path("/grid/server/power")
        Server power​(@QueryParam("server")
                     String idOrName,
                     @QueryParam("power")
                     PowerCommand power)
        Changes the server's state according to PowerCommand
        Parameters:
        idOrName - id or name of the server to apply the command
        power - new desired state
        Returns:
        server immediately after applying the command
      • deleteById

        @GET
        @Path("/grid/server/delete")
        Server deleteById​(@QueryParam("id")
                          long id)
        Deletes the server by Id
        Parameters:
        id - id of the server to delete
        Returns:
        server before the command is executed
      • deleteByName

        @GET
        @Path("/grid/server/delete")
        Server deleteByName​(@QueryParam("name")
                            String name)
        Deletes the server by name; NOTE: Using this parameter may generate an error if one or more servers share a non-unique name.
        Parameters:
        name - name of the server to be deleted
        Returns:
        server before the command is executed
      • getTypes

        @GET
        @Path("/common/lookup/list")
        Set<Option> getTypes()
        Retrieves the list of supported server types, for example Web/App Server and Database Server. In most cases, id or name will be used for editServerType(long, java.lang.String).
        Returns:
        supported server types
      • editServerDescription

        @GET
        @Path("/grid/server/edit")
        Server editServerDescription​(@QueryParam("id")
                                     long id,
                                     @QueryParam("description")
                                     String newDescription)
        Edits an existing server
        Parameters:
        id - id of the existing server
        newDescription - description to replace the current one
        Returns:
        edited server
      • editServerRam

        @GET
        @Path("/grid/server/edit")
        Server editServerRam​(@QueryParam("id")
                             long id,
                             @QueryParam("server.ram")
                             String ram)
        Edits an existing server
        Parameters:
        id - id of the existing server
        ram - ram to replace the current one
        Returns:
        edited server
      • editServerType

        @GET
        @Path("/grid/server/edit")
        Server editServerType​(@QueryParam("id")
                              long id,
                              @QueryParam("server.type")
                              String newType)
        Edits an existing server
        Parameters:
        id - id of the existing server
        newType - type to replace the current one
        Returns:
        edited server