全部產品
Search
文件中心

Resource Management:ListSharedResources - 查詢共用或其他帳號共用的資源清單

更新時間:Oct 13, 2025

查詢共用的資源清單或者其他帳號共用的資源清單。

介面說明

本文將提供一個樣本,查詢您在cn-hangzhou地區共用的資源清單。返回結果顯示,您只共用過 1 個資源,即在共用單元rs-6GRmdD3X****內共用過VSwitch類型的資源vsw-bp1upw03qyz8n7us9****

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

resourcesharing:ListSharedResources

list

*全部資源

*

請求參數

名稱

類型

必填

描述

樣本值

ResourceOwner

string

共用單元歸屬者。取值:

  • Self:查詢您建立的共用單元中,共用給其他帳號的資源清單。

  • OtherAccounts:查詢其他帳號建立的共用單元中,共用給您的資源清單。

Self

ResourceType

string

共用資源類型。

支援共用的資源類型,請參見支援資源共用的雲端服務

VSwitch

Target

string

資源使用者 ID 或資源所有者 ID。取值:

  • ResourceOwnerSelf時,該參數為資源使用者 ID。

  • ResourceOwnerOtherAccounts時,該參數為資源所有者 ID。

172050525300****

MaxResults

integer

單次請求返回結果的最大條數。

取值範圍:1~100。預設值:20。

20

NextToken

string

當請求的返回結果被截斷時,您可以使用NextToken再次發起請求,擷取從當前截斷位置之後的內容。

TGlzdFJlc291cm****

ResourceShareIds

array

共用單元 ID。

N 的取值範圍:1~5,即每次最多指定 5 個共用單元。

rs-6GRmdD3X****

string

共用單元 ID。

rs-6GRmdD3X****

ResourceIds

array

共用資源 ID。

N 的取值範圍:1~5,即每次最多指定 5 個共用資源。

vsw-bp1upw03qyz8n7us9****

string

共用資源 ID。

vsw-bp1upw03qyz8n7us9****

ResourceArns

array

共用資源 ARN 列表。

N 的取值範圍:1~5,即每次最多指定 5 個共用資源。

string

共用資源 ARN。

說明

資源 ARN 格式請參見支援資源共用的雲端服務

acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di****

返回參數

名稱

類型

描述

樣本值

object

返回參數。

NextToken

string

當請求的返回結果被截斷時,您可以使用 NextToken 再次發起請求,擷取從當前截斷位置之後的內容。

TGlzdFJlc291cm****

RequestId

string

請求 ID。

04677DCA-7C33-464B-8811-1B1DA3C3D197

SharedResources

array<object>

共用資源資訊。

object

共用資源資訊。

UpdateTime

string

更新關聯資源的時間。

2020-12-07T07:39:02.921Z

ResourceType

string

共用資源類型。

支援共用的資源類型,請參見支援資源共用的雲端服務

VSwitch

CreateTime

string

關聯資源的時間。

2020-12-07T07:39:02.921Z

ResourceShareId

string

共用單元 ID。

rs-6GRmdD3X****

ResourceArn

string

共用資源 ARN。

acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di****

ResourceStatus

string

共用資源狀態。查詢您共用的資源時不返回該參數,查詢共用給您的資源時返回該參數。

取值:

  • Available:資源可用。

  • ZonalResourceInaccessible:在當前可用性區域,資源不可用。

  • LimitExceeded:配額超限,資源不可用。

  • Unavailable:資源不可用。

Available

ResourceStatusMessage

string

關聯失敗的原因。

The reason for the association failure.

ResourceId

string

共用資源 ID。

vsw-bp1upw03qyz8n7us9****

樣本

正常返回樣本

JSON格式

{
  "NextToken": "TGlzdFJlc291cm****",
  "RequestId": "04677DCA-7C33-464B-8811-1B1DA3C3D197",
  "SharedResources": [
    {
      "UpdateTime": "2020-12-07T07:39:02.921Z",
      "ResourceType": "VSwitch",
      "CreateTime": "2020-12-07T07:39:02.921Z",
      "ResourceShareId": "rs-6GRmdD3X****",
      "ResourceArn": "acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di****",
      "ResourceStatus": "Available",
      "ResourceStatusMessage": "The reason for the association failure. ",
      "ResourceId": "vsw-bp1upw03qyz8n7us9****"
    }
  ]
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 MissingParameter.ResourceOwner You must specify ResourceOwner. ResourceOwner參數缺失。
400 InvalidParameter.ResourceOwner The ResourceOwner is invalid. ResourceOwner參數錯誤。
400 InvalidParameter.ResourceType The ResourceType is invalid. 傳入的資源類型錯誤。
400 InvalidParameter.MaxResults The MaxResults is invalid. MaxResults參數錯誤。
400 InvalidParameter.NextToken The NextToken is invalid. NextToken參數錯誤。
400 InvalidParameter.NextToken.Length The maximum length of NextToken exceeds 256 characters. NextToken長度超限(最大256個字元)。
400 InvalidParameter.ResourceShareIds The ResourceShareIds is invalid. ResourceShareIds參數錯誤。
400 InvalidParameter.ResourceShareIds.Duplicate The ResourceShareIds contains duplicate values. ResourceShareIds有重複項。
400 InvalidParameter.ResourceShareIds.Length The maximum length of ResourceShareIds exceeds 5 characters. ResourceShareIds長度超限(最大5個)。
400 InvalidParameter.ResourceIds The ResourceIds is invalid. 傳入的資源ID錯誤。
400 InvalidParameter.ResourceIds.Duplicate The specified ResourceId contains duplicate values. 傳入的資源ID有重複項。
400 InvalidParameter.ResourceIds.Length The maximum number of ResourceIds (5) is exceeded. 傳入的資源ID數量超限(最大5個)。
400 InvalidParameter.Target The Target is invalid. 資源所有者傳參錯誤。
400 InvalidParameter The specified parameter is invalid. 參數無效。
400 InvalidParameter.ResourceArns The ResourceArns is invalid. ResourceArns參數無效。
400 InvalidParameter.ResourceArns.Duplicate The ResourceArns contains duplicate values. 資源ARN參數有重複項。
400 InvalidParameter.ResourceArns.Length The ResourceArns beyond the length limit. 資源ARN數量超限(最大5個)。
400 NotSupport.ResourceType.ResourcesParameter The Resources parameter does not support this resource type. Please use ResourceArns instead. 當前資源類型不支援Resources參數,請使用ResourceArns參數。
400 InvalidParameter.ResourceConflict Both ResourceId and ResourceArn cannot be specified simultaneously. Please provide only one of these parameters. ResourceId 和 ResourceArn 不能同時指定。請僅提供其中一個參數。

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情