summaryrefslogtreecommitdiff
path: root/novaclient/v2/fixed_ips.py
diff options
context:
space:
mode:
Diffstat (limited to 'novaclient/v2/fixed_ips.py')
-rw-r--r--novaclient/v2/fixed_ips.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/novaclient/v2/fixed_ips.py b/novaclient/v2/fixed_ips.py
new file mode 100644
index 0000000..4e7c0e9
--- /dev/null
+++ b/novaclient/v2/fixed_ips.py
@@ -0,0 +1,56 @@
1# Copyright 2012 IBM Corp.
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"""
17Fixed IPs interface.
18"""
19
20from novaclient import base
21
22
23class FixedIP(base.Resource):
24 def __repr__(self):
25 return "<FixedIP: %s>" % self.address
26
27
28class FixedIPsManager(base.Manager):
29 resource_class = FixedIP
30
31 def get(self, fixed_ip):
32 """
33 Show information for a Fixed IP
34
35 :param fixed_ip: Fixed IP address to get info for
36 """
37 return self._get('/os-fixed-ips/%s' % base.getid(fixed_ip),
38 "fixed_ip")
39
40 def reserve(self, fixed_ip):
41 """Reserve a Fixed IP
42
43 :param fixed_ip: Fixed IP address to reserve
44 """
45 body = {"reserve": None}
46 self.api.client.post('/os-fixed-ips/%s/action' % base.getid(fixed_ip),
47 body=body)
48
49 def unreserve(self, fixed_ip):
50 """Unreserve a Fixed IP
51
52 :param fixed_ip: Fixed IP address to unreserve
53 """
54 body = {"unreserve": None}
55 self.api.client.post('/os-fixed-ips/%s/action' % base.getid(fixed_ip),
56 body=body)