首页 资源管理 API参考 API参考(资源共享) API目录 共享单元 AssociateResourceShare - 关联共享资源或资源使用者

AssociateResourceShare - 关联共享资源或资源使用者

为共享单元关联共享资源或资源使用者。

接口说明

使用说明

本文将提供一个示例,在cn-hangzhou地域的共享单元rs-6GRmdD3X****中,添加共享资源VPC交换机vsw-bp183p93qs667muql****,将其共享给资源目录内的成员172050525300****

QPS限制

本API的单用户QPS限制为10次/秒,全局QPS限制为500次/秒。超过限制,API调用会被限流,这可能会影响您的业务,请合理调用。

调试

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

调试

授权信息

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

  • 操作:是指具体的权限点。
  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:
    • 对于必选的资源类型,用背景高亮的方式表示。
    • 对于不支持资源级授权的操作,用全部资源表示。
  • 条件关键字:是指云产品自身定义的条件关键字。
  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作访问级别资源类型条件关键字关联操作
resourcesharing:AssociateResourceShareWrite
  • ResourceManager
    acs:resourcesharing:*:{#accountId}:*
  • resourcesharing:Target

请求参数

名称类型必填描述示例值
ResourceShareIdstring

共享单元ID。

rs-6GRmdD3X****
Resourcesarray

资源列表。

object

资源列表。

ResourceTypestring

共享资源类型。

N的取值范围:1~5,即每次最多添加5个共享资源。

支持共享的资源类型,请参见支持资源共享的云服务

说明Resources.N.ResourceIdResources.N.ResourceType成对出现,需要同时设置。
VSwitch
ResourceIdstring

共享资源ID。

N的取值范围:1~5,即每次最多添加5个共享资源。

说明Resources.N.ResourceId与Resources.N.ResourceType成对出现,需要同时设置。
vsw-bp183p93qs667muql****
Targetsarray

资源使用者。

string

资源使用者。取值:

  • AllowExternalTargetsfalse时,即仅允许资源目录内共享时,资源使用者可以为资源目录ID、资源夹ID或成员ID。
  • AllowExternalTargetstrue时,即允许共享给任意账号时,资源使用者可以为阿里云账号ID、资源目录ID、资源夹ID或成员ID。

更多信息,请参见资源共享方式查看资源目录ID查看资源夹ID查看成员ID

N的取值范围:1~5,即每次最多添加5个资源使用者。

172050525300****
PermissionNamesarray

共享权限名称。为空时,系统自动绑定资源类型关联的默认权限。具体信息,请参见权限库

string

共享权限名称。为空时,系统自动绑定资源类型关联的默认权限。具体信息,请参见权限库

AliyunRSDefaultPermissionVSwitch

关于公共请求参数的详情,请参见公共参数

返回参数

名称类型描述示例值
object

返回结果。

RequestIdstring

请求ID。

111FB84A-60A9-403E-9067-E55D7EE95BD1
ResourceShareAssociationsarray

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

object

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

UpdateTimestring

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

  • 当关联类型AssociationType为资源Resource时,该参数为更新资源的时间。
  • 当关联类型AssociationType为资源使用者Target时,该参数为更新资源使用者的时间。
2020-12-04T09:40:41.246Z
EntityIdstring

关联实体ID。取值:

  • 当关联类型AssociationType为资源Resource时,该参数为资源ID。
  • 当关联类型AssociationType为资源使用者Target 时,该参数为资源使用者ID。
vsw-bp183p93qs667muql****
ResourceShareNamestring

共享单元名称。

test
CreateTimestring

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

  • 当关联类型AssociationType为资源Resource时,该参数为添加资源的时间。
  • 当关联类型AssociationType为资源使用者Target时,该参数为添加资源使用者的时间。
2020-12-04T09:40:41.246Z
EntityTypestring

关联实体类型。取值:

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

共享单元ID。

rs-6GRmdD3X****
AssociationStatusMessagestring

关联失败的原因。

The reason for the association failure.
AssociationTypestring

关联类型。取值:

  • Resource:资源。
  • Target:资源使用者。
Resource
AssociationStatusstring

关联状态。取值:

  • Associating:关联中。
  • Associated:已关联。
  • Failed:关联失败。
  • Disassociating:分离中。
  • Disassociated:已分离。
说明FailedDisassociated状态的记录,会在48~96小时内被系统自动删除。
Associating

示例

正常返回示例

JSON格式

{
  "RequestId": "111FB84A-60A9-403E-9067-E55D7EE95BD1",
  "ResourceShareAssociations": [
    {
      "UpdateTime": "2020-12-04T09:40:41.246Z",
      "EntityId": "vsw-bp183p93qs667muql****",
      "ResourceShareName": "test",
      "CreateTime": "2020-12-04T09:40:41.246Z",
      "EntityType": "VSwitch",
      "ResourceShareId": "rs-6GRmdD3X****",
      "AssociationStatusMessage": "The reason for the association failure.",
      "AssociationType": "Resource",
      "AssociationStatus": "Associating"
    }
  ]
}

错误码

HTTP status code错误码错误信息描述
400MissingParameter.ResourceShareIdYou must specify ResourceShareId.ResourceShareId参数缺失。
400InvalidParameter.ResourceShareIdThe ResourceShareId is invalid.ResourceShareId参数错误。
400InvalidParameter.ResourcesThe Resources is invalid.选定的共享资源无效。
400InvalidParameter.Resources.DuplicateThe Resources contains duplicate values.选定的共享资源有重复项。
400InvalidParameter.Resources.LengthThe maximum number of Resources exceeds 5.选定的共享资源数量超限(最大5个)。
400InvalidParameter.TargetsThe Targets is invalid.资源使用者的参数不符合规则。
400InvalidParameter.Targets.DuplicateThe Targets contains duplicate values.资源使用者有重复项。
400InvalidParameter.Targets.LengthThe maximum number of Targets exceeds 5.资源使用者数量超限(最大5个)。
400InvalidTargetThe shared target does not exist in the resource directory.资源使用者不在资源目录内。
400ResourceAndTargetBothEmptyEither a resource or a shared target must be specified.必须指定一个资源或一个资源使用者。
400InvalidParameterThe specified parameter is invalid.参数无效。
400InvalidParameter.ResourceTypeThe ResourceType is invalid.传入的资源类型错误。
400InvalidParameter.PermissionNames.DuplicateThe PermissionNames duplicate values.参数PermissionNames重复。
400InvalidParameter.PermissionNames.LengthThe maximum length of PermissionNames exceeds quota limit.PermissionNames长度超限。
404EntityNotExists.ResourceShareThe resource share does not exist in the current account.共享单元不在当前账号内。
404EntityNotExists.PermissionThe resource share permission does not exist.共享权限不存在。
409NotEnableSharingWithResourceDirectoryYou have not enabled sharing with your Resource Directory.未开启与资源目录组织的共享。
409AccountNotInResourceDirectoryThe account is not a master or a member of a resource directory.资源使用者不在资源目录内。
409ResourceShareStatusMismatchActionThe status of the resource share does not allow the specified operation.共享单元的状态不支持当前操作。
409QuotaExceeded.SharedResource.CountThe maximum number of shared resources per account exceeds the limit.共享的资源超出单个账号最大限制。
409ShareWithYourselfYou cannot share resources with yourself.资源使用者不能是自己。
409AssociateConflictYou cannot perform the operation while disassociation operation is being performed.取消关联中,不能操作关联。
409NotManagementAccountOnly the management account of the service is allowed to share such resources.当前资源类型仅支持资源目录的管理账号共享资源。如仍需使用当前账号,请联系管理账号将当前账号设置为当前资源类型所属可信服务的委派管理员账号。
409QuotaExceeded.PendingInvitationsThe maximum number of pending invitations exceeds the limit.邀请数量超出限制。
409InvalidTarget.LegalEntityMismatchThe target account does not have the same legal entity as the resource owner account.共享目标账号的企业名称与共享者不一致。
409ExternalTargetsNotAllowed.ResourceTypeThe resource share includes resource types that cannot be shared with accounts outside the resource directory.共享单元中包含不支持组织外共享的资源类型。
409InvalidTarget.SiteMismatchCross-site resource sharing is not supported.共享目标账号与共享者站点不一致。

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

变更历史

变更时间变更内容概要操作
2023-04-07OpenAPI 错误码发生变更
变更项变更内容
错误码OpenAPI 错误码发生变更
    错误码 409 变更
    删除错误码:400
    删除错误码:404
2023-04-07OpenAPI 错误码发生变更
变更项变更内容
错误码OpenAPI 错误码发生变更
    错误码 409 变更
    删除错误码:400
    删除错误码:404
阿里云首页 资源管理 相关技术圈