|
8 | 8 | from SoftLayer.CLI import environment |
9 | 9 | from SoftLayer.CLI import formatting |
10 | 10 |
|
11 | | -volume_size = ['20', '40', '80', '100', '250', '500', '1000', '2000-3000', '4000-7000', '8000-9000', '10000-12000'] |
| 11 | + |
| 12 | +PACKAGE_STORAGE = 759 |
12 | 13 |
|
13 | 14 |
|
14 | 15 | @click.command(cls=SLCommand) |
15 | 16 | @environment.pass_env |
16 | 17 | def cli(env): |
17 | 18 | """List all options for ordering a file storage""" |
18 | 19 |
|
19 | | - network_manager = SoftLayer.NetworkManager(env.client) |
20 | | - datacenters = network_manager.get_datacenter() |
21 | | - |
22 | | - table = formatting.Table(['Name', 'Value'], title='Volume table') |
23 | | - |
24 | | - table.add_row(['Storage Type', 'performance,endurance']) |
25 | | - table.add_row(['Size (GB)', str(volume_size)]) |
26 | | - |
27 | | - iops_table = formatting.Table(['Size (GB)', '20', '40', '80', '100', '250', '500', '1000', '2000-3000', |
28 | | - '4000-7000', '8000-9000', '10000-12000'], title='IOPS table') |
29 | | - snapshot_table = formatting.Table(['Storage Size (GB)', 'Available Snapshot Size (GB)'], title="Snapshot table") |
30 | | - |
31 | | - datacenter_str = ','.join([str(dc['longName']) for dc in datacenters]) |
32 | | - iops_table.add_row(['Size (GB)', *volume_size]) |
33 | | - iops_table.add_row(['Min IOPS', '100', '100', '100', '100', '100', '100', '100', '200', '300', '500', '1000']) |
34 | | - iops_table.add_row(['Max IOPS', '1000', '2000', '4000', '6000', '6000', '6000 or 10000', '6000 or 20000', |
35 | | - '6000 or 40000', '6000 or 48000', '6000 or 48000', '6000 or 48000']) |
36 | | - # table.add_row(['iops', iops_table]) |
37 | | - table.add_row(['Tier', '0.25,2,4,10']) |
38 | | - table.add_row(['location', datacenter_str]) |
39 | | - |
40 | | - snapshot_table.add_row(['20', '0,5,10,20']) |
41 | | - snapshot_table.add_row(['40', '0,5,10,20,40']) |
42 | | - snapshot_table.add_row(['80', '0,5,10,20,40,60,80']) |
43 | | - snapshot_table.add_row(['100', '0,5,10,20,40,60,80,100']) |
44 | | - snapshot_table.add_row(['250', '0,5,10,20,40,60,80,100,150,200,250']) |
45 | | - snapshot_table.add_row(['500', '0,5,10,20,40,60,80,100,150,200,250,300,350,400,450,500']) |
46 | | - snapshot_table.add_row(['1000', '0,5,10,20,40,60,80,100,150,200,250,300,350,400,450,500,600,700,1000']) |
47 | | - snapshot_table.add_row(['2000-3000', '0,5,10,20,40,60,80,100,150,200,250,300,350,400,450,500,600,700,1000,2000']) |
48 | | - snapshot_table.add_row( |
49 | | - ['4000-7000', '0,5,10,20,40,60,80,100,150,200,250,300,350,400,450,500,600,700,1000,2000,4000']) |
50 | | - snapshot_table.add_row( |
51 | | - ['8000-9000', '0,5,10,20,40,60,80,100,150,200,250,300,350,400,450,500,600,700,1000,2000,4000']) |
52 | | - snapshot_table.add_row( |
53 | | - ['10000-12000', '0,5,10,20,40,60,80,100,150,200,250,300,350,400,450,500,600,700,1000,2000,4000']) |
54 | | - |
55 | | - # table.add_row(['Snapshot Size (GB)', snapshot_table]) |
56 | | - table.add_row(['Note:', |
57 | | - 'IOPs limit above 6000 available in select data centers, refer to:' |
58 | | - 'http://knowledgelayer.softlayer.com/articles/new-ibm-block-and-file-storage-location-and-features']) |
59 | | - env.fout(table) |
| 20 | + order_manager = SoftLayer.OrderingManager(env.client) |
| 21 | + items = order_manager.get_items(PACKAGE_STORAGE) |
| 22 | + datacenters = order_manager.get_regions(PACKAGE_STORAGE) |
| 23 | + |
| 24 | + iops_table = formatting.Table(['Id', 'Description', 'KeyName'], title='IOPS') |
| 25 | + snapshot_table = formatting.Table(['Id', 'Description', 'KeyName'], title='Snapshot') |
| 26 | + storage_table = formatting.Table(['Id', 'Description', 'KeyName'], title='Storage') |
| 27 | + datacenter_table = formatting.Table(['Id', 'Description', 'KeyName'], title='Datacenter') |
| 28 | + |
| 29 | + for datacenter in datacenters: |
| 30 | + datacenter_table.add_row([datacenter['location']['locationId'], |
| 31 | + datacenter.get('description'), |
| 32 | + datacenter['keyname']]) |
| 33 | + |
| 34 | + for item in items: |
| 35 | + if item['itemCategory']['categoryCode'] == 'performance_storage_space': |
| 36 | + storage_table.add_row([item.get('id'), item.get('description'), |
| 37 | + item.get('keyName')]) |
| 38 | + |
| 39 | + if item['itemCategory']['categoryCode'] == 'storage_tier_level': |
| 40 | + iops_table.add_row([item.get('id'), item.get('description'), |
| 41 | + item.get('keyName')]) |
| 42 | + |
| 43 | + if item['itemCategory']['categoryCode'] == 'storage_snapshot_space': |
| 44 | + snapshot_table.add_row([item.get('id'), item.get('description'), |
| 45 | + item.get('keyName')]) |
| 46 | + |
| 47 | + env.fout(datacenter_table) |
60 | 48 | env.fout(iops_table) |
| 49 | + env.fout(storage_table) |
61 | 50 | env.fout(snapshot_table) |
0 commit comments