示例#1
0
  public static org.openstack.atlas.docs.loadbalancers.api.management.v1.LoadBalancerUsageRecord
      toMgmtApiUsage(Usage dusage) {
    org.openstack.atlas.docs.loadbalancers.api.management.v1.LoadBalancerUsageRecord rusage =
        new org.openstack.atlas.docs.loadbalancers.api.management.v1.LoadBalancerUsageRecord();
    if (dusage == null) {
      return null;
    }

    rusage.setId(dusage.getId());
    rusage.setAccountId(dusage.getAccountId());
    rusage.setLoadBalancerId(dusage.getLoadbalancer().getId());
    rusage.setAverageNumConnections(dusage.getAverageConcurrentConnections());
    rusage.setIncomingTransfer(dusage.getIncomingTransfer());
    rusage.setOutgoingTransfer(dusage.getOutgoingTransfer());
    rusage.setAverageNumConnectionsSsl(dusage.getAverageConcurrentConnectionsSsl());
    rusage.setIncomingTransferSsl(dusage.getIncomingTransferSsl());
    rusage.setOutgoingTransferSsl(dusage.getOutgoingTransferSsl());
    rusage.setNumVips(dusage.getNumVips());
    rusage.setNumPolls(dusage.getNumberOfPolls());
    rusage.setStartTime(dusage.getStartTime());
    rusage.setEndTime(dusage.getEndTime());
    rusage.setEventType(dusage.getEventType());

    BitTags bitTags = new BitTags(dusage.getTags());

    rusage.setSslMode(SslMode.getMode(bitTags).name());

    if (bitTags.isTagOn(BitTag.SERVICENET_LB)) {
      rusage.setVipType(VipType.SERVICENET);
    } else {
      rusage.setVipType(VipType.PUBLIC);
    }

    return rusage;
  }
示例#2
0
 public static LoadBalancerUsageRecord rndCurrentUsage() {
   LoadBalancerUsageRecord usage = new LoadBalancerUsageRecord();
   usage.setIncomingTransfer((long) rndInt(0, 1000000000));
   usage.setOutgoingTransfer((long) rndInt(0, 1000000000));
   return usage;
 }