summaryrefslogtreecommitdiff
path: root/novaclient/v2/cloudpipe.py
diff options
context:
space:
mode:
Diffstat (limited to 'novaclient/v2/cloudpipe.py')
-rw-r--r--novaclient/v2/cloudpipe.py61
1 files changed, 61 insertions, 0 deletions
diff --git a/novaclient/v2/cloudpipe.py b/novaclient/v2/cloudpipe.py
new file mode 100644
index 0000000..c0926ed
--- /dev/null
+++ b/novaclient/v2/cloudpipe.py
@@ -0,0 +1,61 @@
1# Copyright 2012 OpenStack Foundation
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16"""Cloudpipe interface."""
17
18from novaclient import base
19
20
21class Cloudpipe(base.Resource):
22 """A cloudpipe instance is a VPN attached to a project's VLAN."""
23
24 def __repr__(self):
25 return "<Cloudpipe: %s>" % self.project_id
26
27 def delete(self):
28 self.manager.delete(self)
29
30
31class CloudpipeManager(base.ManagerWithFind):
32 resource_class = Cloudpipe
33
34 def create(self, project):
35 """
36 Launch a cloudpipe instance.
37
38 :param project: UUID of the project (tenant) for the cloudpipe
39 """
40 body = {'cloudpipe': {'project_id': project}}
41 return self._create('/os-cloudpipe', body, 'instance_id',
42 return_raw=True)
43
44 def list(self):
45 """
46 Get a list of cloudpipe instances.
47 """
48 return self._list('/os-cloudpipe', 'cloudpipes')
49
50 def update(self, address, port):
51 """
52 Update VPN address and port for all networks associated
53 with the project defined by authentication
54
55 :param address: IP address
56 :param port: Port number
57 """
58
59 body = {'configure_project': {'vpn_ip': address,
60 'vpn_port': port}}
61 self._update("/os-cloudpipe/configure-project", body)