-
Notifications
You must be signed in to change notification settings - Fork 193
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 #1698 from caberos/issue1696
New command ipsec order
- Loading branch information
Showing
8 changed files
with
149 additions
and
0 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,34 @@ | ||
"""Order a IPSec VPN tunnel.""" | ||
# :licenses: MIT, see LICENSE for more details. | ||
|
||
import click | ||
|
||
import SoftLayer | ||
|
||
from SoftLayer.CLI import environment | ||
from SoftLayer.CLI import exceptions | ||
from SoftLayer.CLI import formatting | ||
|
||
|
||
@click.command(cls=SoftLayer.CLI.command.SLCommand, ) | ||
@click.option('--datacenter', '-d', required=True, prompt=True, help="Datacenter shortname") | ||
@environment.pass_env | ||
def cli(env, datacenter): | ||
"""Order/create a IPSec VPN tunnel instance.""" | ||
|
||
ipsec_manager = SoftLayer.IPSECManager(env.client) | ||
|
||
if not (env.skip_confirmations or formatting.confirm( | ||
"This action will incur charges on your account. Continue?")): | ||
raise exceptions.CLIAbort('Aborting ipsec order.') | ||
|
||
result = ipsec_manager.order(datacenter, ['IPSEC_STANDARD']) | ||
|
||
table = formatting.KeyValueTable(['Name', 'Value']) | ||
table.align['name'] = 'r' | ||
table.align['value'] = 'l' | ||
table.add_row(['Id', result['orderId']]) | ||
table.add_row(['Created', result['orderDate']]) | ||
table.add_row(['Name', result['placedOrder']['items'][0]['description']]) | ||
|
||
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