為共用單元移除共用資源或資源使用者。
介面說明
資源所有者可以調用本 API,移除共用資源或資源使用者。
在資來源目錄外共用資源時,對於已加入共用的資源使用者,可以調用本 API 主動退出共用單元。更多資訊,請參見資源使用者退出共用單元。
本文將提供一個樣本,使用資來源目錄管理帳號,在cn-hangzhou地區的共用單元rs-6GRmdD3X****中,移除資源使用者172050525300****,即停止對該資源使用者的共用。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
resourcesharing:DisassociateResourceShare |
update |
*全部資源
|
|
無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| ResourceShareId |
string |
是 |
共用單元 ID。 |
rs-6GRmdD3X**** |
| Resources |
array<object> |
否 |
資源清單。 |
|
|
object |
否 |
資源清單。 |
||
| ResourceType |
string |
否 |
共用資源類型。 N 的取值範圍:1~5,即每次最多移除 5 個共用資源。 支援共用的資源類型,請參見支援資源共用的雲端服務。 說明
Resources.N.ResourceId 與 Resources.N.ResourceType 成對出現,需要同時設定。 |
VSwitch |
| ResourceId |
string |
否 |
共用資源 ID。 N 的取值範圍:1~5,即每次最多移除 5 個共用資源。 說明
Resources.N.ResourceId 與 Resources.N.ResourceType 成對出現,需要同時設定。 |
vsw-bp183p93qs667muql**** |
| Targets |
array |
否 |
資源使用者。 |
172050525300**** |
|
string |
否 |
資源使用者。 N 的取值範圍:1~5,即每次最多添加 5 個資源使用者。 |
172050525300**** |
|
| ResourceArns |
array |
否 |
共用資源 ARN 列表。 N 的取值範圍:1~5,即每次最多移除 5 個共用資源。 |
|
|
string |
否 |
共用資源 ARN。 說明
資源 ARN 格式請參見支援資源共用的雲端服務。 |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
|
| ResourceOwner |
string |
否 |
共用單元歸屬者。取值:
|
Self |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
返回參數。 |
||
| RequestId |
string |
請求 ID。 |
95230BC9-A8E8-4493-96BD-4F0C758E37F8 |
| ResourceShareAssociations |
array<object> |
共用單元關聯的共用資源或資源使用者資訊。 |
|
|
object |
共用單元關聯的共用資源或資源使用者資訊。 |
||
| UpdateTime |
string |
取消關聯的更新時間。存在以下兩種情況:
|
2020-12-04T09:40:45.556Z |
| ResourceArn |
string |
關聯資源 ARN。 說明
當關聯類別型 |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
| ResourceShareName |
string |
共用單元名稱。 |
test |
| CreateTime |
string |
取消關聯的時間。存在以下兩種情況:
|
2020-12-04T09:40:41.250Z |
| EntityType |
string |
關聯實體類型。取值:
|
Account |
| ResourceShareId |
string |
共用單元 ID。 |
rs-6GRmdD3X**** |
| AssociationStatusMessage |
string |
取消關聯失敗的原因。 |
The Resources is invalid. |
| AssociationType |
string |
關聯類別型。取值:
|
Target |
| AssociationStatus |
string |
關聯狀態。取值:
說明
|
Disassociating |
| TargetProperty |
string |
資源使用者屬性。例如:資源共用的時間段。 說明
僅當資源使用者為阿里雲服務時返回該參數。 |
{ "timeRange":{ "timeRangeType":"timeRange", "beginAtTime":"00:00", "timezone":"UTC+8", "endAtTime":"19:59" } } |
| EntityId |
string |
關聯實體 ID。取值:
|
172050525300**** |
| ResourceProperty |
string |
{"sharePrincipals":true,"shareTagOptions":false} |
樣本
正常返回樣本
JSON格式
{
"RequestId": "95230BC9-A8E8-4493-96BD-4F0C758E37F8",
"ResourceShareAssociations": [
{
"UpdateTime": "2020-12-04T09:40:45.556Z",
"ResourceArn": "acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di****",
"ResourceShareName": "test",
"CreateTime": "2020-12-04T09:40:41.250Z",
"EntityType": "Account",
"ResourceShareId": "rs-6GRmdD3X****",
"AssociationStatusMessage": "The Resources is invalid.",
"AssociationType": "Target",
"AssociationStatus": "Disassociating",
"TargetProperty": "{\n \"timeRange\":{\n \"timeRangeType\":\"timeRange\",\n \"beginAtTime\":\"00:00\",\n \"timezone\":\"UTC+8\",\n \"endAtTime\":\"19:59\"\n }\n}",
"EntityId": "172050525300****",
"ResourceProperty": "{\"sharePrincipals\":true,\"shareTagOptions\":false}"
}
]
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | MissingParameter.ResourceShareId | You must specify ResourceShareId. | ResourceShareId參數缺失。 |
| 400 | InvalidParameter.ResourceShareId | The ResourceShareId is invalid. | ResourceShareId參數錯誤。 |
| 400 | InvalidParameter.Resources | The Resources is invalid. | 選定的共用資源無效。 |
| 400 | InvalidParameter.Resources.Duplicate | The Resources contains duplicate values. | 選定的共用資源有重複項。 |
| 400 | InvalidParameter.Resources.Length | The maximum number of Resources exceeds 5. | 選定的共用資源數量超限(最大5個)。 |
| 400 | InvalidParameter.Targets | The Targets is invalid. | 資源使用者的參數不符合規則。 |
| 400 | InvalidParameter.Targets.Duplicate | The Targets contains duplicate values. | 資源使用者有重複項。 |
| 400 | InvalidParameter.Targets.Length | The maximum number of Targets exceeds 5. | 資源使用者數量超限(最大5個)。 |
| 400 | ResourceAndTargetBothEmpty | Either a resource or a shared target must be specified. | 必須指定一個資源或一個資源使用者。 |
| 400 | DisassociateInvalid | You can not disassociate unassociated resource or target. | 對象未關聯,不能取消關聯。 |
| 400 | InvalidParameter | The specified parameter is invalid. | 參數無效。 |
| 400 | InvalidParameter.ResourceType | The ResourceType 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 | InvalidParameter.ResourceConflict | Both Resources and ResourceArns cannot be specified simultaneously. Please provide only one of these parameters. | Resources 和 ResourceArns 不能同時指定。請僅提供其中一個參數。 |
| 400 | NotSupport.ResourceType.ResourcesParameter | The Resources parameter does not support this resource type. Please use ResourceArns instead. | 當前資源類型不支援Resources參數,請使用ResourceArns參數。 |
| 404 | EntityNotExists.ResourceShare | The resource share does not exist in the current account. | 共用單元不在當前帳號內。 |
| 409 | AccountNotInResourceDirectory | The account is not a master or a member of a resource directory. | 資源使用者不在資來源目錄內。 |
| 409 | ResourceShareStatusMismatchAction | The status of the resource share does not allow the specified operation. | 共用單元的狀態不支援當前操作。 |
| 409 | DisassociateConflict | You cannot perform the operation while association is already in progress. | 關聯中,不能操作關聯。 |
| 409 | LeavingFailed.Account | The account was added to the resource share automatically by resoucre directory. | 當前帳號是通過組織內共用添加到共用單元中的帳號,不能主動退出共用單元。需聯絡共用單元的所有者將當前帳號從共用單元中移除。 |
| 409 | LeavingFailed.ResourceType | The resource share contains resources of the resource types that dont support this action. | 共用單元中包含不支援主動退出的資源類型。需聯絡共用單元的所有者將當前帳號從共用單元中移除。 |
| 409 | ExternalTargetWithdrawConflict | Existing internal association task in resource directory when disassociating with resource share. | 當前帳號是通過組織內共用添加到共用單元中的帳號,不能主動退出共用單元。請聯絡共用單元的所有者將當前帳號從共用單元中移除。 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。