大佬教程收集整理的这篇文章主要介绍了如何在 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 (将#修改为@)
以上是大佬教程为你收集整理的如何在 Python 应用程序中使用 COS 操作我的 VPC(虚拟私有云)实例? (IBM 云)全部内容,希望文章能够帮你解决如何在 Python 应用程序中使用 COS 操作我的 VPC(虚拟私有云)实例? (IBM 云)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。