Exemplo n.º 1
0
def load_from_json(json_data):
    name = json_data.get('name')
    res = restriction.Restriction(name)
    rules = json_data.get('rules', [])
    rules = [rule.load_from_json(r) for r in rules]
    res.rules = rules
    return res
Exemplo n.º 2
0
def load_from_json(json_data):
    name = json_data.get('name')
    access = json_data.get('access', 'whitelist')
    res = restriction.Restriction(name, access)
    rules = json_data.get('rules', [])
    rules = [rule.load_from_json(r) for r in rules]
    res.rules = rules
    return res
Exemplo n.º 3
0
def load_from_json(json_data):
    origin_name = json_data.get("origin")
    port = json_data.get("port", 80)
    ssl = json_data.get("ssl", False)
    rules = json_data.get("rules", [])
    rules = [rule.load_from_json(r) for r in rules]
    result = origin.Origin(origin_name, port, ssl)
    result.rules = rules
    return result
Exemplo n.º 4
0
def load_from_json(json_data):
    origin_name = json_data.get("origin")
    origin_name = origin_name.rstrip("/")
    hostheadertype = json_data.get("hostheadertype", "domain")
    hostheadervalue = json_data.get("hostheadervalue", None)
    port = json_data.get("port", 80)
    ssl = json_data.get("ssl", False)
    rules = json_data.get("rules", [])
    rules = [rule.load_from_json(r) for r in rules]
    result = origin.Origin(origin=origin_name, hostheadertype=hostheadertype,
                           hostheadervalue=hostheadervalue, port=port,
                           ssl=ssl)
    result.rules = rules
    return result
Exemplo n.º 5
0
def load_from_json(json_data):
    origin_name = json_data.get("origin")
    origin_name = origin_name.rstrip("/")
    hostheadertype = json_data.get("hostheadertype", "domain")
    hostheadervalue = json_data.get("hostheadervalue", None)
    port = json_data.get("port", 80)
    ssl = json_data.get("ssl", False)
    rules = json_data.get("rules", [])
    rules = [rule.load_from_json(r) for r in rules]
    result = origin.Origin(origin=origin_name,
                           hostheadertype=hostheadertype,
                           hostheadervalue=hostheadervalue,
                           port=port,
                           ssl=ssl)
    result.rules = rules
    return result
Exemplo n.º 6
0
def load_from_json(json_data):
    name = json_data.get("name")
    ttl = json_data.get("ttl")
    rules = json_data.get("rules", [])
    rules = [rule.load_from_json(r) for r in rules]
    return cachingrule.CachingRule(name, ttl, rules)
Exemplo n.º 7
0
def load_from_json(json_data):
    name = json_data.get('name')
    ttl = json_data.get('ttl')
    rules = json_data.get('rules', [])
    rules = [rule.load_from_json(r) for r in rules]
    return cachingrule.CachingRule(name, ttl, rules)