1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. amqp
  5. getExchanges
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.amqp.getExchanges

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

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

NOTE: Available in v1.128.0+.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const ids = alicloud.amqp.getExchanges({
    instanceId: "amqp-abc12345",
    virtualHostName: "my-VirtualHost",
    ids: [
        "my-Exchange-1",
        "my-Exchange-2",
    ],
});
export const amqpExchangeId1 = ids.then(ids => ids.exchanges?.[0]?.id);
const nameRegex = alicloud.amqp.getExchanges({
    instanceId: "amqp-abc12345",
    virtualHostName: "my-VirtualHost",
    nameRegex: "^my-Exchange",
});
export const amqpExchangeId2 = nameRegex.then(nameRegex => nameRegex.exchanges?.[0]?.id);
Copy
import pulumi
import pulumi_alicloud as alicloud

ids = alicloud.amqp.get_exchanges(instance_id="amqp-abc12345",
    virtual_host_name="my-VirtualHost",
    ids=[
        "my-Exchange-1",
        "my-Exchange-2",
    ])
pulumi.export("amqpExchangeId1", ids.exchanges[0].id)
name_regex = alicloud.amqp.get_exchanges(instance_id="amqp-abc12345",
    virtual_host_name="my-VirtualHost",
    name_regex="^my-Exchange")
pulumi.export("amqpExchangeId2", name_regex.exchanges[0].id)
Copy
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.GetExchanges(ctx, &amqp.GetExchangesArgs{
			InstanceId:      "amqp-abc12345",
			VirtualHostName: "my-VirtualHost",
			Ids: []string{
				"my-Exchange-1",
				"my-Exchange-2",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("amqpExchangeId1", ids.Exchanges[0].Id)
		nameRegex, err := amqp.GetExchanges(ctx, &amqp.GetExchangesArgs{
			InstanceId:      "amqp-abc12345",
			VirtualHostName: "my-VirtualHost",
			NameRegex:       pulumi.StringRef("^my-Exchange"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("amqpExchangeId2", nameRegex.Exchanges[0].Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var ids = AliCloud.Amqp.GetExchanges.Invoke(new()
    {
        InstanceId = "amqp-abc12345",
        VirtualHostName = "my-VirtualHost",
        Ids = new[]
        {
            "my-Exchange-1",
            "my-Exchange-2",
        },
    });

    var nameRegex = AliCloud.Amqp.GetExchanges.Invoke(new()
    {
        InstanceId = "amqp-abc12345",
        VirtualHostName = "my-VirtualHost",
        NameRegex = "^my-Exchange",
    });

    return new Dictionary<string, object?>
    {
        ["amqpExchangeId1"] = ids.Apply(getExchangesResult => getExchangesResult.Exchanges[0]?.Id),
        ["amqpExchangeId2"] = nameRegex.Apply(getExchangesResult => getExchangesResult.Exchanges[0]?.Id),
    };
});
Copy
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.GetExchangesArgs;
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.getExchanges(GetExchangesArgs.builder()
            .instanceId("amqp-abc12345")
            .virtualHostName("my-VirtualHost")
            .ids(            
                "my-Exchange-1",
                "my-Exchange-2")
            .build());

        ctx.export("amqpExchangeId1", ids.applyValue(getExchangesResult -> getExchangesResult.exchanges()[0].id()));
        final var nameRegex = AmqpFunctions.getExchanges(GetExchangesArgs.builder()
            .instanceId("amqp-abc12345")
            .virtualHostName("my-VirtualHost")
            .nameRegex("^my-Exchange")
            .build());

        ctx.export("amqpExchangeId2", nameRegex.applyValue(getExchangesResult -> getExchangesResult.exchanges()[0].id()));
    }
}
Copy
variables:
  ids:
    fn::invoke:
      function: alicloud:amqp:getExchanges
      arguments:
        instanceId: amqp-abc12345
        virtualHostName: my-VirtualHost
        ids:
          - my-Exchange-1
          - my-Exchange-2
  nameRegex:
    fn::invoke:
      function: alicloud:amqp:getExchanges
      arguments:
        instanceId: amqp-abc12345
        virtualHostName: my-VirtualHost
        nameRegex: ^my-Exchange
outputs:
  amqpExchangeId1: ${ids.exchanges[0].id}
  amqpExchangeId2: ${nameRegex.exchanges[0].id}
Copy

Using getExchanges

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 getExchanges(args: GetExchangesArgs, opts?: InvokeOptions): Promise<GetExchangesResult>
function getExchangesOutput(args: GetExchangesOutputArgs, opts?: InvokeOptions): Output<GetExchangesResult>
Copy
def get_exchanges(ids: Optional[Sequence[str]] = None,
                  instance_id: Optional[str] = None,
                  name_regex: Optional[str] = None,
                  output_file: Optional[str] = None,
                  virtual_host_name: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetExchangesResult
def get_exchanges_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,
                  virtual_host_name: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetExchangesResult]
Copy
func GetExchanges(ctx *Context, args *GetExchangesArgs, opts ...InvokeOption) (*GetExchangesResult, error)
func GetExchangesOutput(ctx *Context, args *GetExchangesOutputArgs, opts ...InvokeOption) GetExchangesResultOutput
Copy

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

public static class GetExchanges 
{
    public static Task<GetExchangesResult> InvokeAsync(GetExchangesArgs args, InvokeOptions? opts = null)
    public static Output<GetExchangesResult> Invoke(GetExchangesInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetExchangesResult> getExchanges(GetExchangesArgs args, InvokeOptions options)
public static Output<GetExchangesResult> getExchanges(GetExchangesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:amqp/getExchanges:getExchanges
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

InstanceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the instance.
VirtualHostName
This property is required.
Changes to this property will trigger replacement.
string
The name of virtual host where an exchange resides.
Ids Changes to this property will trigger replacement. List<string>
A list of Exchange IDs. Its element value is same as Exchange Name.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Exchange name.
OutputFile string
File name where to save data source results (after running pulumi preview).
InstanceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the instance.
VirtualHostName
This property is required.
Changes to this property will trigger replacement.
string
The name of virtual host where an exchange resides.
Ids Changes to this property will trigger replacement. []string
A list of Exchange IDs. Its element value is same as Exchange Name.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Exchange name.
OutputFile string
File name where to save data source results (after running pulumi preview).
instanceId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the instance.
virtualHostName
This property is required.
Changes to this property will trigger replacement.
String
The name of virtual host where an exchange resides.
ids Changes to this property will trigger replacement. List<String>
A list of Exchange IDs. Its element value is same as Exchange Name.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Exchange name.
outputFile String
File name where to save data source results (after running pulumi preview).
instanceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the instance.
virtualHostName
This property is required.
Changes to this property will trigger replacement.
string
The name of virtual host where an exchange resides.
ids Changes to this property will trigger replacement. string[]
A list of Exchange IDs. Its element value is same as Exchange Name.
nameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Exchange name.
outputFile string
File name where to save data source results (after running pulumi preview).
instance_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the instance.
virtual_host_name
This property is required.
Changes to this property will trigger replacement.
str
The name of virtual host where an exchange resides.
ids Changes to this property will trigger replacement. Sequence[str]
A list of Exchange IDs. Its element value is same as Exchange Name.
name_regex Changes to this property will trigger replacement. str
A regex string to filter results by Exchange name.
output_file str
File name where to save data source results (after running pulumi preview).
instanceId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the instance.
virtualHostName
This property is required.
Changes to this property will trigger replacement.
String
The name of virtual host where an exchange resides.
ids Changes to this property will trigger replacement. List<String>
A list of Exchange IDs. Its element value is same as Exchange Name.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Exchange name.
outputFile String
File name where to save data source results (after running pulumi preview).

getExchanges Result

The following output properties are available:

Exchanges List<Pulumi.AliCloud.Amqp.Outputs.GetExchangesExchange>
Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
InstanceId string
Names List<string>
VirtualHostName string
NameRegex string
OutputFile string
Exchanges []GetExchangesExchange
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
InstanceId string
Names []string
VirtualHostName string
NameRegex string
OutputFile string
exchanges List<GetExchangesExchange>
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
instanceId String
names List<String>
virtualHostName String
nameRegex String
outputFile String
exchanges GetExchangesExchange[]
id string
The provider-assigned unique ID for this managed resource.
ids string[]
instanceId string
names string[]
virtualHostName string
nameRegex string
outputFile string
exchanges Sequence[GetExchangesExchange]
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
instance_id str
names Sequence[str]
virtual_host_name str
name_regex str
output_file str
exchanges List<Property Map>
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
instanceId String
names List<String>
virtualHostName String
nameRegex String
outputFile String

Supporting Types

GetExchangesExchange

Attributes This property is required. Dictionary<string, string>
The attributes.
AutoDeleteState This property is required. bool
Indicates whether the Auto Delete attribute is configured.
CreateTime This property is required. string
The creation time.
ExchangeName This property is required. string
The name of the exchange.
ExchangeType This property is required. string
The type of the exchange.
Id This property is required. string
The ID of the Exchange. Its value is same as Queue Name.
InstanceId This property is required. string
The ID of the instance.
VirtualHostName This property is required. string
The name of virtual host where an exchange resides.
Attributes This property is required. map[string]string
The attributes.
AutoDeleteState This property is required. bool
Indicates whether the Auto Delete attribute is configured.
CreateTime This property is required. string
The creation time.
ExchangeName This property is required. string
The name of the exchange.
ExchangeType This property is required. string
The type of the exchange.
Id This property is required. string
The ID of the Exchange. Its value is same as Queue Name.
InstanceId This property is required. string
The ID of the instance.
VirtualHostName This property is required. string
The name of virtual host where an exchange resides.
attributes This property is required. Map<String,String>
The attributes.
autoDeleteState This property is required. Boolean
Indicates whether the Auto Delete attribute is configured.
createTime This property is required. String
The creation time.
exchangeName This property is required. String
The name of the exchange.
exchangeType This property is required. String
The type of the exchange.
id This property is required. String
The ID of the Exchange. Its value is same as Queue Name.
instanceId This property is required. String
The ID of the instance.
virtualHostName This property is required. String
The name of virtual host where an exchange resides.
attributes This property is required. {[key: string]: string}
The attributes.
autoDeleteState This property is required. boolean
Indicates whether the Auto Delete attribute is configured.
createTime This property is required. string
The creation time.
exchangeName This property is required. string
The name of the exchange.
exchangeType This property is required. string
The type of the exchange.
id This property is required. string
The ID of the Exchange. Its value is same as Queue Name.
instanceId This property is required. string
The ID of the instance.
virtualHostName This property is required. string
The name of virtual host where an exchange resides.
attributes This property is required. Mapping[str, str]
The attributes.
auto_delete_state This property is required. bool
Indicates whether the Auto Delete attribute is configured.
create_time This property is required. str
The creation time.
exchange_name This property is required. str
The name of the exchange.
exchange_type This property is required. str
The type of the exchange.
id This property is required. str
The ID of the Exchange. Its value is same as Queue Name.
instance_id This property is required. str
The ID of the instance.
virtual_host_name This property is required. str
The name of virtual host where an exchange resides.
attributes This property is required. Map<String>
The attributes.
autoDeleteState This property is required. Boolean
Indicates whether the Auto Delete attribute is configured.
createTime This property is required. String
The creation time.
exchangeName This property is required. String
The name of the exchange.
exchangeType This property is required. String
The type of the exchange.
id This property is required. String
The ID of the Exchange. Its value is same as Queue Name.
instanceId This property is required. String
The ID of the instance.
virtualHostName This property is required. String
The name of virtual host where an exchange resides.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi