查詢共用單元中關聯資源或資源使用者的記錄。
介面說明
本文將提供一個樣本,在cn-hangzhou地區,查詢當前帳號建立的共用單元中關聯的共用資源的記錄。返回結果顯示,當前帳號關聯過以下 2 個資源:
在共用單元
rs-6GRmdD3X****中,添加過VSwitch類型的共用資源vsw-bp1upw03qyz8n7us9****,該資源處於關聯中Associated狀態,即該資源正常共用中。在共用單元
rs-6GRmdD3X****中,移除過VSwitch類型的共用資源vsw-bp183p93qs667muql****,該資源處於已分離Disassociated狀態,即該資源已停止分享。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
resourcesharing:ListResourceShareAssociations |
list |
*全部資源
|
無 | 無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| ResourceId |
string |
否 |
資源 ID。 說明
當 |
vsw-bp183p93qs667muql**** |
| ResourceArn |
string |
否 |
資源 ARN。 說明
當 |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
| Target |
string |
否 |
資源使用者 ID。 說明
當 |
172050525300**** |
| AssociationType |
string |
是 |
關聯類別型:取值:
|
Resource |
| AssociationStatus |
string |
否 |
關聯狀態。取值:
說明
|
Associated |
| MaxResults |
integer |
否 |
單次請求返回結果的最大條數。 取值範圍:1~100。預設值:20。 |
20 |
| NextToken |
string |
否 |
當請求的返回結果被截斷時,您可以使用 |
TGlzdFJlc291cm**** |
| ResourceShareIds |
array |
否 |
共用單元 ID。 N 的取值範圍:1~5,即每次最多指定 5 個共用單元。 |
rs-6GRmdD3X**** |
|
string |
否 |
共用單元 ID。 |
rs-6GRmdD3X**** |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
返回參數。 |
||
| NextToken |
string |
當請求的返回結果被截斷時,您可以使用 |
TGlzdFJlc291cm**** |
| RequestId |
string |
請求 ID。 |
11BA57B5-7301-4E2F-BBA5-2AE4C2F4FCDB |
| ResourceShareAssociations |
array<object> |
共用資源或資源使用者資訊。 |
|
|
array<object> |
共用資源或資源使用者資訊。 |
||
| UpdateTime |
string |
更新關聯的時間。存在以下兩種情況:
|
2020-12-07T07:39:02.920Z |
| EntityId |
string |
關聯實體 ID。取值:
|
vsw-bp1upw03qyz8n7us9**** |
| ResourceArn |
string |
關聯資源 ARN。 說明
當關聯類別型 |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
| ResourceShareName |
string |
共用單元名稱。 |
example |
| CreateTime |
string |
關聯的時間。存在以下兩種情況:
|
2020-12-07T07:39:01.818Z |
| EntityType |
string |
關聯實體類型。取值:
|
VSwitch |
| ResourceShareId |
string |
共用單元 ID。 |
rs-6GRmdD3X**** |
| AssociationStatusMessage |
string |
關聯失敗的原因。 |
The reason for the association failure. |
| AssociationType |
string |
關聯類別型。取值:
|
Resource |
| AssociationStatus |
string |
關聯狀態。取值:
說明
|
Failed |
| External |
boolean |
資源使用者是否為資來源目錄外帳號。取值:
|
false |
| AssociationFailedDetails |
array<object> |
關聯或解除關聯資源或者資源使用者檢查失敗詳細原因。 |
|
|
object |
關聯或解除關聯資源或者資源使用者檢查失敗詳細原因。 |
||
| Status |
string |
已棄用。請使用 FailureReason。 |
無 |
| StatusMessage |
string |
已棄用。請使用 FailureDescription。 |
無 |
| AssociateType |
string |
已棄用。請使用 OperationType。 |
無 |
| ResourceArn |
string |
關聯資源 ARN。 說明
當 |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
| EntityType |
string |
關聯實體類型。取值:
|
Account |
| FailureReason |
string |
關聯或解除關聯失敗時的原因。 取值:
|
Unavailable |
| FailureDescription |
string |
關聯或解除關聯失敗時的詳細原因描述。 |
You cannot access the specified resource at this time. |
| OperationType |
string |
操作類型。取值:
|
Associate |
| EntityId |
string |
關聯實體 ID。取值:
|
172050525300**** |
| TargetProperty |
string |
資源使用者屬性。例如:資源共用的時間段。
說明
僅當資源使用者為阿里雲服務時返回該參數。 |
{ "timeRange":{ "timeRangeType":"timeRange", "beginAtTime":"00:00", "timezone":"UTC+8", "endAtTime":"19:59" } } |
| ResourceProperty |
string |
資源屬性。 |
{"sharePrincipals":true,"shareTagOptions":false} |
樣本
正常返回樣本
JSON格式
{
"NextToken": "TGlzdFJlc291cm****",
"RequestId": "11BA57B5-7301-4E2F-BBA5-2AE4C2F4FCDB",
"ResourceShareAssociations": [
{
"UpdateTime": "2020-12-07T07:39:02.920Z",
"EntityId": "vsw-bp1upw03qyz8n7us9****",
"ResourceArn": "acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di****",
"ResourceShareName": "example",
"CreateTime": "2020-12-07T07:39:01.818Z",
"EntityType": "VSwitch",
"ResourceShareId": "rs-6GRmdD3X****",
"AssociationStatusMessage": "The reason for the association failure. ",
"AssociationType": "Resource",
"AssociationStatus": "Failed",
"External": false,
"AssociationFailedDetails": [
{
"Status": "無",
"StatusMessage": "無",
"AssociateType": "無",
"ResourceArn": "acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di****",
"EntityType": "Account",
"FailureReason": "Unavailable",
"FailureDescription": "You cannot access the specified resource at this time.",
"OperationType": "Associate",
"EntityId": "172050525300****"
}
],
"TargetProperty": "{\n \"timeRange\":{\n \"timeRangeType\":\"timeRange\",\n \"beginAtTime\":\"00:00\",\n \"timezone\":\"UTC+8\",\n \"endAtTime\":\"19:59\"\n }\n}",
"ResourceProperty": "{\"sharePrincipals\":true,\"shareTagOptions\":false}"
}
]
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | MissingParameter.AssociationType | You must specify AssociationType. | AssociationType參數缺失。 |
| 400 | InvalidParameter.AssociationType | The AssociationType is invalid. | AssociationType參數錯誤。 |
| 400 | InvalidParameter.AssociationStatus | The AssociationStatus is invalid. | AssociationStatus參數錯誤。 |
| 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.Target | The Target is invalid. | 資源所有者傳參錯誤。 |
| 400 | InvalidParameter.ResourceId | The ResourceId is invalid. | ResourceId參數錯誤。 |
| 400 | ConflictedAssociationType | The specified ResourceId or Target conflicts with AssociationType. | 參數組合衝突:傳入參數與AssociationType選定項不符。 |
| 400 | InvalidParameter | The specified parameter is invalid. | 參數無效。 |
| 400 | InvalidParameter.ResourceArn | The ResourceArn is invalid. | 資源ARN參數無效。 |
| 400 | InvalidParameter.ResourceConflict | Both ResourceId and ResourceArn cannot be specified simultaneously. Please provide only one of these parameters. | ResourceId 和 ResourceArn 不能同時指定。請僅提供其中一個參數。 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。