本文整理汇总了Python中avi.sdk.avi_api.ApiSession.get_obj_ref方法的典型用法代码示例。如果您正苦于以下问题:Python ApiSession.get_obj_ref方法的具体用法?Python ApiSession.get_obj_ref怎么用?Python ApiSession.get_obj_ref使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类avi.sdk.avi_api.ApiSession
的用法示例。
在下文中一共展示了ApiSession.get_obj_ref方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ssl_vs
# 需要导入模块: from avi.sdk.avi_api import ApiSession [as 别名]
# 或者: from avi.sdk.avi_api.ApiSession import get_obj_ref [as 别名]
def test_ssl_vs(self):
papi = ApiSession(api.controller_ip, api.username, api.password,
verify=False)
ssl_vs_cfg = gSAMPLE_CONFIG["SSL-VS"]
vs_obj = ssl_vs_cfg["vs_obj"]
pool_name = gSAMPLE_CONFIG["SSL-VS"]["pool_obj"]["name"]
resp = papi.post('pool', data=json.dumps(ssl_vs_cfg["pool_obj"]))
pool_ref = papi.get_obj_ref(resp.json())
cert, key, _, _ = get_sample_ssl_params(folder_path='../samples/')
api_utils = ApiUtils(papi)
try:
resp = api_utils.import_ssl_certificate("ssl-vs-kc", key, cert)
ssl_kc = resp.json()
except:
ssl_kc = api.get_object_by_name('sslkeyandcertificate',
'ssl-vs-kc')
ssl_key_and_cert_ref = [papi.get_obj_ref(ssl_kc)]
vs_obj["pool_ref"] = pool_ref
vs_obj["ssl_key_and_certificate_refs"] = ssl_key_and_cert_ref
resp = papi.post('virtualservice', data=json.dumps(vs_obj))
assert resp.status_code < 300
resp = papi.delete_by_name('virtualservice', vs_obj['name'])
assert resp.status_code in (200, 204)
resp = papi.delete_by_name("pool", pool_name)
assert resp.status_code in (200, 204)
resp = api.delete_by_name('sslkeyandcertificate', 'ssl-vs-kc')
assert resp.status_code in (200, 204)