Package yakumo :: Package keystone :: Package v3 :: Module service
[hide private]
[frames] | no frames]

Source Code for Module yakumo.keystone.v3.service

 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 services in Identity V3 API 
18  """ 
19   
20  from yakumo import base 
21  from yakumo.constant import UNDEF 
22  from yakumo import mapper 
23   
24   
25  ATTRIBUTE_MAPPING = [ 
26      ('id', 'id', mapper.Noop), 
27      ('name', 'name', mapper.Noop), 
28      ('type', 'type', mapper.Noop), 
29      ('description', 'description', mapper.Noop), 
30      ('is_enabled', 'enabled', mapper.Noop), 
31  ] 
32   
33   
34 -class Resource(base.Resource):
35 """resource class for services on Identity V3 API""" 36
37 - def update(self, name=UNDEF, type=UNDEF, description=UNDEF, 38 is_enabled=UNDEF):
39 """ 40 Update properties of a service 41 42 @keyword name: Service name 43 @type name: str 44 @keyword type: Service type 45 @type type: str 46 @keyword description: Description 47 @type description: str 48 @keyword is_enabled: Whether the service is enabled or not 49 @type is_enabled: bool 50 @rtype: None 51 """ 52 super(Resource, self).update( 53 name=name, 54 type=type, 55 description=description, 56 is_enabled=is_enabled)
57 58
59 -class Manager(base.Manager):
60 """manager class for services on Identity V3 API""" 61 62 resource_class = Resource 63 service_type = 'identity' 64 _attr_mapping = ATTRIBUTE_MAPPING 65 _json_resource_key = 'service' 66 _json_resources_key = 'services' 67 _update_method = 'patch' 68 _url_resource_path = '/services' 69
70 - def create(self, name=UNDEF, type=UNDEF, description=UNDEF, 71 is_enabled=UNDEF):
72 """ 73 Register a service 74 75 @keyword name: Service name 76 @type name: str 77 @keyword type: Service type 78 @type type: str 79 @keyword description: Description 80 @type description: str 81 @keyword is_enabled: Whether the service is enabled or not 82 @type is_enabled: bool 83 @return: Created service 84 @rtype: yakumo.keystone.v3.service.Resource 85 """ 86 return super(Manager, self).create( 87 name=name, 88 type=type, 89 description=description, 90 is_enabled=is_enabled)
91