Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi
alicloud.amqp.getVirtualHosts
Explore with Pulumi AI
This data source provides the Amqp Virtual Hosts of the current Alibaba Cloud user.
NOTE: Available in v1.126.0+.
Example Usage
Basic Usage
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);
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)
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
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var ids = AliCloud.Amqp.GetVirtualHosts.Invoke(new()
{
InstanceId = "amqp-abc12345",
Ids = new[]
{
"my-VirtualHost-1",
"my-VirtualHost-2",
},
});
var nameRegex = AliCloud.Amqp.GetVirtualHosts.Invoke(new()
{
InstanceId = "amqp-abc12345",
NameRegex = "^my-VirtualHost",
});
return new Dictionary<string, object?>
{
["amqpVirtualHostId1"] = ids.Apply(getVirtualHostsResult => getVirtualHostsResult.Hosts[0]?.Id),
["amqpVirtualHostId2"] = nameRegex.Apply(getVirtualHostsResult => getVirtualHostsResult.Hosts[0]?.Id),
};
});
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()));
}
}
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:
- Instance
Id string - InstanceId.
- Ids List<string>
- A list of Virtual Host IDs. Its element value is same as Virtual Host Name.
- Name
Regex string - A regex string to filter results by Virtual Host name.
- Output
File string - File name where to save data source results (after running
pulumi preview
).
- Instance
Id string - InstanceId.
- Ids []string
- A list of Virtual Host IDs. Its element value is same as Virtual Host Name.
- Name
Regex string - A regex string to filter results by Virtual Host name.
- Output
File string - File name where to save data source results (after running
pulumi preview
).
- instance
Id String - InstanceId.
- ids List<String>
- A list of Virtual Host IDs. Its element value is same as Virtual Host Name.
- name
Regex String - A regex string to filter results by Virtual Host name.
- output
File String - File name where to save data source results (after running
pulumi preview
).
- instance
Id string - InstanceId.
- ids string[]
- A list of Virtual Host IDs. Its element value is same as Virtual Host Name.
- name
Regex string - A regex string to filter results by Virtual Host name.
- output
File string - File name where to save data source results (after running
pulumi preview
).
- 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 - File name where to save data source results (after running
pulumi preview
).
- instance
Id String - InstanceId.
- ids List<String>
- A list of Virtual Host IDs. Its element value is same as Virtual Host Name.
- name
Regex String - A regex string to filter results by Virtual Host name.
- output
File String - File name where to save data source results (after running
pulumi preview
).
getVirtualHosts Result
The following output properties are available:
- Hosts
List<Pulumi.
Ali Cloud. Amqp. Outputs. Get Virtual Hosts Host> - Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- Instance
Id string - Names List<string>
- Name
Regex string - Output
File string
- Hosts
[]Get
Virtual Hosts Host - Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- Instance
Id string - Names []string
- Name
Regex string - Output
File string
- hosts
List<Get
Virtual Hosts Host> - id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- instance
Id String - names List<String>
- name
Regex String - output
File String
- hosts
Get
Virtual Hosts Host[] - id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- instance
Id string - names string[]
- name
Regex string - output
File string
- hosts
Sequence[Get
Virtual Hosts Host] - 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>
- instance
Id String - names List<String>
- name
Regex String - output
File String
Supporting Types
GetVirtualHostsHost
- Id string
- The ID of the Virtual Host.
- Instance
Id string - InstanceId.
- Virtual
Host stringName - VirtualHostName.
- Id string
- The ID of the Virtual Host.
- Instance
Id string - InstanceId.
- Virtual
Host stringName - VirtualHostName.
- id String
- The ID of the Virtual Host.
- instance
Id String - InstanceId.
- virtual
Host StringName - VirtualHostName.
- id string
- The ID of the Virtual Host.
- instance
Id string - InstanceId.
- virtual
Host stringName - VirtualHostName.
- id str
- The ID of the Virtual Host.
- instance_
id str - InstanceId.
- virtual_
host_ strname - VirtualHostName.
- id String
- The ID of the Virtual Host.
- instance
Id String - InstanceId.
- virtual
Host StringName - VirtualHostName.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.