Alibaba Cloud

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

getVirtualHosts

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

NOTE: Available in v1.126.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var ids = Output.Create(AliCloud.Amqp.GetVirtualHosts.InvokeAsync(new AliCloud.Amqp.GetVirtualHostsArgs
        {
            InstanceId = "amqp-abc12345",
            Ids = 
            {
                "my-VirtualHost-1",
                "my-VirtualHost-2",
            },
        }));
        this.AmqpVirtualHostId1 = ids.Apply(ids => ids.Hosts?[0]?.Id);
        var nameRegex = Output.Create(AliCloud.Amqp.GetVirtualHosts.InvokeAsync(new AliCloud.Amqp.GetVirtualHostsArgs
        {
            InstanceId = "amqp-abc12345",
            NameRegex = "^my-VirtualHost",
        }));
        this.AmqpVirtualHostId2 = nameRegex.Apply(nameRegex => nameRegex.Hosts?[0]?.Id);
    }

    [Output("amqpVirtualHostId1")]
    public Output<string> AmqpVirtualHostId1 { get; set; }
    [Output("amqpVirtualHostId2")]
    public Output<string> AmqpVirtualHostId2 { get; set; }
}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		ids, err := amqp.GetVirtualHosts(ctx, &amqp.GetVirtualHostsArgs{
			InstanceId: "amqp-abc12345",
			Ids: []string{
				"my-VirtualHost-1",
				"my-VirtualHost-2",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("amqpVirtualHostId1", ids.Hosts[0].Id)
		nameRegex, err := amqp.GetVirtualHosts(ctx, &amqp.GetVirtualHostsArgs{
			InstanceId: "amqp-abc12345",
			NameRegex:  pulumi.StringRef("^my-VirtualHost"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("amqpVirtualHostId2", 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.amqp.AmqpFunctions;
import com.pulumi.alicloud.amqp.inputs.GetVirtualHostsArgs;
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 = AmqpFunctions.getVirtualHosts(GetVirtualHostsArgs.builder()
            .instanceId("amqp-abc12345")
            .ids(            
                "my-VirtualHost-1",
                "my-VirtualHost-2")
            .build());

        ctx.export("amqpVirtualHostId1", ids.applyValue(getVirtualHostsResult -> getVirtualHostsResult.hosts()[0].id()));
        final var nameRegex = AmqpFunctions.getVirtualHosts(GetVirtualHostsArgs.builder()
            .instanceId("amqp-abc12345")
            .nameRegex("^my-VirtualHost")
            .build());

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

ids = alicloud.amqp.get_virtual_hosts(instance_id="amqp-abc12345",
    ids=[
        "my-VirtualHost-1",
        "my-VirtualHost-2",
    ])
pulumi.export("amqpVirtualHostId1", ids.hosts[0].id)
name_regex = alicloud.amqp.get_virtual_hosts(instance_id="amqp-abc12345",
    name_regex="^my-VirtualHost")
pulumi.export("amqpVirtualHostId2", name_regex.hosts[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const ids = alicloud.amqp.getVirtualHosts({
    instanceId: "amqp-abc12345",
    ids: [
        "my-VirtualHost-1",
        "my-VirtualHost-2",
    ],
});
export const amqpVirtualHostId1 = ids.then(ids => ids.hosts?[0]?.id);
const nameRegex = alicloud.amqp.getVirtualHosts({
    instanceId: "amqp-abc12345",
    nameRegex: "^my-VirtualHost",
});
export const amqpVirtualHostId2 = nameRegex.then(nameRegex => nameRegex.hosts?[0]?.id);
variables:
  ids:
    Fn::Invoke:
      Function: alicloud:amqp:getVirtualHosts
      Arguments:
        instanceId: amqp-abc12345
        ids:
          - my-VirtualHost-1
          - my-VirtualHost-2
  nameRegex:
    Fn::Invoke:
      Function: alicloud:amqp:getVirtualHosts
      Arguments:
        instanceId: amqp-abc12345
        nameRegex: ^my-VirtualHost
outputs:
  amqpVirtualHostId1: ${ids.hosts[0].id}
  amqpVirtualHostId2: ${nameRegex.hosts[0].id}

Using getVirtualHosts

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 getVirtualHosts(args: GetVirtualHostsArgs, opts?: InvokeOptions): Promise<GetVirtualHostsResult>
function getVirtualHostsOutput(args: GetVirtualHostsOutputArgs, opts?: InvokeOptions): Output<GetVirtualHostsResult>
def get_virtual_hosts(ids: Optional[Sequence[str]] = None,
                      instance_id: Optional[str] = None,
                      name_regex: Optional[str] = None,
                      output_file: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetVirtualHostsResult
def get_virtual_hosts_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                      instance_id: Optional[pulumi.Input[str]] = None,
                      name_regex: Optional[pulumi.Input[str]] = None,
                      output_file: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetVirtualHostsResult]
func GetVirtualHosts(ctx *Context, args *GetVirtualHostsArgs, opts ...InvokeOption) (*GetVirtualHostsResult, error)
func GetVirtualHostsOutput(ctx *Context, args *GetVirtualHostsOutputArgs, opts ...InvokeOption) GetVirtualHostsResultOutput

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

public static class GetVirtualHosts 
{
    public static Task<GetVirtualHostsResult> InvokeAsync(GetVirtualHostsArgs args, InvokeOptions? opts = null)
    public static Output<GetVirtualHostsResult> Invoke(GetVirtualHostsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetVirtualHostsResult> getVirtualHosts(GetVirtualHostsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: alicloud:amqp/getVirtualHosts:getVirtualHosts
  Arguments:
    # Arguments dictionary

The following arguments are supported:

InstanceId string

InstanceId.

Ids List<string>

A list of Virtual Host IDs. Its element value is same as Virtual Host Name.

NameRegex string

A regex string to filter results by Virtual Host name.

OutputFile string
InstanceId string

InstanceId.

Ids []string

A list of Virtual Host IDs. Its element value is same as Virtual Host Name.

NameRegex string

A regex string to filter results by Virtual Host name.

OutputFile string
instanceId String

InstanceId.

ids List<String>

A list of Virtual Host IDs. Its element value is same as Virtual Host Name.

nameRegex String

A regex string to filter results by Virtual Host name.

outputFile String
instanceId string

InstanceId.

ids string[]

A list of Virtual Host IDs. Its element value is same as Virtual Host Name.

nameRegex string

A regex string to filter results by Virtual Host name.

outputFile string
instance_id str

InstanceId.

ids Sequence[str]

A list of Virtual Host IDs. Its element value is same as Virtual Host Name.

name_regex str

A regex string to filter results by Virtual Host name.

output_file str
instanceId String

InstanceId.

ids List<String>

A list of Virtual Host IDs. Its element value is same as Virtual Host Name.

nameRegex String

A regex string to filter results by Virtual Host name.

outputFile String

getVirtualHosts Result

The following output properties are available:

Hosts List<Pulumi.AliCloud.Amqp.Outputs.GetVirtualHostsHost>
Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>
InstanceId string
Names List<string>
NameRegex string
OutputFile string
Hosts []GetVirtualHostsHost
Id string

The provider-assigned unique ID for this managed resource.

Ids []string
InstanceId string
Names []string
NameRegex string
OutputFile string
hosts List<GetVirtualHostsHost>
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
instanceId String
names List<String>
nameRegex String
outputFile String
hosts GetVirtualHostsHost[]
id string

The provider-assigned unique ID for this managed resource.

ids string[]
instanceId string
names string[]
nameRegex string
outputFile string
hosts Sequence[GetVirtualHostsHost]
id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]
instance_id str
names Sequence[str]
name_regex str
output_file str
hosts List<Property Map>
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
instanceId String
names List<String>
nameRegex String
outputFile String

Supporting Types

GetVirtualHostsHost

Id string

The ID of the Virtual Host.

InstanceId string

InstanceId.

VirtualHostName string

VirtualHostName.

Id string

The ID of the Virtual Host.

InstanceId string

InstanceId.

VirtualHostName string

VirtualHostName.

id String

The ID of the Virtual Host.

instanceId String

InstanceId.

virtualHostName String

VirtualHostName.

id string

The ID of the Virtual Host.

instanceId string

InstanceId.

virtualHostName string

VirtualHostName.

id str

The ID of the Virtual Host.

instance_id str

InstanceId.

virtual_host_name str

VirtualHostName.

id String

The ID of the Virtual Host.

instanceId String

InstanceId.

virtualHostName String

VirtualHostName.

Package Details

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

This Pulumi package is based on the alicloud Terraform Provider.