问题描述
我正在尝试使用 Python 编写一个算法,该算法从 COS(IBM 云对象存储)获取文件并将其传输到 VPC(虚拟私有云)。 .
我正在使用此代码尝试执行此过程:
from ibm_vpc import VpcV1
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
from ibm_cloud_sdk_core import ApiException
import logging
authenticator = IAMAuthenticator("")
service = VpcV1(authenticator=authenticator)
image_file_prototype_model = {}
image_file_prototype_model['href']= "cos://us-south/cos-vm-migration/maquina-windows.qcow2"
logging.getLogger('image_file_prototype_model')
operating_system_identity_model = {}
operating_system_identity_model['name'] = 'ubuntu-16-amd64'
resource_group_identity_model = {}
resource_group_identity_model['id'] = 'bfe34d16c974497aa0b009a430b04de8'
image_prototype_model = {}
image_prototype_model['name'] = 'my-migration-vms'
print(image_prototype_model['name'])
image_prototype_model['resource_group'] = resource_group_identity_model
image_prototype_model['file'] = image_file_prototype_model
image_prototype_model[
'operating_system'] = operating_system_identity_model
image_prototype = image_prototype_model
response = service.create_image(image_prototype)
但是,我不断收到此错误:
Traceback (most recent call last):
File "ibm-vpc.py",line 35,in <module>
response = service.create_image(image_prototype)
File "/home/caique/.local/lib/python3.6/site-packages/ibm_vpc/vpc_v1.py",line 2569,in create_image
response = self.send(request)
File "/home/caique/.local/lib/python3.6/site-packages/ibm_cloud_sdk_core/base_service.py",line 302,in send
raise ApiException(response.status_code,http_response=response)
ibm_cloud_sdk_core.api_exception.ApiException: Error: Please check whether the resource you are requesting exists.,Code: 400
这条线抱怨说我没有 COS 服务,但我有 COS 服务
ibm_cloud_sdk_core.api_exception.ApiException: Error: Please check whether the resource you are requesting exists.,Code: 400
有人可以帮我解决这个问题!?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)