Debian Codegraph @

seamicroclient/v2/chassis.py

raw
1 # Licensed under the Apache License, Version 2.0 (the "License"); you may
2 # not use this file except in compliance with the License. You may obtain
3 # a copy of the License at
4 #
5 # http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 # License for the specific language governing permissions and limitations
11 # under the License.
12
13 """
14 Chassis interface.
15 """
16
17 from seamicroclient import base
18
19
20 class Chassis(base.Resource):
21 HUMAN_ID = True
22
23 def writemem(self, **kwargs):
24 return self.manager.writemem(self, **kwargs)
25
26
27 class ChassisManager(base.ManagerWithFind):
28 resource_class = Chassis
29
30 def list(self, filters=None):
31 """
32 Get a list of chassis properties.
33
34 :rtype: list of :class:`Chassis`
35 """
36 return self._list("/chassis", filters=filters)
37
38 def writemem(self, chassis, **kwargs):
39 """
40 Write current chassis config to flash memory
41 This will persist even after reboot of chassis
42 """
43 url = "/chassis/system/writeMem"
44 return self.api.client.put(url, body={})