Interface VolumeApi


  • public interface VolumeApi
    Provides synchronous access to cloudstack via their REST API.

    See Also:
    • Method Detail

      • listVolumes

        @Named("listVolumes")
        @GET
        @Consumes("application/json")
        Set<Volume> listVolumes​(ListVolumesOptions... options)
        List volumes
        Returns:
        volume list, empty if not found
      • getVolume

        @Named("listVolumes")
        @GET
        @Consumes("application/json")
        Volume getVolume​(@QueryParam("id")
                         String id)
        Get volume by id
        Parameters:
        id - the volume id to retrieve
        Returns:
        volume or null if not found
      • createVolumeFromDiskOfferingInZone

        @Named("createVolume")
        @GET
        @Consumes("application/json")
        AsyncCreateResponse createVolumeFromDiskOfferingInZone​(@QueryParam("name")
                                                               String name,
                                                               @QueryParam("diskofferingid")
                                                               String diskOfferingId,
                                                               @QueryParam("zoneid")
                                                               String zoneId)
        Create a volume with given name and diskOfferingId
        Parameters:
        name - name of the volume
        diskOfferingId - the ID of the disk offering.
        zoneId - the ID of the availability zone
        Returns:
        AsyncCreateResponse job response used to track creation
      • createVolumeFromCustomDiskOfferingInZone

        @GET
        @Consumes("application/json")
        AsyncCreateResponse createVolumeFromCustomDiskOfferingInZone​(@QueryParam("name")
                                                                     String name,
                                                                     @QueryParam("diskofferingid")
                                                                     String diskOfferingId,
                                                                     @QueryParam("zoneid")
                                                                     String zoneId,
                                                                     @QueryParam("size")
                                                                     int size)
        Create a volume with given name, size and diskOfferingId
        Parameters:
        name - name of the volume
        diskOfferingId - the ID of the disk offering (the offering should have the custom disk size flag set)
        zoneId - the ID of the availability zone
        size - the size of volume required (in GB)
        Returns:
        AsyncCreateResponse job response used to track creation
      • createVolumeFromSnapshotInZone

        @Named("createVolume")
        @GET
        @Consumes("application/json")
        AsyncCreateResponse createVolumeFromSnapshotInZone​(@QueryParam("name")
                                                           String name,
                                                           @QueryParam("snapshotid")
                                                           String snapshotId,
                                                           @QueryParam("zoneid")
                                                           String zoneId)
        Create a volume with given name and snapshotId
        Parameters:
        name - name of the volume
        snapshotId - Snapshot id to be used while creating the volume
        zoneId - the ID of the availability zone
        Returns:
        AsyncCreateResponse job response used to track creation
      • attachVolume

        @Named("attachVolume")
        @GET
        @Consumes("application/json")
        AsyncCreateResponse attachVolume​(@QueryParam("id")
                                         String volumeId,
                                         @QueryParam("virtualmachineid")
                                         String virtualMachineId)
        Attaches a disk volume to a virtual machine.
        Parameters:
        volumeId - the ID of the disk volume
        virtualMachineId - the ID of the virtual machine
        Returns:
        AsyncCreateResponse job response used to track creation
      • detachVolume

        @Named("detachVolume")
        @GET
        @Consumes("application/json")
        AsyncCreateResponse detachVolume​(@QueryParam("id")
                                         String volumeId)
        Detaches a disk volume from a virtual machine.
        Parameters:
        volumeId - the ID of the disk volume
        Returns:
        AsyncCreateResponse job response used to track creation
      • deleteVolume

        @Named("deleteVolume")
        @GET
        void deleteVolume​(@QueryParam("id")
                          String id)
        Deletes a detached disk volume
        Parameters:
        id - id of the volume