Skip to content

Commit b32b8a9

Browse files
caberoscaberos
authored andcommitted
fix the team code review comments
1 parent 86173b0 commit b32b8a9

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

SoftLayer/CLI/globalip/assign.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,21 @@
66
import SoftLayer
77
from SoftLayer.CLI import environment
88

9+
target_types = {'vlan': 'SoftLayer_Network_Vlan',
10+
'ip': 'SoftLayer_Network_Subnet_IpAddress',
11+
'hardware': 'SoftLayer_Hardware_Server',
12+
'vsi': 'SoftLayer_Virtual_Guest'}
913

10-
@click.command(epilog="More information about types and ")
14+
15+
@click.command(epilog="More information about types and identifiers "
16+
"on https://sldn.softlayer.com/reference/services/SoftLayer_Network_Subnet/route/")
1117
@click.argument('identifier')
12-
@click.option('--target',
13-
help='See SLDN docs. '
14-
'E.g SoftLayer_Network_Subnet_IpAddress, SoftLayer_Hardware_Server,SoftLayer_Virtual_Guest')
15-
@click.option('--router', help='An appropriate identifier for the specified $type. Some types have multiple identifier')
18+
@click.option('--target', type=click.Choice(['vlan', 'ip', 'hardware', 'vsi']),
19+
help='choose the type. vlan, ip, hardware, vsi')
20+
@click.option('--target-id', help='The identifier for the destination resource to route this subnet to. ')
1621
@environment.pass_env
17-
def cli(env, identifier, target, router):
18-
"""Assigns the global IP to a target."""
22+
def cli(env, identifier, target, target_id):
23+
"""Assigns the subnet to a target."""
1924

2025
mgr = SoftLayer.NetworkManager(env.client)
21-
mgr.route(identifier, target, router)
26+
mgr.route(identifier, target_types.get(target), target_id)

0 commit comments

Comments
 (0)