All Products
Search
Document Center

Bastionhost:AttachHostAccountsToUser

Last Updated:Jun 10, 2026

Setelah Anda menambahkan pengguna ke bastion host, Anda harus mengotorisasi pengguna untuk mengelola aset. Hanya pengguna yang telah diotorisasi yang dapat masuk ke bastion host untuk melakukan operasi O&M pada aset.

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

yundun-bastionhost:AttachHostAccountsToUser

update

*全部资源

*

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

ID bastion host tempat Anda ingin mengotorisasi pengguna untuk mengelola host dan akun host.

Catatan

Anda dapat memanggil operasi DescribeInstances untuk mengkueri ID bastion host.

bastionhost-cn-st220aw****

RegionId

string

No

ID wilayah bastion host tempat Anda ingin mengotorisasi pengguna untuk mengelola host dan akun host.

Catatan

Untuk informasi lebih lanjut mengenai pemetaan antara ID wilayah dan nama wilayah, lihat Wilayah dan zona.

cn-hangzhou

UserId

string

Yes

ID pengguna yang ingin Anda otorisasi untuk mengelola host dan akun host.

Catatan

Anda dapat memanggil operasi ListUsers untuk mengkueri ID pengguna.

1

Hosts

string

Yes

ID host dan akun host yang ingin Anda otorisasi pengguna untuk mengelola. Anda dapat menentukan hingga 10 ID host dan hingga 10 ID akun host untuk setiap host. Anda dapat menentukan hanya ID host. Dalam hal ini, pengguna diotorisasi untuk mengelola hanya host yang ditentukan. Untuk informasi lebih lanjut mengenai parameter ini, lihat bagian "Deskripsi parameter Hosts" pada topik ini.

Catatan

Anda dapat memanggil operasi ListHosts untuk mengkueri ID host dan operasi ListHostAccounts untuk mengkueri ID akun host.

[ {"HostId":"1"}, {"HostId":"2","HostAccountIds":["1","2","3"]}, {"HostId":"3","HostAccountIds":["4","5","6"]}, {"HostId":"4","HostAccountIds":["9","8","7"]} ]

Deskripsi Hosts.

BidangTipeContohDeskripsi
HostIdstring1ID host.
HostAccountIdsarray[string]["9","8","7"]ID akun host. Nilai berupa string JSON. Anda dapat menentukan hingga 10 ID akun host untuk setiap host.

Kode berikut memberikan contoh pengaturan parameter Hosts:

[
{"HostId":"1"},
{"HostId":"2","HostAccountIds":["1","2","3",...]},
{"HostId":"3","HostAccountIds":["4","5","6",...]},
{"HostId":"4","HostAccountIds":["9","8","7",...]}
]```
````.

Elemen respons

Element

Type

Description

Example

object

RequestId

string

The request ID.

EC9BF0F4-8983-491A-BC8C-1B4DD94976DE

Results

array<object>

The result of the call.

array<object>

Code

string

The return code that indicates whether the call was successful. Valid values:

  • OK: The call was successful.

  • UNEXPECTED: An unknown error occurred.

  • INVALID_ARGUMENT: A request parameter is invalid.

Catatan

Make sure that the request parameters are valid and call the operation again.

  • OBJECT_NOT_FOUND: The specified object on which you want to perform the operation does not exist.

Catatan

Check whether the specified ID of the bastion host exists, whether the specified hosts exist, and whether the specified host IDs are valid. Then, call the operation again.

  • OBJECT_AlREADY_EXISTS: The specified object on which you want to perform the operation already exists.

OK

Message

string

This parameter is deprecated.

None

HostId

string

The ID of the host.

1

UserId

string

The ID of the user.

1

HostAccounts

array<object>

The result of authorizing the user to manage the host accounts.

object

Code

string

The return code that indicates whether the user was authorized to manage the host accounts. Valid values:

  • OK: The call was successful.

  • UNEXPECTED: An unknown error occurred.

  • INVALID_ARGUMENT: A request parameter is invalid.

  • OBJECT_NOT_FOUND: The specified object on which you want to perform the operation does not exist.

  • OBJECT_AlREADY_EXISTS: The specified object on which you want to perform the operation already exists.

OK

Message

string

This parameter is deprecated.

None

HostAccountId

string

The ID of the host account.

1

Contoh

Respons sukses

JSONformat

{
  "RequestId": "EC9BF0F4-8983-491A-BC8C-1B4DD94976DE",
  "Results": [
    {
      "Code": "OK",
      "Message": "None",
      "HostId": "1",
      "UserId": "1",
      "HostAccounts": [
        {
          "Code": "OK",
          "Message": "None",
          "HostAccountId": "1"
        }
      ]
    }
  ]
}

Kode kesalahan

HTTP status code

Error code

Error message

Description

400 InvalidParameter The argument is invalid.
500 InternalError An unknown error occurred.

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.