Revision ffe30114 kamaki/cli/commands/network.py
b/kamaki/cli/commands/network.py | ||
---|---|---|
189 | 189 |
name=ValueArgument('Network name', '--name'), |
190 | 190 |
shared=FlagArgument( |
191 | 191 |
'Make network shared (special privileges required)', '--shared'), |
192 |
project=ValueArgument('Assign the network to project', '--project'), |
|
192 | 193 |
network_type=NetworkTypeArgument( |
193 | 194 |
'Valid network types: %s' % (', '.join(NetworkTypeArgument.types)), |
194 | 195 |
'--type') |
... | ... | |
199 | 200 |
@errors.cyclades.network_type |
200 | 201 |
def _run(self, network_type): |
201 | 202 |
net = self.client.create_network( |
202 |
network_type, name=self['name'], shared=self['shared']) |
|
203 |
network_type, name=self['name'], |
|
204 |
shared=self['shared'], |
|
205 |
project=self['project']) |
|
203 | 206 |
self._print(net, self.print_dict) |
204 | 207 |
|
205 | 208 |
def main(self): |
... | ... | |
208 | 211 |
|
209 | 212 |
|
210 | 213 |
@command(network_cmds) |
214 |
class network_reassign(_init_network, _optional_json): |
|
215 |
"""Assign a network to a different project |
|
216 |
""" |
|
217 |
|
|
218 |
@errors.generic.all |
|
219 |
@errors.cyclades.connection |
|
220 |
@errors.cyclades.network_id |
|
221 |
def _run(self, network_id, project): |
|
222 |
self.client.reassign_network(network_id, project) |
|
223 |
|
|
224 |
def main(self, network_id, project): |
|
225 |
super(self.__class__, self)._run() |
|
226 |
self._run(network_id=network_id, project=project) |
|
227 |
|
|
228 |
|
|
229 |
@command(network_cmds) |
|
211 | 230 |
class network_delete(_init_network, _optional_output_cmd): |
212 | 231 |
"""Delete a network""" |
213 | 232 |
|
... | ... | |
607 | 626 |
arguments = dict( |
608 | 627 |
network_id=ValueArgument( |
609 | 628 |
'The network to preserve the IP on', '--network-id'), |
610 |
ip_address=ValueArgument('Allocate an IP address', '--address') |
|
629 |
ip_address=ValueArgument('Allocate an IP address', '--address'), |
|
630 |
project_id=ValueArgument('Assign the IP to project', '--project-id'), |
|
611 | 631 |
) |
612 | 632 |
|
613 | 633 |
@errors.generic.all |
... | ... | |
615 | 635 |
def _run(self): |
616 | 636 |
self._print( |
617 | 637 |
self.client.create_floatingip( |
618 |
self['network_id'], floating_ip_address=self['ip_address']), |
|
638 |
self['network_id'], |
|
639 |
floating_ip_address=self['ip_address'], |
|
640 |
project_id=self['project_id']), |
|
619 | 641 |
self.print_dict) |
620 | 642 |
|
621 | 643 |
def main(self): |
... | ... | |
624 | 646 |
|
625 | 647 |
|
626 | 648 |
@command(ip_cmds) |
649 |
class ip_reassign(_init_network, _optional_output_cmd): |
|
650 |
"""Assign a floating IP to a different project |
|
651 |
""" |
|
652 |
@errors.generic.all |
|
653 |
@errors.cyclades.connection |
|
654 |
def _run(self, ip, project): |
|
655 |
self._optional_output(self.client.reassign_floating_ip(ip, project)) |
|
656 |
|
|
657 |
def main(self, IP, project): |
|
658 |
super(self.__class__, self)._run() |
|
659 |
self._run(ip=IP, project=project) |
|
660 |
|
|
661 |
|
|
662 |
@command(ip_cmds) |
|
627 | 663 |
class ip_delete(_init_network, _optional_output_cmd): |
628 | 664 |
"""Unreserve an IP (also delete the port, if attached)""" |
629 | 665 |
|
Also available in: Unified diff