@@ -23,64 +23,59 @@ def cli(env, identifier):
2323 table = formatting .KeyValueTable (['name' , 'value' ])
2424 table .align ['name' ] = 'l'
2525 table .align ['value' ] = 'l'
26- table .add_row (['General properties' , '----------' ])
27- table .add_row ([' ID' , 'local:%s' % load_balancer ['id' ]])
28- table .add_row ([' IP Address' , load_balancer ['ipAddress' ]['ipAddress' ]])
26+ table .add_row (['ID' , 'local:%s' % load_balancer ['id' ]])
27+ table .add_row (['IP Address' , load_balancer ['ipAddress' ]['ipAddress' ]])
2928 name = load_balancer ['loadBalancerHardware' ][0 ]['datacenter' ]['name' ]
30- table .add_row ([' Datacenter' , name ])
31- table .add_row ([' Connections limit' , load_balancer ['connectionLimit' ]])
32- table .add_row ([' Dedicated' , load_balancer ['dedicatedFlag' ]])
33- table .add_row ([' HA' , load_balancer ['highAvailabilityFlag' ]])
34- table .add_row ([' SSL Enabled' , load_balancer ['sslEnabledFlag' ]])
35- table .add_row ([' SSL Active' , load_balancer ['sslActiveFlag' ]])
29+ table .add_row (['Datacenter' , name ])
30+ table .add_row (['Connections limit' , load_balancer ['connectionLimit' ]])
31+ table .add_row (['Dedicated' , load_balancer ['dedicatedFlag' ]])
32+ table .add_row (['HA' , load_balancer ['highAvailabilityFlag' ]])
33+ table .add_row (['SSL Enabled' , load_balancer ['sslEnabledFlag' ]])
34+ table .add_row (['SSL Active' , load_balancer ['sslActiveFlag' ]])
35+
3636 index0 = 1
3737 for virtual_server in load_balancer ['virtualServers' ]:
38- table .add_row (['Service group %s' % index0 ,
39- '**************' ])
40- index0 += 1
41- table2 = formatting .Table (['Service group ID' ,
42- 'Port' ,
43- 'Allocation' ,
44- 'Routing type' ,
45- 'Routing Method' ])
46-
4738 for group in virtual_server ['serviceGroups' ]:
48- table2 .add_row ([
49- '%s:%s' % (load_balancer ['id' ], virtual_server ['id' ]),
50- virtual_server ['port' ],
51- '%s %%' % virtual_server ['allocation' ],
52- '%s:%s' % (group ['routingTypeId' ],
53- group ['routingType' ]['name' ]),
54- '%s:%s' % (group ['routingMethodId' ],
55- group ['routingMethod' ]['name' ])
56- ])
39+ service_group_table = formatting .KeyValueTable (['name' , 'value' ])
40+
41+ table .add_row (['Service Group %s' % index0 , service_group_table ])
42+ index0 += 1
5743
58- table .add_row ([' Group Properties' , table2 ])
44+ service_group_table .add_row (['Guest ID' ,
45+ virtual_server ['id' ]])
46+ service_group_table .add_row (['Port' , virtual_server ['port' ]])
47+ service_group_table .add_row (['Allocation' ,
48+ '%s %%' %
49+ virtual_server ['allocation' ]])
50+ service_group_table .add_row (['Routing Type' ,
51+ '%s:%s' %
52+ (group ['routingTypeId' ],
53+ group ['routingType' ]['name' ])])
54+ service_group_table .add_row (['Routing Method' ,
55+ '%s:%s' %
56+ (group ['routingMethodId' ],
57+ group ['routingMethod' ]['name' ])])
5958
60- table3 = formatting .Table (['Service_ID' ,
61- 'IP Address' ,
62- 'Port' ,
63- 'Health Check' ,
64- 'Weight' ,
65- 'Enabled' ,
66- 'Status' ])
67- service_exist = False
59+ index1 = 1
6860 for service in group ['services' ]:
69- service_exist = True
61+ service_table = formatting .KeyValueTable (['name' , 'value' ])
62+
63+ service_group_table .add_row (['Service %s' % index1 ,
64+ service_table ])
65+ index1 += 1
66+
7067 health_check = service ['healthChecks' ][0 ]
71- table3 .add_row ([
72- '%s:%s' % (load_balancer ['id' ], service ['id' ]),
73- service ['ipAddress' ]['ipAddress' ],
74- service ['port' ],
75- '%s:%s' % (health_check ['healthCheckTypeId' ],
76- health_check ['type' ]['name' ]),
77- service ['groupReferences' ][0 ]['weight' ],
78- service ['enabled' ],
79- service ['status' ]
80- ])
81- if service_exist :
82- table .add_row ([' Services' , table3 ])
83- else :
84- table .add_row ([' Services' , 'None' ])
68+ service_table .add_row (['Service ID' , service ['id' ]])
69+ service_table .add_row (['IP Address' ,
70+ service ['ipAddress' ]['ipAddress' ]])
71+ service_table .add_row (['Port' , service ['port' ]])
72+ service_table .add_row (['Health Check' ,
73+ '%s:%s' %
74+ (health_check ['healthCheckTypeId' ],
75+ health_check ['type' ]['name' ])])
76+ service_table .add_row (
77+ ['Weight' , service ['groupReferences' ][0 ]['weight' ]])
78+ service_table .add_row (['Enabled' , service ['enabled' ]])
79+ service_table .add_row (['Status' , service ['status' ]])
8580
8681 env .fout (table )
0 commit comments