第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

從 AWS ECS 集群獲取標(biāo)簽返回空列表

從 AWS ECS 集群獲取標(biāo)簽返回空列表

開滿天機(jī) 2023-05-17 16:44:29
我需要從我的 ECS 集群中讀取標(biāo)簽。我通過describeClusters()調(diào)用成功列出了我的所有集群。然后我進(jìn)行了getTags()調(diào)用,但它錯誤地返回了一個空列表。    List<Cluster> clusters = clusterDescriptionResult.getClusters();    for (Cluster cluster : clusters) {        String clusterArn = cluster.getClusterArn();        //System.out.println("Cluster: " + clusterArn);        List<Tag> tagList = cluster.getTags();我想我一定是做錯了什么,所以作為測試,我用 Python 重寫了代碼。    clusterList = ecsClient.list_clusters()    for clusterArn in clusterList["clusterArns"]:        tagListData = ecsClient.list_tags_for_resource(resourceArn=clusterArn)        tagList = tagListData["tags"](編輯:這段 Python 代碼工作得很好——請參閱評論了解為什么它最初不工作)與其給我一個空列表,list_tags_for_resource()更喜歡拋出一個異常:AttributeError: 'ECS' object has no attribute 'list_tags_for_resource'在這一點(diǎn)上,我想知道......我有過時(shí)的包裹嗎?根據(jù)我的 pom.xml,我使用的是版本 1.11.604 (Java) 或 boto3-1.9.202 botocore-1.12.202 (Python),據(jù)我所知這似乎是最新的(2019 年 8 月)。編輯:我現(xiàn)在已經(jīng)從命令行嘗試過,并且確實(shí)有效:    aws ecs list-tags-for-resource --resource-arn {cluster_arn}
查看完整描述

1 回答

?
慕容708150

TA貢獻(xiàn)1831條經(jīng)驗(yàn) 獲得超4個贊

看起來這是 API 中的錯誤。解決方法是暫時(shí)使用 ListTagsForResourceRequest() 調(diào)用,它會正確返回集群的標(biāo)簽。


    ListTagsForResourceRequest tagRequest = new ListTagsForResourceRequest().withResourceArn(clusterArn);

    ListTagsForResourceResult tagResult = amazonECS.listTagsForResource(tagRequest);

    List<Tag> tagList = tagResult.getTags();


查看完整回答
反對 回復(fù) 2023-05-17
  • 1 回答
  • 0 關(guān)注
  • 162 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號