Package org.jclouds.softlayer.domain

Examples of org.jclouds.softlayer.domain.ProductOrder$ConcreteBuilder


      public Hardware getHardware(VirtualGuest guest) {
         // 'bad' orders have no start cpu's and cause the order lookup to fail.
         if (guest.getStartCpus() < 1)
            return null;
         ProductOrder order = api.getVirtualGuestApi().getOrderTemplate(guest.getId());
         if (order == null)
            return null;
         Iterable<ProductItem> items = Iterables.transform(order.getPrices(), ProductItems.item());
         return productItemsToHardware.apply(items);
      }
View Full Code Here


      public GetImageForVirtualGuest(SoftLayerApi api) {
         this.api = api;
      }

      public Image getImage(VirtualGuest guest) {
         ProductOrder order = null;
         // 'bad' orders have no start cpu's and cause the order lookup to fail.
         if (guest.getStartCpus() < 1)
            return null;
         try {
            order = api.getVirtualGuestApi().getOrderTemplate(guest.getId());
         } catch (SoftLayerOrderItemDuplicateException e) {
            // this is a workaround because SoftLayer throws sometimes 500 internal server errors for the above method call
            logger.warn(e, "Cannot get order template for virtualGuestId(%s)", guest.getId());
         }
         if (order == null)
            return null;
         Iterable<ProductItem> items = Iterables.transform(order.getPrices(), ProductItems.item());
         ProductItem os = Iterables.find(items, ProductItemPredicates.categoryCode("os"));
         return new ProductItemToImage().apply(os);
      }
View Full Code Here

      VirtualGuest guest = VirtualGuest.builder().hostname("myhost")
                                                 .domain("mydomain")
                                                 .build();

      ProductOrder order = ProductOrder.builder()
                                       .packageId(123)
                                       .location("loc456")
                                       .quantity(99)
                                       .useHourlyPricing(true)
                                       .prices(ImmutableSet.of(price1,price2))
View Full Code Here

         .add(ProductItemPrice.builder().id(58).itemId(52).recurringFee(0F).hourlyRecurringFee(0F).build())
         .add(ProductItemPrice.builder().id(420).itemId(309).recurringFee(0F).hourlyRecurringFee(0F).build())
         .add(ProductItemPrice.builder().id(418).itemId(307).recurringFee(0F).hourlyRecurringFee(0F).build())
         .build();

      ProductOrder order =  ProductOrder.builder()
            .quantity(0)
            .packageId(46)
            .useHourlyPricing(true)
            .prices(prices)
            .build();
View Full Code Here

      return order;
   }

   @Test
   public void test() {
      ProductOrder expects = expected();
      Function<HttpResponse, ProductOrder> parser = parser(injector());
      ProductOrder response = parser.apply(HttpResponse.builder().statusCode(200).message("ok").payload(payload()).build());
      assertEquals(response,expects);
      hasOs(response);
   }
View Full Code Here

      String domainName = template.getOptions().as(SoftLayerTemplateOptions.class).getDomainName();

      VirtualGuest newGuest = VirtualGuest.builder().domain(domainName).hostname(name).build();

      ProductOrder order = ProductOrder.builder().packageId(productPackageSupplier.get().getId())
            .location(template.getLocation().getId()).quantity(1).useHourlyPricing(true).prices(getPrices(template))
            .virtualGuests(newGuest).build();

      logger.debug(">> ordering new virtualGuest domain(%s) hostname(%s)", domainName, name);
      ProductOrderReceipt productOrderReceipt = client.getVirtualGuestApi().orderVirtualGuest(order);
View Full Code Here

         .add(ProductItemPrice.builder().id(58).itemId(52).recurringFee(0F).hourlyRecurringFee(0F).build())
         .add(ProductItemPrice.builder().id(420).itemId(309).recurringFee(0F).hourlyRecurringFee(0F).build())
         .add(ProductItemPrice.builder().id(418).itemId(307).recurringFee(0F).hourlyRecurringFee(0F).build())
         .build();

      ProductOrder order =  ProductOrder.builder()
            .quantity(0)
            .packageId(46)
            .useHourlyPricing(true)
            .prices(prices)
            .build();
View Full Code Here

      return order;
   }

   @Test
   public void test() {
      ProductOrder expects = expected();
      Function<HttpResponse, ProductOrder> parser = parser(injector());
      ProductOrder response = parser.apply(HttpResponse.builder().statusCode(200).message("ok").payload(payload()).build());
      assertEquals(response,expects);
      hasOs(response);
   }
View Full Code Here

      public Hardware getHardware(VirtualGuest guest) {
         // 'bad' orders have no start cpu's and cause the order lookup to fail.
         if (guest.getStartCpus() < 1)
            return null;
         ProductOrder order = client.getVirtualGuestClient().getOrderTemplate(guest.getId());
         if (order == null)
            return null;
         Iterable<ProductItem> items = Iterables.transform(order.getPrices(), ProductItems.item());
         return productItemsToHardware.apply(items);
      }
View Full Code Here

      public Image getImage(VirtualGuest guest) {
         // 'bad' orders have no start cpu's and cause the order lookup to fail.
         if (guest.getStartCpus() < 1)
            return null;
         ProductOrder order = client.getVirtualGuestClient().getOrderTemplate(guest.getId());
         if (order == null)
            return null;
         Iterable<ProductItem> items = Iterables.transform(order.getPrices(), ProductItems.item());
         ProductItem os = Iterables.find(items, ProductItemPredicates.categoryCode("os"));
         return new ProductItemToImage().apply(os);
      }
View Full Code Here

TOP

Related Classes of org.jclouds.softlayer.domain.ProductOrder$ConcreteBuilder

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.