Package com.abiquo.model.rest

Examples of com.abiquo.model.rest.RESTLink


   }

   public VirtualMachineTemplateTask makePersistent(final VirtualDatacenter vdc, final Tier tier,
         final String persistentTemplateName, final String persistentVolumeName) {
      // infrastructure
      RESTLink storageLink = tier.unwrap().getEditLink();
      if (storageLink == null) {
         // cloud
         storageLink = tier.unwrap().searchLink("self");
      }
      storageLink.setRel(ParentLinkName.TIER);
      return makePersistent(vdc, storageLink, persistentTemplateName, persistentVolumeName);
   }
View Full Code Here


   private VirtualMachineTemplateTask makePersistent(final VirtualDatacenter vdc, final RESTLink storageLink,
         final String persistentTemplateName, final String persistentVolumeName) {
      VirtualMachineTemplatePersistentDto persistentData = new VirtualMachineTemplatePersistentDto();
      persistentData.setPersistentTemplateName(persistentTemplateName);
      persistentData.setPersistentVolumeName(persistentVolumeName);
      RESTLink vdcLink = new RESTLink(ParentLinkName.VIRTUAL_DATACENTER, vdc.unwrap().getEditLink().getHref());
      RESTLink templateLink = new RESTLink(ParentLinkName.VIRTUAL_MACHINE_TEMPLATE, target.getEditLink().getHref());

      persistentData.addLink(vdcLink);
      persistentData.addLink(storageLink);
      persistentData.addLink(templateLink);
View Full Code Here

      binder.getNewEndpoint(null, new Object());
   }

   public void testGetNewEnpoint() throws Exception {
      DatacenterDto datacenter = new DatacenterDto();
      datacenter.addLink(new RESTLink("devices", "http://foo/bar"));

      BindSupportedDevicesLinkToPath binder = new BindSupportedDevicesLinkToPath();

      Invokable<?, ?> withEndpointLink = method(InfrastructureApi.class, "listSupportedStorageDevices",
            DatacenterDto.class);
View Full Code Here

      SingleResourceTransportDto[] dtos = (SingleResourceTransportDto[]) input;
      LinksDto refs = new LinksDto();

      for (SingleResourceTransportDto dto : dtos) {
         RESTLink editLink = checkNotNull(dto.getEditLink(), "entity must have an edit link");

         // Do not add repeated references
         if (refs.searchLinkByHref(editLink.getHref()) == null) {
            refs.addLink(new RESTLink(getRelToUse(input), editLink.getHref()));
         }
      }

      return super.bindToRequest(request, refs);
   }
View Full Code Here

   /**
    * Refresh the state of the task.
    */
   @Override
   public void refresh() {
      RESTLink self = checkNotNull(target.searchLink("self"), ValidationErrors.MISSING_REQUIRED_LINK + "self");

      target = context.getApi().getTaskApi().getTask(self);
   }
View Full Code Here

      target = context.getApi().getTaskApi().getTask(self);
   }

   public T getResult() {
      RESTLink link = target.searchLink(ParentLinkName.TASK_RESULT);
      if (link == null) {
         // The task may still be in progress or has failed
         return null;
      }
View Full Code Here

    * @param dto
    *           The target dto.
    * @return The link to the current resource.
    */
   public static RESTLink getSelfLink(final SingleResourceTransportDto dto) {
      RESTLink link = dto.searchLink("edit");
      return link == null ? dto.searchLink("self") : link;
   }
View Full Code Here

      vm.setId(5);
      vm.setVdrpPort(22);
      vm.setRam(2048);
      vm.setCpu(2);
      vm.setState(VirtualMachineState.ON);
      vm.addLink(new RESTLink("edit", "http://foo/bar"));

      privNic = new PrivateIpDto();
      privNic.setIp("192.168.1.2");
      privNic.setMac("2a:6e:40:69:84:e0");
View Full Code Here

      // Only conversions have a status
      builder.status(Status.AVAILABLE);
      builder.backendStatus(Status.AVAILABLE.name()); // Abiquo images do not
                                                      // have a status

      RESTLink downloadLink = template.unwrap().searchLink("diskfile");
      builder.uri(downloadLink == null ? null : URI.create(downloadLink.getHref()));

      // TODO: Operating system not implemented in Abiquo Templates
      // TODO: Image credentials still not present in Abiquo template metadata
      // Will be added in Abiquo 2.4:
      // http://jira.abiquo.com/browse/ABICLOUDPREMIUM-3647
View Full Code Here

    *      > http://community.abiquo.com/display/ABI20/VirtualApplianceResource#
    *      VirtualApplianceResource-Retrieveavirtualappliance</a>
    * @return The virtual appliance where this virtual machine is.
    */
   public VirtualAppliance getVirtualAppliance() {
      RESTLink link = checkNotNull(target.searchLink(ParentLinkName.VIRTUAL_APPLIANCE),
            ValidationErrors.MISSING_REQUIRED_LINK + " " + ParentLinkName.VIRTUAL_APPLIANCE);

      HttpResponse response = context.getApi().get(link);

      ParseXMLWithJAXB<VirtualApplianceDto> parser = new ParseXMLWithJAXB<VirtualApplianceDto>(context.utils().xml(),
View Full Code Here

TOP

Related Classes of com.abiquo.model.rest.RESTLink

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.