Alibaba Cloud

v3.28.0 published on Tuesday, Aug 16, 2022 by Pulumi

getHosts

This data source provides the Bastionhost Hosts of the current Alibaba Cloud user.

NOTE: Available in v1.135.0+.

Example Usage

Basic Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var ids = Output.Create(AliCloud.BastionHost.GetHosts.InvokeAsync(new AliCloud.BastionHost.GetHostsArgs
        {
            InstanceId = "example_value",
            Ids = 
            {
                "1",
                "2",
            },
        }));
        this.BastionhostHostId1 = ids.Apply(ids => ids.Hosts?[0]?.Id);
        var nameRegex = Output.Create(AliCloud.BastionHost.GetHosts.InvokeAsync(new AliCloud.BastionHost.GetHostsArgs
        {
            InstanceId = "example_value",
            NameRegex = "^my-Host",
        }));
        this.BastionhostHostId2 = nameRegex.Apply(nameRegex => nameRegex.Hosts?[0]?.Id);
    }

    [Output("bastionhostHostId1")]
    public Output<string> BastionhostHostId1 { get; set; }
    [Output("bastionhostHostId2")]
    public Output<string> BastionhostHostId2 { get; set; }
}
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/bastionhost"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		ids, err := bastionhost.GetHosts(ctx, &bastionhost.GetHostsArgs{
			InstanceId: "example_value",
			Ids: []string{
				"1",
				"2",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("bastionhostHostId1", ids.Hosts[0].Id)
		nameRegex, err := bastionhost.GetHosts(ctx, &bastionhost.GetHostsArgs{
			InstanceId: "example_value",
			NameRegex:  pulumi.StringRef("^my-Host"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("bastionhostHostId2", nameRegex.Hosts[0].Id)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.bastionhost.BastionhostFunctions;
import com.pulumi.alicloud.bastionhost.inputs.GetHostsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var ids = BastionhostFunctions.getHosts(GetHostsArgs.builder()
            .instanceId("example_value")
            .ids(            
                "1",
                "2")
            .build());

        ctx.export("bastionhostHostId1", ids.applyValue(getHostsResult -> getHostsResult.hosts()[0].id()));
        final var nameRegex = BastionhostFunctions.getHosts(GetHostsArgs.builder()
            .instanceId("example_value")
            .nameRegex("^my-Host")
            .build());

        ctx.export("bastionhostHostId2", nameRegex.applyValue(getHostsResult -> getHostsResult.hosts()[0].id()));
    }
}
import pulumi
import pulumi_alicloud as alicloud

ids = alicloud.bastionhost.get_hosts(instance_id="example_value",
    ids=[
        "1",
        "2",
    ])
pulumi.export("bastionhostHostId1", ids.hosts[0].id)
name_regex = alicloud.bastionhost.get_hosts(instance_id="example_value",
    name_regex="^my-Host")
pulumi.export("bastionhostHostId2", name_regex.hosts[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const ids = alicloud.bastionhost.getHosts({
    instanceId: "example_value",
    ids: [
        "1",
        "2",
    ],
});
export const bastionhostHostId1 = ids.then(ids => ids.hosts?[0]?.id);
const nameRegex = alicloud.bastionhost.getHosts({
    instanceId: "example_value",
    nameRegex: "^my-Host",
});
export const bastionhostHostId2 = nameRegex.then(nameRegex => nameRegex.hosts?[0]?.id);
variables:
  ids:
    Fn::Invoke:
      Function: alicloud:bastionhost:getHosts
      Arguments:
        instanceId: example_value
        ids:
          - 1
          - 2
  nameRegex:
    Fn::Invoke:
      Function: alicloud:bastionhost:getHosts
      Arguments:
        instanceId: example_value
        nameRegex: ^my-Host
outputs:
  bastionhostHostId1: ${ids.hosts[0].id}
  bastionhostHostId2: ${nameRegex.hosts[0].id}

Using getHosts

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getHosts(args: GetHostsArgs, opts?: InvokeOptions): Promise<GetHostsResult>
function getHostsOutput(args: GetHostsOutputArgs, opts?: InvokeOptions): Output<GetHostsResult>
def get_hosts(enable_details: Optional[bool] = None,
              host_address: Optional[str] = None,
              host_name: Optional[str] = None,
              ids: Optional[Sequence[str]] = None,
              instance_id: Optional[str] = None,
              name_regex: Optional[str] = None,
              os_type: Optional[str] = None,
              output_file: Optional[str] = None,
              source: Optional[str] = None,
              source_instance_id: Optional[str] = None,
              source_instance_state: Optional[str] = None,
              opts: Optional[InvokeOptions] = None) -> GetHostsResult
def get_hosts_output(enable_details: Optional[pulumi.Input[bool]] = None,
              host_address: Optional[pulumi.Input[str]] = None,
              host_name: Optional[pulumi.Input[str]] = None,
              ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
              instance_id: Optional[pulumi.Input[str]] = None,
              name_regex: Optional[pulumi.Input[str]] = None,
              os_type: Optional[pulumi.Input[str]] = None,
              output_file: Optional[pulumi.Input[str]] = None,
              source: Optional[pulumi.Input[str]] = None,
              source_instance_id: Optional[pulumi.Input[str]] = None,
              source_instance_state: Optional[pulumi.Input[str]] = None,
              opts: Optional[InvokeOptions] = None) -> Output[GetHostsResult]
func GetHosts(ctx *Context, args *GetHostsArgs, opts ...InvokeOption) (*GetHostsResult, error)
func GetHostsOutput(ctx *Context, args *GetHostsOutputArgs, opts ...InvokeOption) GetHostsResultOutput

> Note: This function is named GetHosts in the Go SDK.

public static class GetHosts 
{
    public static Task<GetHostsResult> InvokeAsync(GetHostsArgs args, InvokeOptions? opts = null)
    public static Output<GetHostsResult> Invoke(GetHostsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetHostsResult> getHosts(GetHostsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: alicloud:bastionhost/getHosts:getHosts
  arguments:
    # arguments dictionary

The following arguments are supported:

InstanceId string

Specify the new create a host where the Bastion host ID of.

EnableDetails bool

Default to false. Set it to true can output more details about resource attributes.

HostAddress string

The host address.

HostName string

Specify the new create a host name of the supports up to 128 characters.

Ids List<string>

A list of Host IDs.

NameRegex string

A regex string to filter results by Host name.

OsType string

Specify the new create the host's operating system. Valid values: Linux Windows.

OutputFile string
Source string

Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.

SourceInstanceId string

Specify the newly created ECS instance ID or dedicated cluster host ID.

SourceInstanceState string

The source instance state.

InstanceId string

Specify the new create a host where the Bastion host ID of.

EnableDetails bool

Default to false. Set it to true can output more details about resource attributes.

HostAddress string

The host address.

HostName string

Specify the new create a host name of the supports up to 128 characters.

Ids []string

A list of Host IDs.

NameRegex string

A regex string to filter results by Host name.

OsType string

Specify the new create the host's operating system. Valid values: Linux Windows.

OutputFile string
Source string

Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.

SourceInstanceId string

Specify the newly created ECS instance ID or dedicated cluster host ID.

SourceInstanceState string

The source instance state.

instanceId String

Specify the new create a host where the Bastion host ID of.

enableDetails Boolean

Default to false. Set it to true can output more details about resource attributes.

hostAddress String

The host address.

hostName String

Specify the new create a host name of the supports up to 128 characters.

ids List<String>

A list of Host IDs.

nameRegex String

A regex string to filter results by Host name.

osType String

Specify the new create the host's operating system. Valid values: Linux Windows.

outputFile String
source String

Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.

sourceInstanceId String

Specify the newly created ECS instance ID or dedicated cluster host ID.

sourceInstanceState String

The source instance state.

instanceId string

Specify the new create a host where the Bastion host ID of.

enableDetails boolean

Default to false. Set it to true can output more details about resource attributes.

hostAddress string

The host address.

hostName string

Specify the new create a host name of the supports up to 128 characters.

ids string[]

A list of Host IDs.

nameRegex string

A regex string to filter results by Host name.

osType string

Specify the new create the host's operating system. Valid values: Linux Windows.

outputFile string
source string

Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.

sourceInstanceId string

Specify the newly created ECS instance ID or dedicated cluster host ID.

sourceInstanceState string

The source instance state.

instance_id str

Specify the new create a host where the Bastion host ID of.

enable_details bool

Default to false. Set it to true can output more details about resource attributes.

host_address str

The host address.

host_name str

Specify the new create a host name of the supports up to 128 characters.

ids Sequence[str]

A list of Host IDs.

name_regex str

A regex string to filter results by Host name.

os_type str

Specify the new create the host's operating system. Valid values: Linux Windows.

output_file str
source str

Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.

source_instance_id str

Specify the newly created ECS instance ID or dedicated cluster host ID.

source_instance_state str

The source instance state.

instanceId String

Specify the new create a host where the Bastion host ID of.

enableDetails Boolean

Default to false. Set it to true can output more details about resource attributes.

hostAddress String

The host address.

hostName String

Specify the new create a host name of the supports up to 128 characters.

ids List<String>

A list of Host IDs.

nameRegex String

A regex string to filter results by Host name.

osType String

Specify the new create the host's operating system. Valid values: Linux Windows.

outputFile String
source String

Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.

sourceInstanceId String

Specify the newly created ECS instance ID or dedicated cluster host ID.

sourceInstanceState String

The source instance state.

getHosts Result

The following output properties are available:

Hosts List<Pulumi.AliCloud.BastionHost.Outputs.GetHostsHost>
Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>
InstanceId string
Names List<string>
EnableDetails bool
HostAddress string
HostName string
NameRegex string
OsType string
OutputFile string
Source string
SourceInstanceId string
SourceInstanceState string
Hosts []GetHostsHost
Id string

The provider-assigned unique ID for this managed resource.

Ids []string
InstanceId string
Names []string
EnableDetails bool
HostAddress string
HostName string
NameRegex string
OsType string
OutputFile string
Source string
SourceInstanceId string
SourceInstanceState string
hosts List<GetHostsHost>
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
instanceId String
names List<String>
enableDetails Boolean
hostAddress String
hostName String
nameRegex String
osType String
outputFile String
source String
sourceInstanceId String
sourceInstanceState String
hosts GetHostsHost[]
id string

The provider-assigned unique ID for this managed resource.

ids string[]
instanceId string
names string[]
enableDetails boolean
hostAddress string
hostName string
nameRegex string
osType string
outputFile string
source string
sourceInstanceId string
sourceInstanceState string
hosts Sequence[GetHostsHost]
id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]
instance_id str
names Sequence[str]
enable_details bool
host_address str
host_name str
name_regex str
os_type str
output_file str
source str
source_instance_id str
source_instance_state str
hosts List<Property Map>
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
instanceId String
names List<String>
enableDetails Boolean
hostAddress String
hostName String
nameRegex String
osType String
outputFile String
source String
sourceInstanceId String
sourceInstanceState String

Supporting Types

GetHostsHost

ActiveAddressType string

Specify the new create a host of address types. Valid values: Public: the IP address of a Public network Private: Private network address.

Comment string

Specify a host of notes, supports up to 500 characters.

HostId string

The host ID.

HostName string

Specify the new create a host name of the supports up to 128 characters.

HostPrivateAddress string

Specify the new create a host of the private network address, it is possible to use the domain name or IP ADDRESS.

HostPublicAddress string

Specify the new create a host of the IP address of a public network, it is possible to use the domain name or IP ADDRESS.

Id string

The ID of the Host.

InstanceId string

Specify the new create a host where the Bastion host ID of.

OsType string

Specify the new create the host's operating system. Valid values: Linux Windows.

Protocols List<Pulumi.AliCloud.BastionHost.Inputs.GetHostsHostProtocol>

The host of the protocol information.

Source string

Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.

SourceInstanceId string

Specify the newly created ECS instance ID or dedicated cluster host ID.

ActiveAddressType string

Specify the new create a host of address types. Valid values: Public: the IP address of a Public network Private: Private network address.

Comment string

Specify a host of notes, supports up to 500 characters.

HostId string

The host ID.

HostName string

Specify the new create a host name of the supports up to 128 characters.

HostPrivateAddress string

Specify the new create a host of the private network address, it is possible to use the domain name or IP ADDRESS.

HostPublicAddress string

Specify the new create a host of the IP address of a public network, it is possible to use the domain name or IP ADDRESS.

Id string

The ID of the Host.

InstanceId string

Specify the new create a host where the Bastion host ID of.

OsType string

Specify the new create the host's operating system. Valid values: Linux Windows.

Protocols []GetHostsHostProtocol

The host of the protocol information.

Source string

Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.

SourceInstanceId string

Specify the newly created ECS instance ID or dedicated cluster host ID.

activeAddressType String

Specify the new create a host of address types. Valid values: Public: the IP address of a Public network Private: Private network address.

comment String

Specify a host of notes, supports up to 500 characters.

hostId String

The host ID.

hostName String

Specify the new create a host name of the supports up to 128 characters.

hostPrivateAddress String

Specify the new create a host of the private network address, it is possible to use the domain name or IP ADDRESS.

hostPublicAddress String

Specify the new create a host of the IP address of a public network, it is possible to use the domain name or IP ADDRESS.

id String

The ID of the Host.

instanceId String

Specify the new create a host where the Bastion host ID of.

osType String

Specify the new create the host's operating system. Valid values: Linux Windows.

protocols List<GetHostsHostProtocol>

The host of the protocol information.

source String

Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.

sourceInstanceId String

Specify the newly created ECS instance ID or dedicated cluster host ID.

activeAddressType string

Specify the new create a host of address types. Valid values: Public: the IP address of a Public network Private: Private network address.

comment string

Specify a host of notes, supports up to 500 characters.

hostId string

The host ID.

hostName string

Specify the new create a host name of the supports up to 128 characters.

hostPrivateAddress string

Specify the new create a host of the private network address, it is possible to use the domain name or IP ADDRESS.

hostPublicAddress string

Specify the new create a host of the IP address of a public network, it is possible to use the domain name or IP ADDRESS.

id string

The ID of the Host.

instanceId string

Specify the new create a host where the Bastion host ID of.

osType string

Specify the new create the host's operating system. Valid values: Linux Windows.

protocols GetHostsHostProtocol[]

The host of the protocol information.

source string

Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.

sourceInstanceId string

Specify the newly created ECS instance ID or dedicated cluster host ID.

active_address_type str

Specify the new create a host of address types. Valid values: Public: the IP address of a Public network Private: Private network address.

comment str

Specify a host of notes, supports up to 500 characters.

host_id str

The host ID.

host_name str

Specify the new create a host name of the supports up to 128 characters.

host_private_address str

Specify the new create a host of the private network address, it is possible to use the domain name or IP ADDRESS.

host_public_address str

Specify the new create a host of the IP address of a public network, it is possible to use the domain name or IP ADDRESS.

id str

The ID of the Host.

instance_id str

Specify the new create a host where the Bastion host ID of.

os_type str

Specify the new create the host's operating system. Valid values: Linux Windows.

protocols Sequence[GetHostsHostProtocol]

The host of the protocol information.

source str

Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.

source_instance_id str

Specify the newly created ECS instance ID or dedicated cluster host ID.

activeAddressType String

Specify the new create a host of address types. Valid values: Public: the IP address of a Public network Private: Private network address.

comment String

Specify a host of notes, supports up to 500 characters.

hostId String

The host ID.

hostName String

Specify the new create a host name of the supports up to 128 characters.

hostPrivateAddress String

Specify the new create a host of the private network address, it is possible to use the domain name or IP ADDRESS.

hostPublicAddress String

Specify the new create a host of the IP address of a public network, it is possible to use the domain name or IP ADDRESS.

id String

The ID of the Host.

instanceId String

Specify the new create a host where the Bastion host ID of.

osType String

Specify the new create the host's operating system. Valid values: Linux Windows.

protocols List<Property Map>

The host of the protocol information.

source String

Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.

sourceInstanceId String

Specify the newly created ECS instance ID or dedicated cluster host ID.

GetHostsHostProtocol

HostFingerPrint string

Host fingerprint information, it is possible to uniquely identify a host.

Port int

Host the service port of the RDS.

ProtocolName string

The host uses the protocol name.

HostFingerPrint string

Host fingerprint information, it is possible to uniquely identify a host.

Port int

Host the service port of the RDS.

ProtocolName string

The host uses the protocol name.

hostFingerPrint String

Host fingerprint information, it is possible to uniquely identify a host.

port Integer

Host the service port of the RDS.

protocolName String

The host uses the protocol name.

hostFingerPrint string

Host fingerprint information, it is possible to uniquely identify a host.

port number

Host the service port of the RDS.

protocolName string

The host uses the protocol name.

host_finger_print str

Host fingerprint information, it is possible to uniquely identify a host.

port int

Host the service port of the RDS.

protocol_name str

The host uses the protocol name.

hostFingerPrint String

Host fingerprint information, it is possible to uniquely identify a host.

port Number

Host the service port of the RDS.

protocolName String

The host uses the protocol name.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.