如何解决如何在 Python 应用程序中使用 COS 操作我的 VPC虚拟私有云实例? IBM 云
我正在尝试使用 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 举报,一经查实,本站将立刻删除。