Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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)
Beispiel #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)