File: __init__.py

package info (click to toggle)
raritan-json-rpc-sdk 3.6.1%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 41,748 kB
  • sloc: cs: 162,629; perl: 85,818; python: 24,275; javascript: 5,937; makefile: 21
file content (73 lines) | stat: -rw-r--r-- 2,486 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
# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright 2020 Raritan Inc. All rights reserved.
#
# This is an auto-generated file.

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

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


# enumeration
class AuthType(Enumeration):
    idlType = "radius.AuthType:2.0.0"
    values = ["PAP", "CHAP", "MSCHAPv2"]

AuthType.PAP = AuthType(0)
AuthType.CHAP = AuthType(1)
AuthType.MSCHAPv2 = AuthType(2)

# structure
class ServerSettings(Structure):
    idlType = "radius.ServerSettings:2.0.0"
    elements = ["id", "server", "sharedSecret", "udpAuthPort", "udpAccountPort", "timeout", "retries", "authType"]

    def __init__(self, id, server, sharedSecret, udpAuthPort, udpAccountPort, timeout, retries, authType):
        typecheck.is_string(id, AssertionError)
        typecheck.is_string(server, AssertionError)
        typecheck.is_string(sharedSecret, AssertionError)
        typecheck.is_int(udpAuthPort, AssertionError)
        typecheck.is_int(udpAccountPort, AssertionError)
        typecheck.is_int(timeout, AssertionError)
        typecheck.is_int(retries, AssertionError)
        typecheck.is_enum(authType, raritan.rpc.radius.AuthType, AssertionError)

        self.id = id
        self.server = server
        self.sharedSecret = sharedSecret
        self.udpAuthPort = udpAuthPort
        self.udpAccountPort = udpAccountPort
        self.timeout = timeout
        self.retries = retries
        self.authType = authType

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            id = json['id'],
            server = json['server'],
            sharedSecret = json['sharedSecret'],
            udpAuthPort = json['udpAuthPort'],
            udpAccountPort = json['udpAccountPort'],
            timeout = json['timeout'],
            retries = json['retries'],
            authType = raritan.rpc.radius.AuthType.decode(json['authType']),
        )
        return obj

    def encode(self):
        json = {}
        json['id'] = self.id
        json['server'] = self.server
        json['sharedSecret'] = self.sharedSecret
        json['udpAuthPort'] = self.udpAuthPort
        json['udpAccountPort'] = self.udpAccountPort
        json['timeout'] = self.timeout
        json['retries'] = self.retries
        json['authType'] = raritan.rpc.radius.AuthType.encode(self.authType)
        return json