1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
36 """resource class for endpoints on Identity V3 API"""
37
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
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
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