Revision 89a1c636 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=ValueArgument('Assign the IP to project', '--project'),
611 631
    )
612 632
    required = ('network_id', )
613 633

  
......
617 637
    def _run(self, network_id):
618 638
        self._print(
619 639
            self.client.create_floatingip(
620
                network_id, floating_ip_address=self['ip_address']),
640
                network_id, floating_ip_address=self['ip_address'],
641
                project=self['project']),
621 642
            self.print_dict)
622 643

  
623 644
    def main(self):
......
626 647

  
627 648

  
628 649
@command(ip_cmds)
650
class ip_reassign(_init_network, _optional_output_cmd):
651
    """Assign a floating IP to a different project
652
    """
653
    @errors.generic.all
654
    @errors.cyclades.connection
655
    def _run(self, ip, project):
656
        self._optional_output(self.client.reassign_floating_ip(ip, project))
657

  
658
    def main(self, IP, project):
659
        super(self.__class__, self)._run()
660
        self._run(ip=IP, project=project)
661

  
662

  
663
@command(ip_cmds)
629 664
class ip_delete(_init_network, _optional_output_cmd):
630 665
    """Unreserve an IP (also delete the port, if attached)"""
631 666

  

Also available in: Unified diff