Package yakumo :: Package nova :: Package v2 :: Module server_group
[hide private]
[frames] | no frames]

Source Code for Module yakumo.nova.v2.server_group

 1  # Copyright 2014-2017 by Akira Yoshiyama <akirayoshiyama@gmail.com>. 
 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  """ 
17  Resource class and its manager for server groups in Compute API v2 
18  """ 
19   
20  from yakumo import base 
21  from yakumo.constant import UNDEF 
22  from yakumo import mapper 
23  from yakumo import utils 
24   
25   
26  ATTRIBUTE_MAPPING = [ 
27      ('id', 'id', mapper.Noop), 
28      ('name', 'name', mapper.Noop), 
29      ('policies', 'policies', mapper.Noop), 
30      ('members', 'members', mapper.Noop), 
31      ('metadata', 'metadata', mapper.Noop), 
32  ] 
33   
34   
35 -class Resource(base.Resource):
36 """Resource class for server groups in Compute API v2"""
37 38
39 -class Manager(base.Manager):
40 """Manager class for server groups in Compute API v2""" 41 42 resource_class = Resource 43 service_type = 'compute' 44 _attr_mapping = ATTRIBUTE_MAPPING 45 _hidden_methods = ["update"] 46 _json_resource_key = 'server_group' 47 _json_resources_key = 'server_groups' 48 _url_resource_path = '/os-server-groups' 49
50 - def create(self, name=UNDEF, policies=UNDEF):
51 """ 52 Create a server group 53 54 @keyword name: name of server group 55 @type name: str 56 @keyword policies: list of policy names 57 @type policies: [str] 58 @return: Created server group 59 @rtype: yakumo.nova.v2.server_group.Resource 60 """ 61 return super(Manager, self).create(name=name, 62 policies=policies)
63