Package com.abiquo.server.core.enterprise

Examples of com.abiquo.server.core.enterprise.DatacentersLimitsDto


    *      > http://community.abiquo.com/display/ABI20/DatacenterLimitsResource#
    *      DatacenterLimitsResource-Retrievelimitsbyenterprise</a>
    * @return List of datacenter limits by enterprise.
    */
   public List<Limits> listLimits() {
      DatacentersLimitsDto dto = context.getApi().getEnterpriseApi().listLimits(this.unwrap());
      return wrap(context, Limits.class, dto.getCollection());
   }
View Full Code Here


         // Save new limits
         dto = context.getApi().getEnterpriseApi().createLimits(target, datacenter.unwrap(), limits.unwrap());
      } catch (AbiquoException ex) {
         // Controlled error to allow duplicated authorizations
         if (ex.hasError("LIMIT-7")) {
            DatacentersLimitsDto limits = context.getApi().getEnterpriseApi().getLimits(target, datacenter.unwrap());
            // Should be only one limit
            dto = limits.getCollection().get(0);
         } else {
            throw ex;
         }
      }
View Full Code Here

    *      Resource# DatacenterLimitsResource-
    *      Deleteanexistinglimitforanenterpriseinadatacenter</a>
    */
   public void prohibitDatacenter(final Datacenter datacenter) {
      // Get limits
      DatacentersLimitsDto dto = context.getApi().getEnterpriseApi().getLimits(target, datacenter.unwrap());

      // Delete limits (if any)
      if (dto != null && !dto.isEmpty()) {
         // Should be only one limit
         context.getApi().getEnterpriseApi().deleteLimits(dto.getCollection().get(0));
      }
   }
View Full Code Here

      return "Enterprise [id=" + getId() + ", isReservationRestricted=" + getIsReservationRestricted() + ", name="
            + getName() + "]";
   }

   private DatacenterLimitsDto getLimits(final Datacenter datacenter) {
      DatacentersLimitsDto limits = context.getApi().getEnterpriseApi().listLimits(target);

      return Iterables.find(limits.getCollection(), new Predicate<DatacenterLimitsDto>() {
         @Override
         public boolean apply(final DatacenterLimitsDto input) {
            RESTLink datacenterLink = input.searchLink("datacenter");
            return datacenterLink != null
                  && datacenterLink.getHref().equals(datacenter.unwrap().getEditLink().getHref());
View Full Code Here

      enterprise.save();

      limits = enterprise.allowDatacenter(env.datacenter);
      assertNotNull(limits);

      DatacentersLimitsDto limitsDto = env.enterpriseApi.getLimits(enterprise.unwrap(), env.datacenter.unwrap());
      assertNotNull(limitsDto);
      assertEquals(limitsDto.getCollection().size(), 1);
   }
View Full Code Here

      // Allow the datacenter again and check that the configuration has not
      // changed
      Limits limits = enterprise.allowDatacenter(env.datacenter);
      assertNotNull(limits);

      DatacentersLimitsDto limitsDto = env.enterpriseApi.getLimits(enterprise.unwrap(), env.datacenter.unwrap());
      assertNotNull(limitsDto);
      assertEquals(limitsDto.getCollection().size(), 1);
   }
View Full Code Here

   public void testUpdateLimits() {
      limits.setCpuCountLimits(4, 5);
      limits.update();

      DatacentersLimitsDto limitsDto = env.enterpriseApi.getLimits(enterprise.unwrap(), env.datacenter.unwrap());
      assertNotNull(limitsDto);
      assertEquals(limitsDto.getCollection().size(), 1);
      assertEquals(limitsDto.getCollection().get(0).getCpuCountHardLimit(), 5);
      assertEquals(limitsDto.getCollection().get(0).getCpuCountSoftLimit(), 4);
   }
View Full Code Here

    *      > http://community.abiquo.com/display/ABI20/DatacenterResource#
    *      DatacenterResource- Retrievelimitsbydatacenter</a>
    * @return List of datacenter limits by all enterprises.
    */
   public List<Limits> listLimits() {
      DatacentersLimitsDto dto = context.getApi().getInfrastructureApi().listLimits(this.unwrap());
      return DomainWrapper.wrap(context, Limits.class, dto.getCollection());
   }
View Full Code Here

    *      > http://community.abiquo.com/display/ABI20/DatacenterLimitsResource#
    *      DatacenterLimitsResource-Retrievelimitsbyenterprise</a>
    * @return List of datacenter limits by enterprise.
    */
   public List<Limits> listLimits() {
      DatacentersLimitsDto dto = context.getApi().getEnterpriseApi().listLimits(this.unwrap());
      return wrap(context, Limits.class, dto.getCollection());
   }
View Full Code Here

         // Save new limits
         dto = context.getApi().getEnterpriseApi().createLimits(target, datacenter.unwrap(), limits.unwrap());
      } catch (AbiquoException ex) {
         // Controlled error to allow duplicated authorizations
         if (ex.hasError("LIMIT-7")) {
            DatacentersLimitsDto limits = context.getApi().getEnterpriseApi().getLimits(target, datacenter.unwrap());
            // Should be only one limit
            dto = limits.getCollection().get(0);
         } else {
            throw ex;
         }
      }
View Full Code Here

TOP

Related Classes of com.abiquo.server.core.enterprise.DatacentersLimitsDto

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.