All Products
Search
Document Center

Resource Management:ListSharedResources

Last Updated:Jun 10, 2026

Mengkueri sumber daya yang Anda bagikan dengan akun lain atau sumber daya yang akun lain bagikan dengan Anda.

Deskripsi operasi

This example shows how to query the resources that you shared in the cn-hangzhou region. The response indicates that you shared only one resource, which is a VSwitch with the ID vsw-bp1upw03qyz8n7us9**** in the resource share rs-6GRmdD3X****.

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:ListSharedResources

list

*All Resource

*

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

ResourceOwner

string

Yes

Pemilik bagian sumber daya. Nilai valid:

  • Self: Mengkueri resource yang Anda bagikan dengan akun lain dari bagian sumber daya Anda.

  • OtherAccounts: Mengkueri resource yang dibagikan kepada Anda oleh akun lain.

Self

ResourceType

string

No

Tipe Resource yang dibagikan.

Untuk informasi selengkapnya tentang tipe Resource yang dapat dibagikan, lihat Services that work with Resource Sharing.

VSwitch

Target

string

No

ID pihak yang berwenang atau pemilik sumber daya.

  • Jika Anda menetapkan ResourceOwner ke Self, parameter ini adalah ID pihak yang berwenang.

  • Jika Anda menetapkan ResourceOwner ke OtherAccounts, parameter ini adalah ID pemilik sumber daya.

172050525300****

MaxResults

integer

No

Jumlah maksimum entri yang dikembalikan untuk satu permintaan.

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

20

NextToken

string

No

Token paginasi yang digunakan di permintaan berikutnya untuk mengambil halaman hasil baru. Jika tanggapan terpotong, Anda dapat menggunakan token ini untuk memulai permintaan lain dan mengambil entri yang tersisa.

TGlzdFJlc291cm****

ResourceShareIds

array

No

ID bagian sumber daya.

Nilai N berkisar dari 1 hingga 5. Anda dapat menentukan hingga 5 ID bagian sumber daya.

rs-6GRmdD3X****

string

No

The ID of the resource share.

rs-6GRmdD3X****

ResourceIds

array

No

ID Resource yang dibagikan.

Nilai N berkisar dari 1 hingga 5. Anda dapat menentukan hingga 5 ID Resource yang dibagikan.

vsw-bp1upw03qyz8n7us9****

string

No

The ID of the shared resource.

vsw-bp1upw03qyz8n7us9****

ResourceArns

array

No

Daftar Nama Sumber Daya Alibaba Cloud (ARN) dari resource yang dibagikan.

Nilai N berkisar dari 1 hingga 5. Anda dapat menentukan hingga 5 resource yang dibagikan.

string

No

The ARN of the shared resource.

Catatan

For more information about the format of a resource ARN, see Services that work with Resource Sharing.

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

Elemen respons

Element

Type

Description

Example

object

The response parameters.

NextToken

string

The pagination token that is used in the next request to retrieve a new page of results. If the response is truncated, you can use this token to initiate another request and retrieve the remaining entries.

TGlzdFJlc291cm****

RequestId

string

The request ID.

04677DCA-7C33-464B-8811-1B1DA3C3D197

SharedResources

array<object>

The information about the shared resources.

object

The information about the shared resource.

UpdateTime

string

The time when the shared resource was updated.

2020-12-07T07:39:02.921Z

ResourceType

string

The type of the shared resource.

For more information about the resource types that can be shared, see Services that work with Resource Sharing.

VSwitch

CreateTime

string

The time when the resource was associated with the resource share.

2020-12-07T07:39:02.921Z

ResourceShareId

string

The ID of the resource share.

rs-6GRmdD3X****

ResourceArn

string

The ARN of the shared resource.

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

ResourceStatus

string

The status of the shared resource. This parameter is returned only when you query resources that were shared with you. This parameter is not returned when you query resources that you shared.

Valid values:

  • Available: The resource is available.

  • ZonalResourceInaccessible: The resource is unavailable in the current zone.

  • LimitExceeded: The resource is unavailable because the quota is exceeded.

  • Unavailable: The resource is unavailable.

Available

ResourceStatusMessage

string

The reason why the association failed.

The reason for the association failure.

ResourceId

string

The ID of the shared resource.

vsw-bp1upw03qyz8n7us9****

Contoh

Respons sukses

JSONformat

{
  "NextToken": "TGlzdFJlc291cm****",
  "RequestId": "04677DCA-7C33-464B-8811-1B1DA3C3D197",
  "SharedResources": [
    {
      "UpdateTime": "2020-12-07T07:39:02.921Z",
      "ResourceType": "VSwitch",
      "CreateTime": "2020-12-07T07:39:02.921Z",
      "ResourceShareId": "rs-6GRmdD3X****",
      "ResourceArn": "acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di****",
      "ResourceStatus": "Available",
      "ResourceStatusMessage": "The reason for the association failure. ",
      "ResourceId": "vsw-bp1upw03qyz8n7us9****"
    }
  ]
}

Kode kesalahan

HTTP status code

Error code

Error message

Description

400 MissingParameter.ResourceOwner You must specify ResourceOwner. You must specify ResourceOwner.
400 InvalidParameter.ResourceOwner The ResourceOwner is invalid. The ResourceOwner parameter is invalid.
400 InvalidParameter.ResourceType The ResourceType is invalid. The specified ResourceType parameter is invalid.
400 InvalidParameter.MaxResults The MaxResults is invalid. The MaxResults parameter is invalid.
400 InvalidParameter.NextToken The NextToken is invalid. The NextToken parameter is invalid.
400 InvalidParameter.NextToken.Length The maximum length of NextToken exceeds 256 characters. The length of NextToken cannot exceed 256 characters.
400 InvalidParameter.ResourceShareIds The ResourceShareIds is invalid. The ResourceShareIds parameter is invalid.
400 InvalidParameter.ResourceShareIds.Duplicate The ResourceShareIds contains duplicate values. The ResourceShareIds parameter contains duplicate values.
400 InvalidParameter.ResourceShareIds.Length The maximum length of ResourceShareIds exceeds 5 characters. The number of ResourceShareIds values cannot exceed 5.
400 InvalidParameter.ResourceIds The ResourceIds is invalid. The specified ResourceIds parameter is invalid.
400 InvalidParameter.ResourceIds.Duplicate The specified ResourceId contains duplicate values. The specified ResourceIds parameter contains duplicate values.
400 InvalidParameter.ResourceIds.Length The maximum number of ResourceIds (5) is exceeded. The number of specified ResourceIds values cannot exceed 5.
400 InvalidParameter.Target The Target is invalid. The Target parameter is invalid.
400 InvalidParameter The specified parameter is invalid. The specified parameter is invalid.
400 InvalidParameter.ResourceArns The ResourceArns is invalid. The ResourceArns parameter is invalid.
400 InvalidParameter.ResourceArns.Duplicate The ResourceArns contains duplicate values. The ResourceArns contains duplicate values.
400 InvalidParameter.ResourceArns.Length The ResourceArns beyond the length limit. The maximum number of ResourceArns exceeds 5.
400 NotSupport.ResourceType.ResourcesParameter The Resources parameter does not support this resource type. Please use ResourceArns instead. The Resources parameter does not support this resource type. Please use ResourceArns instead.
400 InvalidParameter.ResourceConflict Both ResourceId and ResourceArn cannot be specified simultaneously. Please provide only one of these parameters. 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.