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;
  }
  public static LoadBalancerUsageRecord toRestApiUsage(Usage dusage) {
    LoadBalancerUsageRecord rusage = new LoadBalancerUsageRecord();
    if (dusage == null) {
      return null;
    }

    rusage.setId(dusage.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;
  }