查询共享单元中关联资源或资源使用者的记录。
接口说明
本文将提供一个示例,在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> | 共享资源或资源使用者信息。 | |
| 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 | 
| TargetProperty | string | 资源使用者属性。例如:资源共享的时间段。 
 说明 
 仅当资源使用者为阿里云服务时返回该参数。 | { "timeRange":{ "timeRangeType":"timeRange", "beginAtTime":"00:00", "timezone":"UTC+8", "endAtTime":"19:59" } } | 
| 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**** | 
示例
正常返回示例
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,
      "TargetProperty": "{\n    \"timeRange\":{\n        \"timeRangeType\":\"timeRange\",\n        \"beginAtTime\":\"00:00\",\n        \"timezone\":\"UTC+8\",\n        \"endAtTime\":\"19:59\"\n    }\n}",
      "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****"
        }
      ]
    }
  ]
}错误码
| 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 不能同时指定。请仅提供其中一个参数。 | 
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。