首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何解决API调用RunInstances时TagSpecification不合规范?

如何解决API调用RunInstances时TagSpecification不合规范?

提问于 2020-05-06 19:45:03
回答 0关注 0查看 139

Python API,调用代码大致如下:

req = models.RunInstancesRequest()

(其他参数略)

tags={

'Key1': 'Value1',

'Key2': 'Value2'

}

tag_spec = models.TagSpecification()

tag_spec.ResourceType = 'instance'

tag_spec.Tags = []

for key in tags:

            tag = models.Tag()

            tag.Key = key

            tag.Value = tags[key]

            tag_spec.Tags.append(tag)

req.TagSpecification = tag_spec

response = client.RunInstances(req)

调用时报错:

tencentcloud.common.exception.tencent_cloud_sdk_exception.TencentCloudSDKException: [TencentCloudSDKException] code:InvalidParameterValue message:参数`TagSpecification`中`{'ResourceType': 'instance', 'Tags': [{'Key

': 'Key1', 'Value': 'Value1'}, {'Key': 'Key2', 'Value': 'Value2'}]}`不合规范

请问“符合规范”的TagSpecification应当如何指定?

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档