DisassociateResourceShare - 移除共享资源或资源使用者

为共享单元移除共享资源或资源使用者。

接口说明

  • 资源所有者可以调用本 API,移除共享资源或资源使用者。

  • 在资源目录外共享资源时,对于已加入共享的资源使用者,可以调用本 API 主动退出共享单元。更多信息,请参见资源使用者退出共享单元

本文将提供一个示例,使用资源目录管理账号,在cn-hangzhou地域的共享单元rs-6GRmdD3X****中,移除资源使用者172050525300****,即停止对该资源使用者的共享。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

resourcesharing:DisassociateResourceShare

update

*全部资源

*

  • resourcesharing:RequestedResourceType
  • resourcesharing:ResourceArn

请求参数

名称

类型

必填

描述

示例值

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

string

ResourceOwner

string

共享单元归属者。取值:

  • Self(默认值):共享单元归属于当前账号。适用于资源目录内共享时,资源所有者移除共享资源或资源使用者场景。

  • OtherAccounts:共享单元归属于其他账号。适用于资源目录外共享时,资源使用者主动退出共享单元场景。

Self

返回参数

名称

类型

描述

示例值

object

返回参数。

RequestId

string

请求 ID。

95230BC9-A8E8-4493-96BD-4F0C758E37F8

ResourceShareAssociations

array<object>

共享单元关联的共享资源或资源使用者信息。

object

共享单元关联的共享资源或资源使用者信息。

UpdateTime

string

取消关联的更新时间。存在以下两种情况:

  • 当关联类型AssociationType为资源Resource时,该参数为移除资源的更新时间。

  • 当关联类型AssociationType为资源使用者Target时,该参数为移除资源使用者的更新时间。

2020-12-04T09:40:45.556Z

ResourceArn

string

ResourceShareName

string

共享单元名称。

test

CreateTime

string

取消关联的时间。存在以下两种情况:

  • 当关联类型AssociationType为资源Resource时,该参数为移除资源的时间。

  • 当关联类型AssociationType为资源使用者Target时,该参数为移除资源使用者的时间。

2020-12-04T09:40:41.250Z

EntityType

string

关联实体类型。取值:

  • 当关联实体为资源时,该参数为资源类型。更多信息,请参见支持资源共享的云服务

  • 当关联实体为资源使用者时,该参数为 Account。

Account

ResourceShareId

string

共享单元 ID。

rs-6GRmdD3X****

AssociationStatusMessage

string

取消关联失败的原因。

The Resources is invalid.

AssociationType

string

关联类型。取值:

  • Resource:资源。

  • Target:资源使用者。

Target

AssociationStatus

string

关联状态。取值:

  • Associating:关联中。

  • Associated:已关联。

  • Failed:关联失败。

  • Disassociating:分离中。

  • Disassociated:已分离。

说明

FailedDisassociated状态的记录,会在 48~96 小时内被系统自动删除。

Disassociating

TargetProperty

string

资源使用者属性。例如:资源共享的时间段。

说明

仅当资源使用者为阿里云服务时返回该参数。

{ "timeRange":{ "timeRangeType":"timeRange", "beginAtTime":"00:00", "timezone":"UTC+8", "endAtTime":"19:59" } }

EntityId

string

关联实体 ID。取值:

  • 当关联类型AssociationType为资源Resource时,该参数为资源 ID。

  • 当关联类型AssociationType为资源使用者Target时,该参数为资源目录 ID、资源夹 ID 或成员 ID。

172050525300****

示例

正常返回示例

JSON格式

{
  "RequestId": "95230BC9-A8E8-4493-96BD-4F0C758E37F8",
  "ResourceShareAssociations": [
    {
      "UpdateTime": "2020-12-04T09:40:45.556Z",
      "ResourceArn": "",
      "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****"
    }
  ]
}

错误码

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. 当前账号是通过组织内共享添加到共享单元中的账号,不能主动退出共享单元。请联系共享单元的所有者将当前账号从共享单元中移除。

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情