5.python 设计模式-函数式编程
def run():
obj = get_source_target_obj()
trans = {
"hosts": transfrom_hosts_general,
}
trans[obj.type](obj)
def get_source_target_obj():
pass
def transfrom_hosts_general(obj):
uri = "show-hosts"
info ={
"layer": "Network",
"position": 1,
"name": "Rule 1",
# "service": ["SMTP", "AOL"],
# "vpn": "MyIntranet"
}
res = Checkpoint.add_access_rule( info)
data = res['data']['uid']
print(data)
print('\n')
print('\n')
print('\n')
print(res)