Пример #1
0
    def parse(data):
        assert type(data) == dict

        obj = ConfigurationElement.parse(data)
        data = obj._unknown

        # future attributes (yet unknown) are not only ignored, but passed through!
        _unknown = {}
        for k in data:
            if k not in ['name', 'otype', 'registered']:
                _unknown[k] = data[k]

        name = data.get('name', None)
        assert name is None or type(name) == six.text_type

        otype = data.get('otype', None)
        assert otype is None or otype in Organization.OTYPES

        registered = data.get('registered', None)
        assert registered is None or type(registered) == float or type(registered) in six.integer_types
        if registered:
            # registered = datetime.utcfromtimestamp(float(registered) / 1000000.)
            registered = datetime.fromtimestamp(float(registered) / 1000000.)

        obj = Organization(oid=obj.oid,
                           label=obj.label,
                           description=obj.description,
                           tags=obj.tags,
                           name=name,
                           otype=otype,
                           registered=registered,
                           _unknown=_unknown)
        return obj
Пример #2
0
    def parse(data):
        """
        Parse generic host language object into an object of this class.

        :param data: Generic host language object
        :type data: dict

        :return: instance of :class:`ManagementRealm`
        """
        assert type(data) == dict

        obj = ConfigurationElement.parse(data)
        data = obj._unknown

        # future attributes (yet unknown) are not only ignored, but passed through!
        _unknown = {}
        for k in data:
            if k not in [
                    'oid', 'modified', 'arealm_oid', 'authid', 'role_oid',
                    'authextra'
            ]:
                _unknown[k] = data[k]

        modified = data.get('modified', None)
        assert modified is None or type(modified) == int
        if modified:
            modified = np.datetime64(modified, 'ns')

        arealm_oid = data.get('arealm_oid', None)
        assert arealm_oid is None or type(arealm_oid) == str
        if arealm_oid:
            arealm_oid = UUID(arealm_oid)

        authid = data.get('authid', None)
        assert authid is None or type(authid) == str

        role_oid = data.get('role_oid', None)
        assert role_oid is None or type(role_oid) == str
        if role_oid:
            role_oid = UUID(role_oid)

        authextra = data.get('authextra', None)
        assert authextra is None or type(authextra) == dict

        obj = Principal(oid=obj.oid,
                        label=obj.label,
                        description=obj.description,
                        tags=obj.tags,
                        modified=modified,
                        arealm_oid=arealm_oid,
                        authid=authid,
                        role_oid=role_oid,
                        authextra=authextra,
                        _unknown=_unknown)

        return obj
Пример #3
0
    def parse(data):
        """
        Parse generic host language object into an object of this class.

        :param data: Generic host language object
        :type data: dict

        :return: instance of :class:`ManagementRealm`
        """
        assert type(data) == dict

        obj = ConfigurationElement.parse(data)
        data = obj._unknown

        # future attributes (yet unknown) are not only ignored, but passed through!
        _unknown = {}
        for k in data:
            if k not in [
                    'owner_oid', 'pubkey', 'mrealm_oid', 'authid', 'authextra'
            ]:
                _unknown[k] = data[k]

        owner_oid = data.get('owner_oid', None)
        assert owner_oid is None or type(owner_oid) == six.text_type
        if owner_oid:
            owner_oid = UUID(owner_oid)

        pubkey = data.get('pubkey', None)
        assert pubkey is None or (type(pubkey) == six.text_type
                                  and len(pubkey) == 64)

        mrealm_oid = data.get('mrealm_oid', None)
        assert mrealm_oid is None or type(mrealm_oid) == six.text_type
        if mrealm_oid:
            mrealm_oid = UUID(mrealm_oid)

        authid = data.get('authid', None)
        assert authid is None or type(authid) == six.text_type

        authextra = data.get('authextra', None)
        assert authextra is None or type(authextra) == dict

        obj = Node(oid=obj.oid,
                   label=obj.label,
                   description=obj.description,
                   tags=obj.tags,
                   owner_oid=owner_oid,
                   pubkey=pubkey,
                   mrealm_oid=mrealm_oid,
                   authid=authid,
                   authextra=authextra,
                   _unknown=_unknown)

        return obj
Пример #4
0
    def parse(data):
        """
        Parse generic host language object into an object of this class.

        :param data: Generic host language object
        :type data: dict

        :return: instance of :class:`ManagementRealm`
        """
        assert type(data) == dict

        obj = ConfigurationElement.parse(data)
        data = obj._unknown

        # future attributes (yet unknown) are not only ignored, but passed through!
        _unknown = {}
        for k in data:
            if k not in [
                    'oid', 'name', 'rtype', 'owner', 'created', 'cf_router_worker', 'cf_container_worker'
            ]:
                _unknown[k] = data[k]

        name = data.get('name', None)
        assert name is None or type(name) == six.text_type

        owner = data.get('owner', None)
        assert owner is None or type(owner) == six.text_type
        if owner:
            owner = UUID(owner)

        created = data.get('created', None)
        assert created is None or type(created) == float or type(created) in six.integer_types
        if created:
            created = datetime.utcfromtimestamp(float(created) / 1000000.)

        cf_router_worker = data.get('cf_router_worker', None)
        assert cf_router_worker is None or type(cf_router_worker) == six.text_type

        cf_container_worker = data.get('cf_container_worker', None)
        assert cf_container_worker is None or type(cf_container_worker) == six.text_type

        obj = ManagementRealm(oid=obj.oid,
                              label=obj.label,
                              description=obj.description,
                              tags=obj.tags,
                              name=name,
                              owner=owner,
                              created=created,
                              cf_router_worker=cf_router_worker,
                              cf_container_worker=cf_container_worker,
                              _unknown=_unknown)

        return obj
Пример #5
0
    def parse(data):
        """
        Parse generic host language object into an object of this class.

        :param data: Generic host language object
        :type data: dict

        :return: instance of :class:`ManagementRealm`
        """
        assert type(data) == dict

        obj = ConfigurationElement.parse(data)
        data = obj._unknown or {}

        # future attributes (yet unknown) are not only ignored, but passed through!
        _unknown = dict()
        for k in data:
            if k not in ['cluster_oid', 'name', 'scale', 'status', 'changed']:
                _unknown[k] = data[k]

        cluster_oid = data.get('cluster_oid', None)
        assert cluster_oid is None or (type(cluster_oid) == str)
        cluster_oid = UUID(cluster_oid)

        name = data.get('name', None)
        assert name is None or (type(name) == str)

        scale = data.get('scale', 1)
        assert scale is None or (
            type(scale) == int and scale >= 1 and scale <= 128
        ), 'scale must be an integer from 1 to 128, but was {}'.format(scale)

        status = data.get('status', None)
        assert status is None or (type(status) == str)
        status = STATUS_BY_NAME.get(status, None)

        changed = data.get('changed', None)
        assert changed is None or (type(changed) == int)
        if changed:
            changed = np.datetime64(changed, 'ns')

        obj = RouterWorkerGroup(oid=obj.oid,
                                label=obj.label,
                                description=obj.description,
                                tags=obj.tags,
                                cluster_oid=cluster_oid,
                                name=name,
                                scale=scale,
                                status=status,
                                changed=changed,
                                _unknown=_unknown)

        return obj
Пример #6
0
    def parse(data):
        """
        Parse generic host language object into an object of this class.

        :param data: Generic host language object
        :type data: dict

        :return: instance of :class:`ManagementRealm`
        """
        assert type(data) == dict

        obj = ConfigurationElement.parse(data)
        data = obj._unknown or {}

        # future attributes (yet unknown) are not only ignored, but passed through!
        _unknown = dict()
        for k in data:
            if k not in ['name', 'status', 'owner_oid', 'changed']:
                _unknown[k] = data[k]

        name = data.get('name', None)
        assert name is None or (type(name) == str)

        status = data.get('status', None)
        assert status is None or (type(status) == str)
        status = STATUS_BY_NAME.get(status, None)

        owner_oid = data.get('owner_oid', None)
        assert owner_oid is None or (type(owner_oid) == str)
        if owner_oid:
            owner_oid = UUID(owner_oid)

        changed = data.get('changed', None)
        assert changed is None or (type(changed) == int)
        if changed:
            changed = np.datetime64(changed, 'ns')

        obj = Cluster(oid=obj.oid,
                      label=obj.label,
                      description=obj.description,
                      tags=obj.tags,
                      name=name,
                      status=status,
                      owner_oid=owner_oid,
                      changed=changed,
                      _unknown=_unknown)

        return obj
Пример #7
0
    def parse(data):
        """
        Parse generic host language object into an object of this class.

        :param data: Generic host language object
        :type data: dict

        :return: instance of :class:`ManagementRealm`
        """
        assert type(data) == dict

        obj = ConfigurationElement.parse(data)
        data = obj._unknown

        # future attributes (yet unknown) are not only ignored, but passed through!
        _unknown = {}
        for k in data:
            if k not in ['oid', 'name', 'owner', 'created']:
                _unknown[k] = data[k]

        name = data.get('name', None)
        assert name is None or type(name) == str

        owner = data.get('owner', None)
        assert owner is None or type(owner) == str
        if owner:
            owner = UUID(owner)

        created = data.get('created', None)
        assert created is None or type(created) == int
        if created:
            created = np.datetime64(created, 'ns')

        obj = Role(oid=obj.oid,
                   label=obj.label,
                   description=obj.description,
                   tags=obj.tags,
                   name=name,
                   owner=owner,
                   created=created,
                   _unknown=_unknown)

        return obj
Пример #8
0
    def parse(data):
        """
        Parse generic host language object into an object of this class.

        :param data: Generic host language object
        :type data: dict

        :return: instance of :class:`WebService`
        """
        assert type(data) == dict

        obj = ConfigurationElement.parse(data)
        data = obj._unknown

        # future attributes (yet unknown) are not only ignored, but passed through!
        _unknown = {}
        for k in data:
            if k not in ['type', 'path', 'webcluster_oid']:
                _unknown[k] = data[k]

        webcluster_oid = data.get('webcluster_oid', None)
        assert webcluster_oid is None or (type(webcluster_oid) == str)
        if webcluster_oid:
            webcluster_oid = UUID(webcluster_oid)

        path = data.get('path', None)
        assert path is None or (type(path) == str)

        service_type = data.get('type', None)
        assert service_type is None or (type(service_type) == str)

        obj = WebService(oid=obj.oid,
                         label=obj.label,
                         description=obj.description,
                         tags=obj.tags,
                         service_type=service_type,
                         webcluster_oid=webcluster_oid,
                         path=path,
                         _unknown=_unknown)

        return obj
Пример #9
0
    def parse(data):
        assert type(data) == dict

        obj = ConfigurationElement.parse(data)
        data = obj._unknown

        # future attributes (yet unknown) are not only ignored, but passed through!
        _unknown = {}
        for k in data:
            if k not in ['email', 'registered', 'pubkey']:
                val = data.pop(k)
                _unknown[k] = val

        email = data.get('email', None)
        assert email is None or type(email) == six.text_type

        registered = data.get('registered', None)
        assert registered is None or type(registered) == float or type(
            registered) in six.integer_types
        if registered:
            # registered = datetime.utcfromtimestamp(float(registered) / 1000000.)
            registered = datetime.fromtimestamp(float(registered) / 1000000.)

        # hex string with 256 bit Ed25519 WAMP-cryptosign public key
        pubkey = data.get('pubkey', None)
        assert pubkey is None or (type(pubkey) == six.text_type
                                  and len(pubkey) == 64)

        obj = User(oid=obj.oid,
                   label=obj.label,
                   description=obj.description,
                   tags=obj.tags,
                   email=email,
                   registered=registered,
                   pubkey=pubkey,
                   _unknown=_unknown)
        return obj
Пример #10
0
    def parse(data):
        """
        Parse generic host language object into an object of this class.

        :param data: Generic host language object
        :type data: dict

        :return: instance of :class:`ManagementRealm`
        """
        assert type(data) == dict

        obj = ConfigurationElement.parse(data)
        data = obj._unknown

        # future attributes (yet unknown) are not only ignored, but passed through!
        _unknown = {}
        for k in data:
            if k not in [
                    'oid', 'role_oid', 'uri', 'uri_check_level', 'match',
                    'allow_call', 'allow_register', 'allow_publish',
                    'allow_subscribe', 'disclose_caller', 'disclose_publisher',
                    'cache', 'owner', 'created'
            ]:
                _unknown[k] = data[k]

        role_oid = data.get('role_oid', None)
        assert role_oid is None or type(role_oid) == str
        if role_oid:
            role_oid = UUID(role_oid)

        uri = data.get('uri', None)
        assert uri is None or type(uri) == str

        uri_check_level = data.get('uri_check_level', None)
        assert uri_check_level is None or (type(uri_check_level) == int
                                           and uri_check_level in range(3))

        match = data.get('match', None)
        assert match is None or (type(match) == int and match in range(4)), \
            '"match" must be an integer [0, 3], but was "{}"'.format(match)

        allow_call = data.get('allow_call', None)
        assert allow_call is None or type(allow_call) == bool

        allow_register = data.get('allow_register', None)
        assert allow_register is None or type(allow_register) == bool

        allow_publish = data.get('allow_publish', None)
        assert allow_publish is None or type(allow_publish) == bool

        allow_subscribe = data.get('allow_publish', None)
        assert allow_subscribe is None or type(allow_subscribe) == bool

        disclose_caller = data.get('disclose_caller', None)
        assert disclose_caller is None or type(disclose_caller) == bool

        disclose_publisher = data.get('disclose_publisher', None)
        assert disclose_publisher is None or type(disclose_publisher) == bool

        cache = data.get('cache', None)
        assert cache is None or type(cache) == bool

        created = data.get('created', None)
        assert created is None or type(created) == int
        if created:
            created = np.datetime64(created, 'ns')

        owner = data.get('owner', None)
        assert owner is None or type(owner) == str
        if owner:
            owner = UUID(owner)

        obj = Permission(oid=obj.oid,
                         label=obj.label,
                         description=obj.description,
                         tags=obj.tags,
                         role_oid=role_oid,
                         uri=uri,
                         uri_check_level=uri_check_level,
                         match=match,
                         allow_call=allow_call,
                         allow_register=allow_register,
                         allow_publish=allow_publish,
                         allow_subscribe=allow_subscribe,
                         disclose_caller=disclose_caller,
                         disclose_publisher=disclose_publisher,
                         cache=cache,
                         created=created,
                         owner=owner,
                         _unknown=_unknown)

        return obj
Пример #11
0
    def parse(data):
        """
        Parse generic host language object into an object of this class.

        :param data: Generic host language object
        :type data: dict

        :return: instance of :class:`ManagementRealm`
        """
        assert type(data) == dict

        obj = ConfigurationElement.parse(data)
        data = obj._unknown

        # future attributes (yet unknown) are not only ignored, but passed through!
        _unknown = {}
        for k in data:
            if k not in [
                    'name', 'status', 'changed', 'tcp_version', 'tcp_port', 'tcp_shared', 'tcp_interface',
                    'tcp_backlog', 'tls_key', 'tls_certificate', 'tls_chain_certificates',
                    'tls_ca_certificates', 'tls_dhparam', 'tls_ciphers', 'http_client_timeout', 'http_hsts',
                    'http_hsts_max_age', 'http_access_log', 'http_display_tracebacks'
            ]:
                _unknown[k] = data[k]

        name = data.get('name', None)
        assert name is None or (type(name) == str)

        status = data.get('status', None)
        assert status is None or (type(status) == str)
        status = WebCluster.STATUS_BY_NAME.get(status, None)

        changed = data.get('changed', None)
        assert changed is None or (type(changed) == int)

        tcp_version = data.get('tcp_version', None)
        assert tcp_version is None or (type(tcp_version) == int)

        tcp_port = data.get('tcp_port', None)
        assert tcp_port is None or (type(tcp_port) == int)

        tcp_shared = data.get('tcp_shared', None)
        assert tcp_shared is None or (type(tcp_shared) == bool)

        tcp_interface = data.get('tcp_interface', None)
        assert tcp_interface is None or (type(tcp_interface) == str)

        tcp_backlog = data.get('tcp_backlog', None)
        assert tcp_backlog is None or (type(tcp_backlog) == int)

        tls_key = data.get('tls_key', None)
        assert tls_key is None or (type(tls_key) == str)

        tls_certificate = data.get('tls_certificate', None)
        assert tls_certificate is None or (type(tls_certificate) == str)

        tls_chain_certificates = data.get('tls_chain_certificates', None)
        assert tls_chain_certificates is None or (type(tls_chain_certificates) == list)

        tls_ca_certificates = data.get('tls_ca_certificates', None)
        assert tls_ca_certificates is None or (type(tls_ca_certificates) == list)

        tls_dhparam = data.get('tls_dhparam', None)
        assert tls_dhparam is None or (type(tls_dhparam) == str)

        tls_ciphers = data.get('tls_ciphers', None)
        assert tls_ciphers is None or (type(tls_ciphers) == str)

        http_client_timeout = data.get('http_client_timeout', None)
        assert http_client_timeout is None or (type(http_client_timeout) == int)

        http_hsts = data.get('http_hsts', None)
        assert http_hsts is None or (type(http_hsts) == bool)

        http_hsts_max_age = data.get('http_hsts_max_age', None)
        assert http_hsts_max_age is None or (type(http_hsts_max_age) == int)

        http_access_log = data.get('http_access_log', None)
        assert http_access_log is None or (type(http_access_log) == bool)

        http_display_tracebacks = data.get('http_display_tracebacks', None)
        assert http_display_tracebacks is None or (type(http_display_tracebacks) == bool)

        obj = WebCluster(oid=obj.oid,
                         label=obj.label,
                         description=obj.description,
                         tags=obj.tags,
                         name=name,
                         status=status,
                         changed=changed,
                         tcp_version=tcp_version,
                         tcp_port=tcp_port,
                         tcp_shared=tcp_shared,
                         tcp_interface=tcp_interface,
                         tcp_backlog=tcp_backlog,
                         tls_key=tls_key,
                         tls_certificate=tls_certificate,
                         tls_chain_certificates=tls_chain_certificates,
                         tls_ca_certificates=tls_ca_certificates,
                         tls_dhparam=tls_dhparam,
                         tls_ciphers=tls_ciphers,
                         http_client_timeout=http_client_timeout,
                         http_hsts=http_hsts,
                         http_hsts_max_age=http_hsts_max_age,
                         http_access_log=http_access_log,
                         http_display_tracebacks=http_display_tracebacks,
                         _unknown=_unknown)

        return obj