Queries the host accounts that a specified user is authorized to manage on a specified host.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListHostAccountsForUser

The operation that you want to perform.

Set the value to ListHostAccountsForUser.

HostId String Yes 1

The ID of the host for which you want to query the host accounts that the user is authorized to manage.

Note You can call the ListHosts operation to query the ID of the host.
InstanceId String Yes bastionhost-cn-st220aw****

The ID of the Bastionhost instance where you want to query the host accounts that the user is authorized to manage on the host.

Note You can call the DescribeInstances operation to query the ID of the Bastionhost instance.
UserId String Yes 1

The ID of the user for which you want to query authorized host accounts.

Note You can call the ListUsers operation to query the ID of the user ID.
RegionId String No cn-hangzhou

The region ID of the Bastionhost instance where you want to query the host accounts that the user is authorized to manage on the host.

Note For more information about the mapping between region IDs and region names, see Regions and zones.
PageNumber String No 1

The number of the page to return. Default value: 1.

PageSize String No 20

The number of entries to return on each page.

The value of the PageSize parameter must not exceed 100. Default value: 20. If you leave the PageSize parameter empty, 20 entries are returned on each page.

Note We recommend that you do not leave the PageSize parameter empty.
HostAccountName String No root

The name of the host account that you want to query. Exact match is supported.

All Bastionhost API requests must include common request parameters. For more information about common request parameters, see Common parameters.

For more information about sample requests, see the "Examples" section of this topic.

Response parameters

Parameter Type Example Description
HostAccounts Array of Item

The host accounts returned.

HostAccountId String 1

The ID of the host account.

HostAccountName String root

The name of the host account.

HostId String 1

The ID of the host for which the host accounts were queried.

IsAuthorized Boolean true

Indicates whether the user is authorized to manage the host account. Valid values:

  • true: The user is authorized to manage the host account.
  • false: The user is not authorized to manage the host account.
ProtocolName String SSH

The protocol that is used by the host account. Valid values:

  • SSH
  • RDP
RequestId String EC9BF0F4-8983-491A-BC8C-1B4DD94976DE

The ID of the request.

TotalCount Integer 1

The total number of host accounts returned.

Examples

Sample requests

http(s)://[Endpoint]/?Action=ListHostAccountsForUser
&HostId=1
&InstanceId=bastionhost-cn-st220aw****
&UserId=1
&<Common request parameters>

Sample success responses

XML format

<ListHostAccountsForUserResponse>
      <TotalCount>1</TotalCount>
      <RequestId>EC9BF0F4-8983-491A-BC8C-1B4DD94976DE </RequestId>
      <HostAccounts>
            <HostAccountName>root</HostAccountName>
            <ProtocolName>SSH</ProtocolName>
            <HostId>1</HostId>
            <IsAuthorized>true</IsAuthorized>
            <HostAccountId>1</HostAccountId>
      </HostAccounts>
</ListHostAccountsForUserResponse>

JSON format

{
	"TotalCount": "1",
	"RequestId": "EC9BF0F4-8983-491A-BC8C-1B4DD94976DE ",
	"HostAccounts": [{
		"HostAccountName": "root",
		"ProtocolName": "SSH",
		"IsAuthorized": "true",
		"HostId": "1",
		"HostAccountId": "1"
	}]
}

Error codes

For a list of error codes, visit the API Error Center.