File: __init__.py

package info (click to toggle)
raritan-json-rpc-sdk 4.0.20%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 57,236 kB
  • sloc: cs: 223,121; perl: 117,786; python: 26,872; javascript: 6,544; makefile: 27
file content (82 lines) | stat: -rw-r--r-- 2,512 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright 2022 Raritan Inc. All rights reserved.
#
# This is an auto-generated file.

#
# Section generated by IdlC from "ResMon.idl"
#

import raritan.rpc
from raritan.rpc import Interface, Structure, ValueObject, Enumeration, typecheck, DecodeException
import raritan.rpc.res_mon


# structure
class Entry(Structure):
    idlType = "res_mon.Entry:1.0.0"
    elements = ["type", "name", "value"]

    def __init__(self, type, name, value):
        typecheck.is_enum(type, raritan.rpc.res_mon.Entry.Type, AssertionError)
        typecheck.is_string(name, AssertionError)
        typecheck.is_long(value, AssertionError)

        self.type = type
        self.name = name
        self.value = value

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            type = raritan.rpc.res_mon.Entry.Type.decode(json['type']),
            name = json['name'],
            value = int(json['value']),
        )
        return obj

    def encode(self):
        json = {}
        json['type'] = raritan.rpc.res_mon.Entry.Type.encode(self.type)
        json['name'] = self.name
        json['value'] = self.value
        return json

    # enumeration
    class Type(Enumeration):
        idlType = "res_mon.Entry.Type:1.0.0"
        values = ["GLOBAL_CPU_USAGE", "GLOBAL_FREE_MEM", "GLOBAL_PROC_COUNT", "FS_FREE_SPACE", "FS_FREE_INODES", "PROC_CPU_USAGE", "PROC_VM_SIZE", "PROC_FREE_FILE_DESC", "PROC_LIFE_TIME", "PROC_COUNT"]

    Type.GLOBAL_CPU_USAGE = Type(0)
    Type.GLOBAL_FREE_MEM = Type(1)
    Type.GLOBAL_PROC_COUNT = Type(2)
    Type.FS_FREE_SPACE = Type(3)
    Type.FS_FREE_INODES = Type(4)
    Type.PROC_CPU_USAGE = Type(5)
    Type.PROC_VM_SIZE = Type(6)
    Type.PROC_FREE_FILE_DESC = Type(7)
    Type.PROC_LIFE_TIME = Type(8)
    Type.PROC_COUNT = Type(9)

# interface
class ResMon(Interface):
    idlType = "res_mon.ResMon:1.0.0"

    class _getDataEntries(Interface.Method):
        name = 'getDataEntries'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            entries = [raritan.rpc.res_mon.Entry.decode(x0, agent) for x0 in rsp['entries']]
            for x0 in entries:
                typecheck.is_struct(x0, raritan.rpc.res_mon.Entry, DecodeException)
            return entries
    def __init__(self, target, agent):
        super(ResMon, self).__init__(target, agent)
        self.getDataEntries = ResMon._getDataEntries(self)