1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """
17 Resource class and its manager for agents in Compute API v2
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', 'agent_id', mapper.Noop),
27 ('architecture', 'architecture', mapper.Noop),
28 ('hypervisor', 'hypervisor', mapper.Noop),
29 ('md5hash', 'md5hash', mapper.Noop),
30 ('os', 'os', mapper.Noop),
31 ('url', 'url', mapper.Noop),
32 ('version', 'version', mapper.Noop),
33 ]
34
35
37 """Resource class for agents in Compute API v2"""
38
41 """
42 Update properties of an agent
43
44 @keyword architecture: Architecture
45 @type architecture: str
46 @keyword hypervisor: Hypervisor
47 @type hypervisor: str
48 @keyword os: Operating System
49 @type os: str
50 @keyword url: URL
51 @type url: str
52 @keyword version: Version
53 @type version: str
54 @rtype: None
55 """
56 super(Resource, self).update(
57 architecture=architecture,
58 hypervisor=hypervisor,
59 os=os,
60 url=url,
61 version=version)
62
63
65 """Manager class for agents in Compute API v2"""
66
67 resource_class = Resource
68 service_type = 'compute'
69 _attr_mapping = ATTRIBUTE_MAPPING
70 _json_resource_key = 'agent'
71 _json_resources_key = 'agents'
72 _url_resource_path = '/os-agents'
73
76 """
77 Register an agent
78
79 @keyword architecture: Architecture
80 @type architecture: str
81 @keyword hypervisor: Hypervisor
82 @type hypervisor: str
83 @keyword os: Operating System
84 @type os: str
85 @keyword url: URL
86 @type url: str
87 @keyword version: Version
88 @type version: str
89 @return: Registered agent
90 @rtype: yakumo.nova.v2.agent.Resource
91 """
92 return super(Manager, self).create(
93 architecture=architecture,
94 hypervisor=hypervisor,
95 os=os,
96 url=url,
97 version=version)
98