def to_json(self): r = { "name": self.name, "$collection": self._meta["json_collection"], "uuid": self.uuid, "single_service": self.single_service, "single_client": self.single_client, "allow_children": self.allow_children, } if self.description: r["description"] = self.description if self.service_model: r["service_model"] = self.service_model if self.client_model: r["client_model"] = self.client_model return to_json( r, order=[ "name", "$collection", "uuid", "description", "service_model", "client_model", "single_service", "single_client", "allow_children", ], )
def to_json(self): return to_json( { "name": self.name, "$collection": self._meta["json_collection"], "uuid": self.uuid, "values": self.values, }, order=["name", "$collection", "uuid"], )
def to_json(self): return to_json( { "$collection": self._meta["json_collection"], "name": self.name, "uuid": self.uuid, "description": self.description, }, order=["name", "uuid", "description"], )
def to_json(self): return to_json( { "name": self.name, "$collection": self._meta["json_collection"], "uuid": self.uuid, "syntax": self.syntax, }, order=["name", "$collection", "uuid", "syntax"], )
def to_json(self): return to_json( { "$collection": self._meta["json_collection"], "rewrite_mib": self.rewrite_mib, "to_mib": self.to_mib, "uuid": self.uuid, }, order=["$collection", "rewrite_mib", "to_mib", "uuid"], )
def to_json(self): return to_json( { "mib": self.mib, "$collection": self._meta["json_collection"], "uuid": self.uuid, "preference": self.preference, }, order=["mib", "$collection", "uuid", "preference"], )
def to_json(self): r = { "rewrite_oid": self.rewrite_oid, "to_oid": self.to_oid, "uuid": self.uuid, "$collection": self._meta["json_collection"], } if self.description: r["description"] = self.description return to_json(r, order=["$collection", "rewrite_oid", "to_oid", "uuid"])
def to_json(self): return to_json( { "name": self.name, "$collection": self._meta["json_collection"], "uuid": self.uuid, "description": self.description, "cells": [s.to_json() for s in self.cells], }, order=["name", "uuid", "description", "cells"], )
def to_json(self): return to_json( { "$collection": self._meta["json_collection"], "profile__name": self.profile.name, "vendor__code": self.vendor.code[0], "version": self.version, "uuid": self.uuid, }, order=["profile__name", "vendor__code", "version", "uuid"], )
def to_json(self): return to_json( { "name": self.name, "$collection": self._meta["json_collection"], "full_name": self.full_name, "code": self.code, "site": self.site, "uuid": self.uuid, }, order=["name", "uuid", "full_name", "code", "site"], )
def to_json(self): return to_json( self.json_data, order=[ "name", "$collection", "uuid", "table_name", "description", "key_fields", "path", ], )
def to_json(self): return to_json( self.json_data, order=[ "name", "$collection", "uuid", "label", "description", "access_level", "handler", "params", ], )
def to_json(self): return to_json( self.json_data, order=[ "name", "$collection", "uuid", "description", "revision", "disclaimer", "changes", "questions", ], )
def to_json(self): return to_json( self.json_data, order=[ "name", "$collection", "uuid", "description", "revision", "quiz__name", "author", "profile__name", "answers", ], )
def to_json(self): return to_json( self.json_data, order=[ "name", "$collection", "uuid", "description", "label", "dashboard_label", "scale_type", "alt_units", "enum", ], )
def to_json(self): return to_json( self.json_data, order=[ "name", "$collection", "uuid", "vendor__code", "description", "connection_rule__name", "cr_context", "plugins", "tags", ], )
def to_json(self): return to_json( self.json_data, order=[ "name", "$collection", "uuid", "scope__name", "field_name", "field_type", "description", "measure", "vector_tag", ], )
def to_json(self): return to_json( { "title": self.title, "$collection": self._meta["json_collection"], "uuid": str(self.uuid), "description": self.description, "format": self.format, "config": smart_text(b85encode(self.config)), "created": self.created.isoformat(), "changed": self.changed.isoformat(), "access": [], }, order=["title", "uuid", "description", "created"], )
def to_json(self): return to_json( { "name": self.name, "$collection": self._meta["json_collection"], "uuid": self.uuid, "re": self.re, "key_re": self.key_re, "value_re": self.value_re, "rewrite_from": self.rewrite_from, "rewrite_to": self.rewrite_to, }, order=[ "name", "uuid", "re", "key_re", "value_re", "rewrite_from", "rewrite_to" ], )
def to_json(self): return to_json( self.json_data, order=[ "name", "$collection", "uuid", "action__name", "description", "profile__name", "config_mode", "preference", "match", "commands", "timeout", ], )
def to_json(self): return to_json( self.json_data, order=[ "name", "$collection", "uuid", "description", "preference", "method", "param", "match_method", "value", "action", "profile__name", ], )
def to_json(self): return to_json( { "name": self.name, "$collection": self._meta["json_collection"], "uuid": str(self.uuid), "description": self.description, "umbrella_filter_handler": self.umbrella_filter_handler, "window_type": self.window_type, "window": self.window, "window_function": self.window_function, "window_config": self.window_config, "value_handler": self.value_handler, "thresholds": [thrh.to_json() for thrh in self.thresholds], }, order=["name", "uuid", "thresholds"], )
def to_json(self): r = { "name": self.name, "$collection": self._meta["json_collection"], "uuid": self.uuid, "subject_template": self.subject_template, "body_template": self.body_template, } if self.description: r["description"] = self.description return to_json( r, order=[ "name", "$collection", "uuid", "description", "subject_template", "body_template", ], )
def to_json(self): r = { "$collection": self._meta["json_collection"], "vendor__code": self.vendor.code[0], "name": self.name, "uuid": self.uuid, } if self.aliases: r["aliases"] = [str(x) for x in self.aliases] if self.description: r["description"] = self.description if self.start_of_sale: r["start_of_sale"] = self.start_of_sale.strftime("%Y-%m-%d") if self.end_of_sale: r["end_of_sale"] = self.end_of_sale.strftime("%Y-%m-%d") if self.end_of_support: r["end_of_support"] = self.end_of_support.strftime("%Y-%m-%d") if self.snmp_sysobjectid: r["snmp_sysobjectid"] = self.snmp_sysobjectid if self.labels: r["labels"] = self.labels return to_json( r, order=[ "vendor__code", "name", "$collection", "uuid", "aliases", "description", "start_of_sale", "end_of_sale", "end_of_support", "snmp_sysobjectid", "labels", ], )
def to_json(self): r = { "name": self.name, "$collection": self._meta["json_collection"], "uuid": self.uuid, "from_mac": self.from_mac, "to_mac": self.to_mac, "affected": [a.to_json() for a in self.affected], "is_duplicated": self.is_duplicated, } if self.description: r["description"] = self.description return to_json( r, order=[ "name", "uuid", "from_mac", "to_mac", "description", "is_duplicated", "affected", ], )
def to_json(self): r = { "name": self.name, "$collection": self._meta["json_collection"], "uuid": self.uuid, "source": self.source, "params": [p.to_json() for p in self.params], "allow_object_filter": self.allow_object_filter, "allow_interface_filter": self.allow_interface_filter, "allow_object_validation": self.allow_object_validation, "allow_interface_validation": self.allow_interface_validation, "allow_object_classification": self.allow_object_classification, "allow_interface_classification": self.allow_interface_classification, "require_raw": self.require_raw, } if self.description: r["description"] = self.description return to_json( r, order=[ "name", "$collection", "uuid", "description", "source", "params", "allow_object_filter", "allow_interface_filter", "allow_object_validation", "allow_interface_validation", "allow_object_classification", "allow_interface_classification", "require_raw", ], )
def test_prettyjson_error(config, expected): with pytest.raises(TypeError): assert to_json(config).startswith("{\n") == expected
def test_prettyjson(config, expected): assert to_json(config).startswith("{\n") == expected
def api_action_json(self, request, ids): r = [o.json_data for o in ids] s = to_json(r, order=["name", "vendor__code", "description"]) return {"data": s}
def to_json(self): return to_json(self.json_data, order=["name", "$collection", "uuid", "description"])