def marshal(self): """ Marshal this object to a generic host language object. :return: dict """ obj = ConfigurationElement.marshal(self) obj.update({ 'cluster_oid': str(self.cluster_oid) if self.cluster_oid else None, 'name': self.name, 'scale': self.scale, 'status': STATUS_BY_CODE[self.status] if self.status else None, 'changed': int(self.changed) if self.changed else None, }) return obj
def marshal(self): """ Marshal this object to a generic host language object. :return: dict """ obj = ConfigurationElement.marshal(self) obj.update({ 'oid': str(self.oid), 'name': self.name, 'created': int(self.created.timestamp() * 1000000) if self.created else None, 'owner': str(self.owner), 'cf_router_worker': self.cf_router_worker, 'cf_container_worker': self.cf_container_worker, }) if self._unknown: # pass through all attributes unknown obj.update(self._unknown) return obj
def marshal(self): """ Marshal this object to a generic host language object. :return: dict """ obj = ConfigurationElement.marshal(self) obj.update({ 'oid': str(self.oid) if self.oid else None, 'modified': int(self.modified) if self.modified else None, 'arealm_oid': str(self.arealm_oid) if self.arealm_oid else None, 'authid': self.authid, 'role_oid': str(self.role_oid) if self.role_oid else None, 'authextra': self.authextra, }) if self._unknown: # pass through all attributes unknown obj.update(self._unknown) return obj
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
def marshal(self): """ Marshal this object to a generic host language object. :return: dict """ obj = ConfigurationElement.marshal(self) assert self.owner_oid is None or isinstance(self.owner_oid, uuid.UUID) assert type(self.pubkey) == six.text_type and len(self.pubkey) == 64 assert self.mrealm_oid is None or isinstance(self.mrealm_oid, uuid.UUID) assert self.authid is None or type(self.authid) == six.text_type assert self.authextra is None or type(self.authextra) == dict obj.update({ 'owner_oid': str(self.owner_oid) if self.owner_oid else None, 'pubkey': self.pubkey, 'mrealm_oid': str(self.mrealm_oid) if self.mrealm_oid else None, 'authid': self.authid, 'authextra': self.authextra, }) return obj
def copy(self, other): ConfigurationElement.copy(self, other) self.name = other.name self.otype = other.otype self.registered = other.registered
def __init__(self, oid=None, label=None, description=None, tags=None, name=None, created=None, owner=None, cf_node=None, cf_router_worker=None, cf_container_worker=None, _unknown=None): """ :param oid: Object ID of management realm :type oid: uuid.UUID :param label: Optional user label of management realm :type label: str :param description: Optional user description of management realm :type description: str :param tags: Optional list of user tags on management realm :type tags: list[str] :param name: Name of management realm :type name: str :param created: Timestamp when the management realm was created :type created: datetime.datetime :param owner: Owning user (object ID) :type owner: uuid.UUID :param cf_node: *INTERNAL USE* CFC hosting node for this management realm :type cf_node: str :param cf_router_worker: *INTERNAL USE* CFC hosting router worker for this management realm :type cf_router_worker: str :param cf_container_worker: *INTERNAL USE* CFC hosting container worker for this management realm :type cf_container_worker: str :param _unknown: Any unparsed/unprocessed data attributes :type _unknown: None or dict """ ConfigurationElement.__init__(self, oid=oid, label=label, description=description, tags=tags) self.name = name self.created = created self.owner = owner self.cf_node = cf_node self.cf_router_worker = cf_router_worker self.cf_container_worker = cf_container_worker # private member with unknown/untouched data passing through self._unknown = _unknown
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_node', '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.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_node = data.get('cf_node', None) assert cf_node is None or type(cf_node) == six.text_type if cf_node: cf_node = uuid.UUID(cf_node) cf_router_worker = data.get('cf_router_worker', None) assert cf_router_worker is None or type( cf_router_worker) == six.text_type if cf_router_worker: cf_router_worker = uuid.UUID(cf_router_worker) cf_container_worker = data.get('cf_container_worker', None) assert cf_container_worker is None or type( cf_container_worker) == six.text_type if cf_container_worker: cf_container_worker = uuid.UUID(cf_container_worker) obj = ManagementRealm(oid=obj.oid, label=obj.label, description=obj.description, tags=obj.tags, name=name, owner=owner, created=created, cf_node=cf_node, cf_router_worker=cf_router_worker, cf_container_worker=cf_container_worker, _unknown=_unknown) return obj
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
def __init__(self, oid=None, label=None, description=None, tags=None, name=None, status=None, changed=None, tcp_version=None, tcp_port=None, tcp_shared=None, tcp_interface=None, tcp_backlog=None, tls_key=None, tls_certificate=None, tls_chain_certificates=None, tls_ca_certificates=None, tls_dhparam=None, tls_ciphers=None, http_client_timeout=None, http_hsts=None, http_hsts_max_age=None, http_access_log=None, http_display_tracebacks=None, _unknown=None): """ :param oid: Object ID of node :type oid: uuid.UUID :param label: Optional user label of node :type label: str :param description: Optional user description of node :type description: str :param tags: Optional list of user tags on node :type tags: list[str] :param tcp_version: IP version, either 4 for 6 :type tcp_version: int :param tcp_port: IP listening port :type tcp_port: int :param tcp_shared: enable TCP port sharing :type tcp_shared: bool :param tcp_interface: listen on this interface :type tcp_interface: str :param tcp_backlog: TCP accept backlog queue size :type tcp_backlog: int :param tls_key: TLS server private key to use :type tls_key: str :param tls_certificate: TLS server certificate to use :type tls_certificate: str :param tls_chain_certificates: TLS certificate chain :type tls_chain_certificates: list[str] :param tls_ca_certificates: CA certificates to use :type tls_ca_certificates: list[str] :param tls_dhparam: DH parameter file :type tls_dhparam: str :param tls_ciphers: Ciphers list :type tls_ciphers: str :param http_client_timeout: HTTP client inactivity timeout :type http_client_timeout: int :param http_hsts: enable HTTP strict transport security (HSTS) :type http_hsts: bool :param http_hsts_max_age: HSTS maximum age to announce :type http_hsts_max_age: int :param http_access_log: enable Web request access logging :type http_access_log: bool :param http_display_tracebacks: enable tracebacks when running into Web errors :type http_display_tracebacks: bool :param _unknown: Any unparsed/unprocessed data attributes :type _unknown: None or dict """ ConfigurationElement.__init__(self, oid=oid, label=label, description=description, tags=tags) self.name = name self.status = status self.changed = changed self.tcp_version = tcp_version self.tcp_port = tcp_port self.tcp_shared = tcp_shared self.tcp_interface = tcp_interface self.tcp_backlog = tcp_backlog self.tls_key = tls_key self.tls_certificate = tls_certificate self.tls_chain_certificates = tls_chain_certificates self.tls_ca_certificates = tls_ca_certificates self.tls_dhparam = tls_dhparam self.tls_ciphers = tls_ciphers self.http_client_timeout = http_client_timeout self.http_hsts = http_hsts self.http_hsts_max_age = http_hsts_max_age self.http_access_log = http_access_log self.http_display_tracebacks = http_display_tracebacks
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