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

Source Code for Module yakumo.keystone.v3.endpoint

  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 endpoints 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      ('description', 'description', mapper.Noop), 
 28      ('interface', 'interface', mapper.Noop), 
 29      ('url', 'url', mapper.Noop), 
 30      ('region', 'region_id', mapper.Resource('keystone.region')), 
 31      ('service', 'service_id', mapper.Resource('keystone.service')), 
 32  ] 
 33   
 34   
35 -class Resource(base.Resource):
36 """resource class for endpoints on Identity V3 API""" 37
38 - def update(self, name=UNDEF, description=UNDEF, interface=UNDEF, url=UNDEF, 39 region=UNDEF, service=UNDEF):
40 """ 41 Update properties of an endpoint 42 43 @keyword name: Endpoint name 44 @type name: str 45 @keyword description: Description 46 @type description: str 47 @keyword interface: Interface type (public, internal or admin) 48 @type interface: str 49 @keyword url: URL 50 @type url: str 51 @keyword region: Region 52 @type region: yakumo.keystone.v3.region.Resource 53 @keyword service: Service 54 @type service: yakumo.keystone.v3.service.Resource 55 @rtype: None 56 """ 57 super(Resource, self).update( 58 name=name, 59 description=description, 60 interface=interface, 61 url=url, 62 region=region, 63 service=service)
64 65
66 -class Manager(base.Manager):
67 """manager class for endpoints on Identity V3 API""" 68 69 resource_class = Resource 70 service_type = 'identity' 71 _attr_mapping = ATTRIBUTE_MAPPING 72 _json_resource_key = 'endpoint' 73 _json_resources_key = 'endpoints' 74 _update_method = 'patch' 75 _url_resource_path = '/endpoints' 76
77 - def create(self, name=UNDEF, description=UNDEF, interface=UNDEF, url=UNDEF, 78 region=UNDEF, service=UNDEF):
79 """ 80 Register an endpoint 81 82 @keyword name: Endpoint name 83 @type name: str 84 @keyword description: Description 85 @type description: str 86 @keyword interface: Interface type (public, internal or admin) 87 @type interface: str 88 @keyword url: URL 89 @type url: str 90 @keyword region: Region 91 @type region: yakumo.keystone.v3.region.Resource 92 @keyword service: Service 93 @type service: yakumo.keystone.v3.service.Resource 94 @return: Created endpoint 95 @rtype: yakumo.keystone.v3.endpoint.Resource 96 """ 97 return super(Manager, self).create( 98 name=name, 99 description=description, 100 interface=interface, 101 url=url, 102 region=region, 103 service=service)
104