summaryrefslogtreecommitdiff
path: root/novaclient/v2/quota_classes.py
diff options
context:
space:
mode:
Diffstat (limited to 'novaclient/v2/quota_classes.py')
-rw-r--r--novaclient/v2/quota_classes.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/novaclient/v2/quota_classes.py b/novaclient/v2/quota_classes.py
new file mode 100644
index 0000000..4a38a97
--- /dev/null
+++ b/novaclient/v2/quota_classes.py
@@ -0,0 +1,44 @@
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
16from novaclient import base
17
18
19class QuotaClassSet(base.Resource):
20
21 def update(self, *args, **kwargs):
22 return self.manager.update(self.id, *args, **kwargs)
23
24
25class QuotaClassSetManager(base.Manager):
26 resource_class = QuotaClassSet
27
28 def get(self, class_name):
29 return self._get("/os-quota-class-sets/%s" % (class_name),
30 "quota_class_set")
31
32 def _update_body(self, **kwargs):
33 return {'quota_class_set': kwargs}
34
35 def update(self, class_name, **kwargs):
36 body = self._update_body(**kwargs)
37
38 for key in list(body['quota_class_set']):
39 if body['quota_class_set'][key] is None:
40 body['quota_class_set'].pop(key)
41
42 return self._update('/os-quota-class-sets/%s' % (class_name),
43 body,
44 'quota_class_set')