1818
1919import java .io .Serializable ;
2020import java .util .ArrayList ;
21+ import java .util .Date ;
2122import java .util .List ;
2223
2324import com .cloud .network .as .AutoScalePolicy ;
2425import com .cloud .network .as .AutoScaleVmGroup ;
25- import com .cloud .network .as .AutoScaleVmProfile ;
2626import com .cloud .network .as .Condition ;
2727import com .cloud .network .as .Counter ;
28- import com .cloud .network .lb .LoadBalancingRule .LbAutoScalePolicy ;
29- import com .cloud .network .lb .LoadBalancingRule .LbAutoScaleVmGroup ;
30- import com .cloud .network .lb .LoadBalancingRule .LbAutoScaleVmProfile ;
31- import com .cloud .network .lb .LoadBalancingRule .LbCondition ;
3228import com .cloud .network .lb .LoadBalancingRule .LbDestination ;
3329import com .cloud .network .lb .LoadBalancingRule .LbHealthCheckPolicy ;
3430import com .cloud .network .lb .LoadBalancingRule .LbSslCert ;
@@ -377,46 +373,64 @@ public String getMonitorState() {
377373
378374 public static class CounterTO implements Serializable {
379375 private static final long serialVersionUID = 2L ;
376+ private final Long id ;
380377 private final String name ;
381- private final String source ;
378+ private final Counter . Source source ;
382379 private final String value ;
380+ private final String provider ;
383381
384- public CounterTO (String name , String source , String value ) {
382+ public CounterTO (Long id , String name , Counter .Source source , String value , String provider ) {
383+ this .id = id ;
385384 this .name = name ;
386385 this .source = source ;
387386 this .value = value ;
387+ this .provider = provider ;
388+ }
389+
390+ public Long getId () {
391+ return id ;
388392 }
389393
390394 public String getName () {
391395 return name ;
392396 }
393397
394- public String getSource () {
398+ public Counter . Source getSource () {
395399 return source ;
396400 }
397401
398402 public String getValue () {
399403 return value ;
400404 }
405+
406+ public String getProvider () {
407+ return provider ;
408+ }
401409 }
402410
403411 public static class ConditionTO implements Serializable {
404412 private static final long serialVersionUID = 2L ;
413+ private final Long id ;
405414 private final long threshold ;
406- private final String relationalOperator ;
415+ private final Condition . Operator relationalOperator ;
407416 private final CounterTO counter ;
408417
409- public ConditionTO (long threshold , String relationalOperator , CounterTO counter ) {
418+ public ConditionTO (Long id , long threshold , Condition .Operator relationalOperator , CounterTO counter ) {
419+ this .id = id ;
410420 this .threshold = threshold ;
411421 this .relationalOperator = relationalOperator ;
412422 this .counter = counter ;
413423 }
414424
425+ public Long getId () {
426+ return id ;
427+ }
428+
415429 public long getThreshold () {
416430 return threshold ;
417431 }
418432
419- public String getRelationalOperator () {
433+ public Condition . Operator getRelationalOperator () {
420434 return relationalOperator ;
421435 }
422436
@@ -430,14 +444,16 @@ public static class AutoScalePolicyTO implements Serializable {
430444 private final long id ;
431445 private final int duration ;
432446 private final int quietTime ;
433- private String action ;
447+ private final Date lastQuietTime ;
448+ private AutoScalePolicy .Action action ;
434449 boolean revoked ;
435450 private final List <ConditionTO > conditions ;
436451
437- public AutoScalePolicyTO (long id , int duration , int quietTime , String action , List <ConditionTO > conditions , boolean revoked ) {
452+ public AutoScalePolicyTO (long id , int duration , int quietTime , Date lastQuietTime , AutoScalePolicy . Action action , List <ConditionTO > conditions , boolean revoked ) {
438453 this .id = id ;
439454 this .duration = duration ;
440455 this .quietTime = quietTime ;
456+ this .lastQuietTime = lastQuietTime ;
441457 this .conditions = conditions ;
442458 this .action = action ;
443459 this .revoked = revoked ;
@@ -455,7 +471,11 @@ public int getQuietTime() {
455471 return quietTime ;
456472 }
457473
458- public String getAction () {
474+ public Date getLastQuietTime () {
475+ return lastQuietTime ;
476+ }
477+
478+ public AutoScalePolicy .Action getAction () {
459479 return action ;
460480 }
461481
@@ -476,7 +496,7 @@ public static class AutoScaleVmProfileTO implements Serializable {
476496 private final String templateId ;
477497 private final String otherDeployParams ;
478498 private final List <Pair <String , String >> counterParamList ;
479- private final Integer destroyVmGraceperiod ;
499+ private final Integer expungeVmGracePeriod ;
480500 private final String cloudStackApiUrl ;
481501 private final String autoScaleUserApiKey ;
482502 private final String autoScaleUserSecretKey ;
@@ -485,14 +505,14 @@ public static class AutoScaleVmProfileTO implements Serializable {
485505
486506 public AutoScaleVmProfileTO (String zoneId , String domainId , String cloudStackApiUrl , String autoScaleUserApiKey , String autoScaleUserSecretKey ,
487507 String serviceOfferingId , String templateId , String vmName , String networkId , String otherDeployParams , List <Pair <String , String >> counterParamList ,
488- Integer destroyVmGraceperiod ) {
508+ Integer expungeVmGracePeriod ) {
489509 this .zoneId = zoneId ;
490510 this .domainId = domainId ;
491511 this .serviceOfferingId = serviceOfferingId ;
492512 this .templateId = templateId ;
493513 this .otherDeployParams = otherDeployParams ;
494514 this .counterParamList = counterParamList ;
495- this .destroyVmGraceperiod = destroyVmGraceperiod ;
515+ this .expungeVmGracePeriod = expungeVmGracePeriod ;
496516 this .cloudStackApiUrl = cloudStackApiUrl ;
497517 this .autoScaleUserApiKey = autoScaleUserApiKey ;
498518 this .autoScaleUserSecretKey = autoScaleUserSecretKey ;
@@ -524,8 +544,8 @@ public List<Pair<String, String>> getCounterParamList() {
524544 return counterParamList ;
525545 }
526546
527- public Integer getDestroyVmGraceperiod () {
528- return destroyVmGraceperiod ;
547+ public Integer getExpungeVmGracePeriod () {
548+ return expungeVmGracePeriod ;
529549 }
530550
531551 public String getCloudStackApiUrl () {
@@ -551,18 +571,22 @@ public String getNetworkId() {
551571
552572 public static class AutoScaleVmGroupTO implements Serializable {
553573 private static final long serialVersionUID = 2L ;
574+
575+ private final Long id ;
554576 private final String uuid ;
555577 private final int minMembers ;
556578 private final int maxMembers ;
557579 private final int memberPort ;
558580 private final int interval ;
559581 private final List <AutoScalePolicyTO > policies ;
560582 private final AutoScaleVmProfileTO profile ;
561- private final String state ;
562- private final String currentState ;
583+ private final AutoScaleVmGroup .State state ;
584+ private final AutoScaleVmGroup .State currentState ;
585+ private final Long loadBalancerId ;
563586
564- AutoScaleVmGroupTO (String uuid , int minMembers , int maxMembers , int memberPort , int interval , List <AutoScalePolicyTO > policies , AutoScaleVmProfileTO profile ,
565- String state , String currentState ) {
587+ public AutoScaleVmGroupTO (Long id , String uuid , int minMembers , int maxMembers , int memberPort , int interval , List <AutoScalePolicyTO > policies , AutoScaleVmProfileTO profile ,
588+ AutoScaleVmGroup .State state , AutoScaleVmGroup .State currentState , Long loadBalancerId ) {
589+ this .id = id ;
566590 this .uuid = uuid ;
567591 this .minMembers = minMembers ;
568592 this .maxMembers = maxMembers ;
@@ -572,6 +596,11 @@ public static class AutoScaleVmGroupTO implements Serializable {
572596 this .profile = profile ;
573597 this .state = state ;
574598 this .currentState = currentState ;
599+ this .loadBalancerId = loadBalancerId ;
600+ }
601+
602+ public Long getId () {
603+ return id ;
575604 }
576605
577606 public String getUuid () {
@@ -602,44 +631,16 @@ public AutoScaleVmProfileTO getProfile() {
602631 return profile ;
603632 }
604633
605- public String getState () {
634+ public AutoScaleVmGroup . State getState () {
606635 return state ;
607636 }
608637
609- public String getCurrentState () {
638+ public AutoScaleVmGroup . State getCurrentState () {
610639 return currentState ;
611640 }
612- }
613641
614- public void setAutoScaleVmGroup (LbAutoScaleVmGroup lbAutoScaleVmGroup ) {
615- List <LbAutoScalePolicy > lbAutoScalePolicies = lbAutoScaleVmGroup .getPolicies ();
616- List <AutoScalePolicyTO > autoScalePolicyTOs = new ArrayList <AutoScalePolicyTO >(lbAutoScalePolicies .size ());
617- for (LbAutoScalePolicy lbAutoScalePolicy : lbAutoScalePolicies ) {
618- List <LbCondition > lbConditions = lbAutoScalePolicy .getConditions ();
619- List <ConditionTO > conditionTOs = new ArrayList <ConditionTO >(lbConditions .size ());
620- for (LbCondition lbCondition : lbConditions ) {
621- Counter counter = lbCondition .getCounter ();
622- CounterTO counterTO = new CounterTO (counter .getName (), counter .getSource ().toString (), "" + counter .getValue ());
623- Condition condition = lbCondition .getCondition ();
624- ConditionTO conditionTO = new ConditionTO (condition .getThreshold (), condition .getRelationalOperator ().toString (), counterTO );
625- conditionTOs .add (conditionTO );
626- }
627- AutoScalePolicy autoScalePolicy = lbAutoScalePolicy .getPolicy ();
628- autoScalePolicyTOs .add (new AutoScalePolicyTO (autoScalePolicy .getId (), autoScalePolicy .getDuration (), autoScalePolicy .getQuietTime (),
629- autoScalePolicy .getAction (), conditionTOs , lbAutoScalePolicy .isRevoked ()));
630- }
631- LbAutoScaleVmProfile lbAutoScaleVmProfile = lbAutoScaleVmGroup .getProfile ();
632- AutoScaleVmProfile autoScaleVmProfile = lbAutoScaleVmProfile .getProfile ();
633-
634- AutoScaleVmProfileTO autoScaleVmProfileTO =
635- new AutoScaleVmProfileTO (lbAutoScaleVmProfile .getZoneId (), lbAutoScaleVmProfile .getDomainId (), lbAutoScaleVmProfile .getCsUrl (),
636- lbAutoScaleVmProfile .getAutoScaleUserApiKey (), lbAutoScaleVmProfile .getAutoScaleUserSecretKey (), lbAutoScaleVmProfile .getServiceOfferingId (),
637- lbAutoScaleVmProfile .getTemplateId (), lbAutoScaleVmProfile .getVmName (), lbAutoScaleVmProfile .getNetworkId (), autoScaleVmProfile .getOtherDeployParams (),
638- autoScaleVmProfile .getCounterParams (), autoScaleVmProfile .getDestroyVmGraceperiod ());
639-
640- AutoScaleVmGroup autoScaleVmGroup = lbAutoScaleVmGroup .getVmGroup ();
641- autoScaleVmGroupTO =
642- new AutoScaleVmGroupTO (autoScaleVmGroup .getUuid (), autoScaleVmGroup .getMinMembers (), autoScaleVmGroup .getMaxMembers (), autoScaleVmGroup .getMemberPort (),
643- autoScaleVmGroup .getInterval (), autoScalePolicyTOs , autoScaleVmProfileTO , autoScaleVmGroup .getState (), lbAutoScaleVmGroup .getCurrentState ());
642+ public Long getLoadBalancerId () {
643+ return loadBalancerId ;
644+ }
644645 }
645646}
0 commit comments