All Products
Search
Document Center

Resource Management:ListResourceShareAssociations

Last Updated:Jun 10, 2026

Menampilkan daftar resource atau pihak yang berwenang yang terkait dengan bagian sumber daya.

Deskripsi operasi

This example shows how to query for association records of Shared Resources within Resource Shares created by the current account in the China (Hangzhou) Region. The response shows records for the following two Shared Resources:

  • A VSwitch Shared Resource, vsw-bp1upw03qyz8n7us9****, was associated with the Resource Share rs-6GRmdD3X****. The resource is in the Associated state, meaning it is actively shared.

  • A VSwitch Shared Resource, vsw-bp183p93qs667muql****, was disassociated from the Resource Share rs-6GRmdD3X****. The resource is in the Disassociated state, meaning it is no longer shared.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tabel berikut menjelaskan otorisasi yang diperlukan untuk memanggil API ini. Anda dapat menentukannya dalam kebijakan Resource Access Management (RAM). Kolom pada tabel dijelaskan sebagai berikut:

  • Action: Aksi yang dapat digunakan dalam elemen Action pada pernyataan kebijakan izin RAM untuk memberikan izin guna melakukan operasi tersebut.

  • API: API yang dapat Anda panggil untuk melakukan aksi tersebut.

  • Access level: Tingkat akses yang telah ditentukan untuk setiap API. Nilai yang valid: create, list, get, update, dan delete.

  • Resource type: Jenis resource yang mendukung otorisasi untuk melakukan aksi tersebut. Ini menunjukkan apakah aksi tersebut mendukung izin tingkat resource. Resource yang ditentukan harus kompatibel dengan aksi tersebut. Jika tidak, kebijakan tersebut tidak akan berlaku.

    • Untuk API dengan izin tingkat resource, jenis resource yang diperlukan ditandai dengan tanda bintang (*). Tentukan Nama Sumber Daya Alibaba Cloud (ARN) yang sesuai dalam elemen Resource pada kebijakan.

    • Untuk API tanpa izin tingkat resource, ditampilkan sebagai All Resources. Gunakan tanda bintang (*) dalam elemen Resource pada kebijakan.

  • Condition key: Kunci kondisi yang didefinisikan oleh layanan. Kunci ini memungkinkan kontrol granular, berlaku baik hanya untuk aksi maupun untuk aksi yang terkait dengan resource tertentu. Selain kunci kondisi spesifik layanan, Alibaba Cloud menyediakan serangkaian common condition keys yang berlaku di semua layanan yang didukung RAM.

  • Dependent action: Aksi dependen yang diperlukan untuk menjalankan aksi tersebut. Untuk menyelesaikan aksi tersebut, pengguna RAM atau role RAM harus memiliki izin untuk melakukan semua aksi dependen.

Action

Access level

Resource type

Condition key

Dependent action

resourcesharing:ListResourceShareAssociations

list

*全部资源

*

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

ResourceId

string

No

ID Sumber daya.

Catatan

Parameter ini tidak tersedia ketika AssociationType diatur ke Target.

vsw-bp183p93qs667muql****

ResourceArn

string

No

Nama Sumber Daya Alibaba Cloud (ARN) resource.

Catatan

Parameter ini tidak tersedia ketika AssociationType diatur ke Target.

acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di****

Target

string

No

ID pihak yang berwenang.

Catatan

Parameter ini tidak tersedia ketika AssociationType diatur ke Resource.

172050525300****

AssociationType

string

Yes

Tipe asosiasi. Nilai valid:

  • Resource: Mengembalikan asosiasi dengan Resource yang dibagikan.

  • Target: Mengembalikan asosiasi dengan pihak yang berwenang.

Resource

AssociationStatus

string

No

Status asosiasi. Nilai valid:

  • Associating: Asosiasi sedang berlangsung.

  • Associated: Asosiasi telah dibuat.

  • Failed: Asosiasi gagal.

  • Disassociating: Pembatalan asosiasi sedang berlangsung.

  • Disassociated: Asosiasi telah dihapus.

Catatan

Sistem secara otomatis menghapus record dalam status Failed atau Disassociated dalam waktu 48 hingga 96 jam.

Associated

MaxResults

integer

No

Jumlah maksimum entri yang dikembalikan per halaman.

Nilai valid: 1 hingga 100. Nilai default: 20.

20

NextToken

string

No

Token untuk halaman hasil berikutnya. Jika tanggapan sebelumnya terpotong, sertakan token ini untuk mengambil hasil yang tersisa.

TGlzdFJlc291cm****

ResourceShareIds

array

No

ID bagian sumber daya.

Anda dapat menentukan hingga 5 ID bagian sumber daya.

rs-6GRmdD3X****

string

No

A resource share ID.

rs-6GRmdD3X****

Elemen respons

Element

Type

Description

Example

object

The response parameters.

NextToken

string

The token to retrieve the next page of results. NextToken is returned only if the results are truncated. If this parameter is not returned, all results have been retrieved.

TGlzdFJlc291cm****

RequestId

string

The ID of the request.

11BA57B5-7301-4E2F-BBA5-2AE4C2F4FCDB

ResourceShareAssociations

array<object>

A list of associations.

array<object>

Details of the association.

UpdateTime

string

The time the association was last updated.

  • If AssociationType is Resource, this is the time the resource was updated.

  • If AssociationType is Target, this is the time the principal was updated.

2020-12-07T07:39:02.920Z

EntityId

string

The ID of the associated entity.

  • If AssociationType is Resource, this is the resource ID.

  • If AssociationType is Target, this is the ID of the principal.

vsw-bp1upw03qyz8n7us9****

ResourceArn

string

The Alibaba Cloud Resource Name (ARN) of the associated resource.

Catatan

Returned only if AssociationType is Resource.

acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di****

ResourceShareName

string

The name of the resource share.

example

CreateTime

string

The time the association was created.

  • If AssociationType is Resource, this is the time the resource was associated with the resource share.

  • If AssociationType is Target, this is the time the principal was associated with the resource share.

2020-12-07T07:39:01.818Z

EntityType

string

The type of the associated entity.

  • When the entity is a resource (AssociationType is Resource), this value is the resource type. For more information, see Services that work with Resource Sharing.

  • When the entity is a principal (AssociationType is Target), this value is Account.

VSwitch

ResourceShareId

string

The ID of the resource share.

rs-6GRmdD3X****

AssociationStatusMessage

string

The reason for the failed association.

The reason for the association failure.

AssociationType

string

The type of the association. Valid values:

  • Resource: The entity is a resource.

  • Target: The entity is a principal.

Resource

AssociationStatus

string

The status of the association. Valid values:

  • Associating: The association is in progress.

  • Associated: The association is complete.

  • Failed: The association failed.

  • Disassociating: The disassociation is in progress.

  • Disassociated: The disassociation is complete.

Catatan

The system automatically deletes associations in the Failed or Disassociated state within 48 to 96 hours.

Failed

External

boolean

Indicates whether the principal is an Alibaba Cloud Account that is not a member of your Resource Directory. Valid values:

  • true: The principal is an external Account.

  • false: The principal is a member of your Resource Directory.

false

AssociationFailedDetails

array<object>

Details of a failed association or disassociation.

object

Details of the failed operation.

Status

string

This parameter is deprecated. Use FailureReason instead.

StatusMessage

string

This parameter is deprecated. Use FailureDescription instead.

AssociateType

string

This parameter is deprecated. Use OperationType instead.

ResourceArn

string

The ARN of the associated resource.

Catatan

This parameter is unavailable when AssociationType is Resource.

acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di****

EntityType

string

The type of the associated entity. Valid values:

  • If the entity is a resource, this parameter is the resource type. For more information, see Services that work with Resource Sharing.

  • If the entity is a principal, this parameter can be ResourceDirectory, Folder, Account, or Service.

Account

FailureReason

string

The reason why the association or disassociation failed. Valid values:

  • Unavailable: The resource does not exist or is in an invalid state.

  • LimitExceeded: The number of principals with which the resource can be shared exceeds the upper limit.

  • ZonalResourceInaccessible: The resource is unavailable in the region.

  • InternalError: An internal error occurred.

  • UnsupportedOperation: The operation is not supported.

Unavailable

FailureDescription

string

A detailed description of the failure.

You cannot access the specified resource at this time.

OperationType

string

The operation type. Valid values:

  • Associate: Associates an entity.

  • Disassociate: Dissociates an entity.

Associate

EntityId

string

The ID of the associated entity. Valid values:

  • If AssociationType is Resource, this parameter is the principal ID.

  • If AssociationType is Target, this parameter is the resource ID.

172050525300****

TargetProperty

string

The properties of the principal, such as the time period for resource sharing. Valid values for timeRangeType include:

  • timeRange: a specified time period.

  • day: the whole day.

Catatan

Returned only if the principal is an Alibaba Cloud service.

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

ResourceProperty

string

The sharing-related properties of the resource.

{"sharePrincipals":true,"shareTagOptions":false}

Contoh

Respons sukses

JSONformat

{
  "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}"
    }
  ]
}

Kode kesalahan

HTTP status code

Error code

Error message

Description

400 MissingParameter.AssociationType You must specify AssociationType.
400 InvalidParameter.AssociationType The AssociationType is invalid.
400 InvalidParameter.AssociationStatus The AssociationStatus is invalid.
400 InvalidParameter.MaxResults The MaxResults is invalid.
400 InvalidParameter.NextToken The NextToken is invalid.
400 InvalidParameter.NextToken.Length The maximum length of NextToken exceeds 256 characters.
400 InvalidParameter.ResourceShareIds The ResourceShareIds is invalid.
400 InvalidParameter.ResourceShareIds.Duplicate The ResourceShareIds contains duplicate values.
400 InvalidParameter.ResourceShareIds.Length The maximum length of ResourceShareIds exceeds 5 characters.
400 InvalidParameter.Target The Target is invalid.
400 InvalidParameter.ResourceId The ResourceId is invalid.
400 ConflictedAssociationType The specified ResourceId or Target conflicts with AssociationType.
400 InvalidParameter The specified parameter is invalid.
400 InvalidParameter.ResourceArn The ResourceArn is invalid.
400 InvalidParameter.ResourceConflict Both ResourceId and ResourceArn cannot be specified simultaneously. Please provide only one of these parameters.

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.