Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #924 from allmightyspiff/issues918
Add categories to item-list and package location support
- Loading branch information
Showing
13 changed files
with
192 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""List packages.""" | ||
# :license: MIT, see LICENSE for more details. | ||
import click | ||
|
||
from SoftLayer.CLI import environment | ||
from SoftLayer.CLI import formatting | ||
from SoftLayer.managers import ordering | ||
|
||
COLUMNS = ['id', 'dc', 'description', 'keyName'] | ||
|
||
|
||
@click.command() | ||
@click.argument('package_keyname') | ||
@environment.pass_env | ||
def cli(env, package_keyname): | ||
"""List Datacenters a package can be ordered in. | ||
Use the location Key Name to place orders | ||
""" | ||
manager = ordering.OrderingManager(env.client) | ||
table = formatting.Table(COLUMNS) | ||
|
||
locations = manager.package_locations(package_keyname) | ||
for region in locations: | ||
for datacenter in region['locations']: | ||
table.add_row([ | ||
datacenter['location']['id'], | ||
datacenter['location']['name'], | ||
region['description'], | ||
region['keyname'] | ||
]) | ||
env.fout(table) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.