All Products
Search
Document Center

Bastionhost:GetHost

Last Updated:Nov 27, 2024

Queries the details of a host, such as the name, source, address, protocol, and service port of the host.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
yundun-bastionhost:GetHostget
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The ID of the bastion host in which you want to query the host.

Note You can call the DescribeInstances operation to query the ID of the bastion host.
bastionhost-cn-st220aw****
RegionIdstringNo

The region ID of the bastion host in which you want to query the host.

Note For more information about the mapping between region IDs and region names, see Regions and zones.
cn-hangzhou
HostIdstringYes

The ID of the host that you want to query. You can specify only one host ID.

Note You can call the ListHosts operation to query the ID of the host.
1

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

EC9BF0F4-8983-491A-BC8C-1B4DD94976DE
Hostobject

The returned information about the host.

Commentstring

The description of the host.

host
ActiveAddressTypestring

The address type of the host. Valid values:

  • Public: a public address
  • Private: a private address
Public
HostPublicAddressstring

The public address of the host. The value is a domain name or an IP address.

1.1.XX.XX
HostNamestring

The hostname.

host
Sourcestring

The source of the host. Valid values:

  • Local: a host in a data center
  • Ecs: an Elastic Compute Service (ECS) instance
  • Rds: a host in an ApsaraDB MyBase dedicated cluster
Local
HostPrivateAddressstring

The internal endpoint of the host. The value is a domain name or an IP address.

192.168.XX.XX
OSTypestring

The operating system of the host. Valid values:

  • Linux
  • Windows
Linux
HostIdstring

The ID of the host.

1
SourceInstanceStatestring

The status of the host. Valid values:

  • Normal: normal
  • Release: released
Normal
SourceInstanceIdstring

The ID of the ECS instance or the host in an ApsaraDB MyBase dedicated cluster.

Note If Local is returned for the Source parameter, no value is returned for this parameter.
i-bp19ienyt0yax748****
Protocolsarray<object>

The protocol information about the host.

Itemobject
HostFingerPrintstring

The fingerprint of the host. This parameter uniquely identifies a host. A value is returned for this parameter only if you have performed O&M operations on the host by using the bastion host. Otherwise, no value is returned.

ssh-ed25519|3e:46:5a:e1:1f:0d:39:7e:61:35:d5:fa:7b:2b:**:**
Portinteger

The service port of the host.

22
ProtocolNamestring

The protocol that is used to connect to the host. Valid values:

  • SSH
  • RDP
SSH
NetworkDomainIdstring

The ID of the network domain to which the host belongs.

1

Examples

Sample success responses

JSONformat

{
  "RequestId": "EC9BF0F4-8983-491A-BC8C-1B4DD94976DE",
  "Host": {
    "Comment": "host",
    "ActiveAddressType": "Public",
    "HostPublicAddress": "1.1.XX.XX",
    "HostName": "host",
    "Source": "Local",
    "HostPrivateAddress": "192.168.XX.XX",
    "OSType": "Linux",
    "HostId": "1",
    "SourceInstanceState": "Normal",
    "SourceInstanceId": "i-bp19ienyt0yax748****",
    "Protocols": [
      {
        "HostFingerPrint": "ssh-ed25519|3e:46:5a:e1:1f:0d:39:7e:61:35:d5:fa:7b:2b:**:**",
        "Port": 22,
        "ProtocolName": "SSH"
      }
    ],
    "NetworkDomainId": "1"
  }
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidParameterThe argument is invalid.The argument is invalid.
400HostNotFoundThe host is not found.The host is not found.
500InternalErrorAn unknown error occurred.An unknown error occurred.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-11-27The Error code has changed. The response structure of the API has changedView Change Details