Ibm cloud 如何在Python应用程序中使用COS操作我的VPC(虚拟私有云)实例?(IBM云)
我正试图用Python编写一个算法,从COS(IBM云对象存储)获取一个文件,并将其传输到VPC(虚拟私有云) 我正在使用此代码尝试执行此过程:Ibm cloud 如何在Python应用程序中使用COS操作我的VPC(虚拟私有云)实例?(IBM云),ibm-cloud,vpc,cloud-object-storage,Ibm Cloud,Vpc,Cloud Object Storage,我正试图用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 = IAMAuthent
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基于S3,有自己的API。列出了所有解决我问题的方法。但是现在,我得到了COS端点的错误。我编辑了上面的问题,你能帮我吗?你是否为你的帐户配置了服务授权,允许VPC从你的COS实例获取图像文件?更多细节:是的,我有服务授权,但不是我创建了服务授权。这是一个问题吗?我会考虑对您的服务配置和/或用户的IAM策略进行故障排除,以确保您对COS中的文件有正确的访问权限。当我尝试CLI
ibmcloud时,它是一个映像创建映像测试——操作系统名称“ubuntu-16-amd64”——文件cos://us-south/cos-vm-migration/maquina-windows.qcow2
,我收到了相同的错误400,错误消息为“请检查您请求的资源是否存在。”-我显然无权访问您的COS实例/存储桶。
ibm_cloud_sdk_core.api_exception.ApiException: Error: Please check whether the resource you are requesting exists., Code: 400