Interface InstanceApi


  • public interface InstanceApi
    This API is for creating, listing, and deleting an Instance, and allows enabling a root user.
    See Also:
    Instance
    • Method Detail

      • create

        @Named("instance:create")
        @POST
        @Path("/instances")
        @Consumes("application/json")
        Instance create​(int flavor,
                        int volumeSize,
                        String name)
        Same as create(String, int, String) but accept an integer Flavor ID.
        Parameters:
        flavor - The flavor ID.
        volumeSize - The size in GB of the instance volume.
        name - The name of the instance.
        Returns:
        The instance created.
        See Also:
        create(String, int, String)
      • create

        @Named("instance:create")
        @POST
        @Path("/instances")
        @Consumes("application/json")
        Instance create​(String flavor,
                        int volumeSize,
                        String name)
        Create a database instance by flavor type and volume size.
        Parameters:
        flavor - The flavor URL or flavor id as string.
        volumeSize - The size in GB of the instance volume.
        name - The name of the instance.
        Returns:
        The instance created.
      • delete

        @Named("instances:delete/{id}")
        @DELETE
        @Path("/instances/{id}")
        @Consumes("application/json")
        boolean delete​(@PathParam("id")
                       String instanceId)
        Deletes an Instance by id.
        Parameters:
        instanceId - The instance id.
        Returns:
        true if successful.
      • enableRoot

        @Named("instances/{id}/root")
        @POST
        @Path("/instances/{id}/root")
        @Consumes("application/json")
        String enableRoot​(@PathParam("id")
                          String instanceId)
        Enables root for an instance.
        Parameters:
        instanceId - The instance id.
        Returns:
        String The password for the root user.
      • isRooted

        @Named("instances/{id}/root")
        @GET
        @Path("/instances/{id}/root")
        @Consumes("application/json")
        boolean isRooted​(@PathParam("id")
                         String instanceId)
        Checks to see if root is enabled for an instance.
        Parameters:
        instanceId - The instance id.
        Returns:
        boolean True if root is enabled.
        Throws:
        ResourceNotFoundException
      • list

        @Named("instance:list")
        @GET
        @Path("/instances")
        @Consumes("application/json")
        com.google.common.collect.FluentIterable<Instance> list()
        Returns a summary list of Instances.
        Returns:
        The list of Instances.
      • get

        @Named("instances:get/{id}")
        @GET
        @Path("/instances/{id}")
        @Consumes("application/json")
        @Nullable
        Instance get​(@PathParam("id")
                     String instanceId)
        Returns an Instance by id.
        Parameters:
        instanceId - The instance id.
        Returns:
        Instance or Null on not found.