async def cloud_instance_delete(ns={}): # 客户方需要提供用户密码,用basic_auth_headers函数生成验证用户所需 # 的http请求的headers,并在请求是放在headers参数中 headers = basic_auth_headers('kyycloud','Kyy@123456') hc = HttpClient() # https://pcapi.opencomputing.cn/api/v1/create_pod.dspy resp = await hc.request('https://pcapi.opencomputing.cn/api/v1/server_instance_delete.dspy', method='GET', params=ns, headers=headers) resp = json.loads(resp) if isinstance(resp, str) else resp if resp['status']: db = DBPools() async with db.sqlorContext('kboss') as sor: await sor.U('kyy8s_ins', {'id': ns['id'], 'status': 0, 'del_flg': '1'}) await sor.U('customer_goods', {'id': ns['customer_goods_id'], 'del_flg': '1'}) return { 'status': True, 'msg': '删除实例成功' } else: return { 'status': False, 'msg': '删除实例失败, %s' % resp.get('msg') } ret = await cloud_instance_delete(params_kw) return ret