Revision ccdd1b82 kamaki/cli/commands/network.py
b/kamaki/cli/commands/network.py | ||
---|---|---|
436 | 436 |
self._run(port_id=port_id) |
437 | 437 |
|
438 | 438 |
|
439 |
#@command(port_cmds) |
|
440 |
#class port_create(_init_network, _optional_json): |
|
441 |
# |
|
439 |
@command(port_cmds) |
|
440 |
class port_create(_init_network, _optional_json): |
|
441 |
"""Create a new port""" |
|
442 |
|
|
443 |
arguments = dict( |
|
444 |
security_group_id=RepeatableArgument( |
|
445 |
'Add a security group id (can be repeated)', |
|
446 |
('-g', '--security-group')) |
|
447 |
) |
|
448 |
|
|
449 |
@errors.generic.all |
|
450 |
@errors.cyclades.connection |
|
451 |
@errors.cyclades.network_id |
|
452 |
def _run(self, network_id, device_id): |
|
453 |
r = self.client.create_port( |
|
454 |
network_id, device_id, security_groups=self['security_group_id']) |
|
455 |
self._print(r, self.print_dict) |
|
456 |
|
|
457 |
def main(self, network_id, device_id): |
|
458 |
super(self.__class__, self)._run() |
|
459 |
self._run(network_id=network_id, device_id=device_id) |
Also available in: Unified diff