summaryrefslogtreecommitdiff
path: root/novaclient/v2/availability_zones.py
diff options
context:
space:
mode:
Diffstat (limited to 'novaclient/v2/availability_zones.py')
-rw-r--r--novaclient/v2/availability_zones.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/novaclient/v2/availability_zones.py b/novaclient/v2/availability_zones.py
new file mode 100644
index 0000000..bf59037
--- /dev/null
+++ b/novaclient/v2/availability_zones.py
@@ -0,0 +1,52 @@
1# Copyright 2011 OpenStack Foundation
2# Copyright 2013 IBM Corp.
3# All Rights Reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License"); you may
6# not use this file except in compliance with the License. You may obtain
7# a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14# License for the specific language governing permissions and limitations
15# under the License.
16
17"""
18Availability Zone interface (1.1 extension).
19"""
20
21from novaclient import base
22
23
24class AvailabilityZone(base.Resource):
25 """
26 An availability zone object.
27 """
28 NAME_ATTR = 'display_name'
29
30 def __repr__(self):
31 return "<AvailabilityZone: %s>" % self.zoneName
32
33
34class AvailabilityZoneManager(base.ManagerWithFind):
35 """
36 Manage :class:`AvailabilityZone` resources.
37 """
38 resource_class = AvailabilityZone
39 return_parameter_name = "availabilityZoneInfo"
40
41 def list(self, detailed=True):
42 """
43 Get a list of all availability zones.
44
45 :rtype: list of :class:`AvailabilityZone`
46 """
47 if detailed is True:
48 return self._list("/os-availability-zone/detail",
49 self.return_parameter_name)
50 else:
51 return self._list("/os-availability-zone",
52 self.return_parameter_name)