Queries accounts of a specified host.
Debugging
Request parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| Action | String | Yes | ListHostAccounts |
The operation that you want to perform. Set the value to ListHostAccounts. |
| InstanceId | String | Yes | bastionhost-cn-st220aw**** |
The ID of the bastion host in which you want to query accounts of the specified host. Note You can call the DescribeInstances operation to query the ID of the bastion host.
|
| RegionId | String | No | cn-hangzhou |
The region ID of the bastion host in which you want to query accounts of the specified host. Note For more information about the mapping between region IDs and region names, see Regions and zones.
|
| HostId | String | Yes | 1 |
The ID of the specified host whose accounts you want to query. Note You can call the ListHosts operation to query the ID of the host.
|
| 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. Maximum value: 100. Default value: 20. If you leave this parameter empty, 20 entries are returned on each page. Note We recommend that you do not leave this parameter empty.
|
| HostAccountName | String | No | abc |
The name of the host account that you want to query. The name can be up to 128 characters in length. Only exact match is supported. |
| ProtocolName | String | No | SSH |
The protocol used by the host whose accounts you want to query. Valid values:
|
Response parameters
| Parameter | Type | Example | Description |
|---|---|---|---|
| TotalCount | Integer | 1 |
The total number of host accounts that are queried. |
| RequestId | String | EC9BF0F4-8983-491A-BC8C-1B4DD94976DE |
The ID of the request. |
| HostAccounts | Array of Item |
An array that consists of the queried host accounts. |
|
| HasPassword | Boolean | true |
Indicates whether a password is configured for the host account. Valid values:
|
| PrivateKeyFingerprint | String | fe:ca:37:42:30:00:9d:95:e6:73:e5:b0:32:0a:**:** |
The fingerprint of the private key for the host account. |
| ProtocolName | String | SSH |
The protocol that is used by the host. Valid values:
|
| HostAccountName | String | abc |
The name of the host account. |
| HostAccountId | String | 1 |
The ID of the host account. |
| HostId | String | 1 |
The ID of the host. |
| HostShareKeyId | String | 1 |
The ID of the shared key. |
| HostShareKeyName | String | name |
The name of the shared key. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=ListHostAccounts
&InstanceId=bastionhost-cn-st220aw****
&RegionId=cn-hangzhou
&HostId=1
&PageNumber=1
&PageSize=20
&HostAccountName=abc
&ProtocolName=SSH
&<Common request parameters>
Sample success responses
XML format
HTTP/1.1 200 OK
Content-Type:application/xml
<ListHostAccountsResponse>
<TotalCount>1</TotalCount>
<RequestId>EC9BF0F4-8983-491A-BC8C-1B4DD94976DE</RequestId>
<HostAccounts>
<HasPassword>true</HasPassword>
<PrivateKeyFingerprint>fe:ca:37:42:30:00:9d:95:e6:73:e5:b0:32:0a:**:**</PrivateKeyFingerprint>
<ProtocolName>SSH</ProtocolName>
<HostAccountName>abc</HostAccountName>
<HostAccountId>1</HostAccountId>
<HostId>1</HostId>
<HostShareKeyId>1</HostShareKeyId>
<HostShareKeyName>name</HostShareKeyName>
</HostAccounts>
</ListHostAccountsResponse>
JSON format
HTTP/1.1 200 OK
Content-Type:application/json
{
"TotalCount" : 1,
"RequestId" : "EC9BF0F4-8983-491A-BC8C-1B4DD94976DE",
"HostAccounts" : [ {
"HasPassword" : true,
"PrivateKeyFingerprint" : "fe:ca:37:42:30:00:9d:95:e6:73:e5:b0:32:0a:**:**",
"ProtocolName" : "SSH",
"HostAccountName" : "abc",
"HostAccountId" : "1",
"HostId" : "1",
"HostShareKeyId" : "1",
"HostShareKeyName" : "name"
} ]
}
Error codes
| HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 400 | InvalidParameter | The argument is invalid. | The error message returned because one or more parameters are invalid. |
| 500 | InternalError | An unknown error occurred. | The error message returned because an unknown error has occurred. |
For a list of error codes, visit the API Error Center.