Search in sources :

Example 6 with V3Link

use of org.ovirt.engine.api.v3.types.V3Link in project ovirt-engine by oVirt.

the class V3TemplateHelper method fixDiskLinks.

/**
 * Version 4 of the API can't reliably build the links for the "disks" collection because it has been removed,
 * so we need to remove all the links and re-add them explicitly.
 */
public static void fixDiskLinks(String templateId, V3Disk disk) {
    // Fix the link of the disk itself:
    disk.setHref(V3LinkHelper.linkHref("templates", templateId, "disks", disk.getId()));
    // Remove all the action links and add them again:
    V3Actions actions = disk.getActions();
    if (actions != null) {
        List<V3Link> links = actions.getLinks();
        links.clear();
        V3LinkHelper.addLink(links, "copy", "templates", templateId, "disks", disk.getId(), "copy");
        V3LinkHelper.addLink(links, "export", "templates", templateId, "disks", disk.getId(), "export");
    }
}
Also used : V3Actions(org.ovirt.engine.api.v3.types.V3Actions) V3Link(org.ovirt.engine.api.v3.types.V3Link)

Example 7 with V3Link

use of org.ovirt.engine.api.v3.types.V3Link in project ovirt-engine by oVirt.

the class V3VmHelper method fixDiskLinks.

/**
 * Version 4 of the API can't reliably build the links for the "disks" collection because it has been removed,
 * so we need to remove all the links and re-add them explicitly.
 */
public static void fixDiskLinks(String vmId, V3Disk disk) {
    // Fix the link of the disk itself:
    disk.setHref(V3LinkHelper.linkHref("vms", vmId, "disks", disk.getId()));
    // Remove all the action links and add them again:
    V3Actions actions = disk.getActions();
    if (actions != null) {
        List<V3Link> links = actions.getLinks();
        links.clear();
        V3LinkHelper.addLink(links, "activate", "vms", vmId, "disks", disk.getId(), "activate");
        V3LinkHelper.addLink(links, "deactivate", "vms", vmId, "disks", disk.getId(), "deactivate");
        V3LinkHelper.addLink(links, "export", "vms", vmId, "disks", disk.getId(), "export");
        V3LinkHelper.addLink(links, "move", "vms", vmId, "disks", disk.getId(), "move");
    }
    // Remove all the links and add them again:
    List<V3Link> links = disk.getLinks();
    links.clear();
    V3LinkHelper.addLink(links, "permissions", "vms", vmId, "disks", disk.getId(), "permissions");
    V3LinkHelper.addLink(links, "statistics", "vms", vmId, "disks", disk.getId(), "statistics");
}
Also used : V3Actions(org.ovirt.engine.api.v3.types.V3Actions) V3Link(org.ovirt.engine.api.v3.types.V3Link)

Example 8 with V3Link

use of org.ovirt.engine.api.v3.types.V3Link in project ovirt-engine by oVirt.

the class V3LinkOutAdapter method adapt.

@Override
public V3Link adapt(Link from) {
    V3Link to = new V3Link();
    to.setHref(from.getHref());
    to.setRel(from.getRel());
    return to;
}
Also used : V3Link(org.ovirt.engine.api.v3.types.V3Link)

Aggregations

V3Link (org.ovirt.engine.api.v3.types.V3Link)8 V3Actions (org.ovirt.engine.api.v3.types.V3Actions)2 IOException (java.io.IOException)1 List (java.util.List)1 Collectors.joining (java.util.stream.Collectors.joining)1 Consumes (javax.ws.rs.Consumes)1 GET (javax.ws.rs.GET)1 HEAD (javax.ws.rs.HEAD)1 POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1 PathParam (javax.ws.rs.PathParam)1 Produces (javax.ws.rs.Produces)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 Context (javax.ws.rs.core.Context)1 HttpHeaders (javax.ws.rs.core.HttpHeaders)1 Response (javax.ws.rs.core.Response)1 UriInfo (javax.ws.rs.core.UriInfo)1 Actionable (org.ovirt.engine.api.model.Actionable)1 Link (org.ovirt.engine.api.model.Link)1 Tag (org.ovirt.engine.api.model.Tag)1