Alibaba Cloud

Pulumi Official
Package maintained by Pulumi
v3.27.0 published on Monday, Aug 8, 2022 by Pulumi

getExchanges

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

NOTE: Available in v1.128.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var ids = Output.Create(AliCloud.Amqp.GetExchanges.InvokeAsync(new AliCloud.Amqp.GetExchangesArgs
        {
            InstanceId = "amqp-abc12345",
            VirtualHostName = "my-VirtualHost",
            Ids = 
            {
                "my-Exchange-1",
                "my-Exchange-2",
            },
        }));
        this.AmqpExchangeId1 = ids.Apply(ids => ids.Exchanges?[0]?.Id);
        var nameRegex = Output.Create(AliCloud.Amqp.GetExchanges.InvokeAsync(new AliCloud.Amqp.GetExchangesArgs
        {
            InstanceId = "amqp-abc12345",
            VirtualHostName = "my-VirtualHost",
            NameRegex = "^my-Exchange",
        }));
        this.AmqpExchangeId2 = nameRegex.Apply(nameRegex => nameRegex.Exchanges?[0]?.Id);
    }

    [Output("amqpExchangeId1")]
    public Output<string> AmqpExchangeId1 { get; set; }
    [Output("amqpExchangeId2")]
    public Output<string> AmqpExchangeId2 { 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.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
	})
}
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()));
    }
}
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)
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);
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}

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>
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]
func GetExchanges(ctx *Context, args *GetExchangesArgs, opts ...InvokeOption) (*GetExchangesResult, error)
func GetExchangesOutput(ctx *Context, args *GetExchangesOutputArgs, opts ...InvokeOption) GetExchangesResultOutput

> 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)
}
public static CompletableFuture<GetExchangesResult> getExchanges(GetExchangesArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: alicloud:amqp/getExchanges:getExchanges
  Arguments:
    # Arguments dictionary

The following arguments are supported:

InstanceId string

The ID of the instance.

VirtualHostName string

The name of virtual host where an exchange resides.

Ids List<string>

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

NameRegex string

A regex string to filter results by Exchange name.

OutputFile string
InstanceId string

The ID of the instance.

VirtualHostName string

The name of virtual host where an exchange resides.

Ids []string

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

NameRegex string

A regex string to filter results by Exchange name.

OutputFile string
instanceId String

The ID of the instance.

virtualHostName String

The name of virtual host where an exchange resides.

ids List<String>

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

nameRegex String

A regex string to filter results by Exchange name.

outputFile String
instanceId string

The ID of the instance.

virtualHostName string

The name of virtual host where an exchange resides.

ids string[]

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

nameRegex string

A regex string to filter results by Exchange name.

outputFile string
instance_id str

The ID of the instance.

virtual_host_name str

The name of virtual host where an exchange resides.

ids Sequence[str]

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

name_regex str

A regex string to filter results by Exchange name.

output_file str
instanceId String

The ID of the instance.

virtualHostName String

The name of virtual host where an exchange resides.

ids List<String>

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

nameRegex String

A regex string to filter results by Exchange name.

outputFile String

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 Dictionary<string, object>

The attributes.

AutoDeleteState bool

Indicates whether the Auto Delete attribute is configured.

CreateTime string

The creation time.

ExchangeName string

The name of the exchange.

ExchangeType string

The type of the exchange.

Id string

The ID of the Exchange. Its value is same as Queue Name.

InstanceId string

The ID of the instance.

VirtualHostName string

The name of virtual host where an exchange resides.

Attributes map[string]interface{}

The attributes.

AutoDeleteState bool

Indicates whether the Auto Delete attribute is configured.

CreateTime string

The creation time.

ExchangeName string

The name of the exchange.

ExchangeType string

The type of the exchange.

Id string

The ID of the Exchange. Its value is same as Queue Name.

InstanceId string

The ID of the instance.

VirtualHostName string

The name of virtual host where an exchange resides.

attributes Map<String,Object>

The attributes.

autoDeleteState Boolean

Indicates whether the Auto Delete attribute is configured.

createTime String

The creation time.

exchangeName String

The name of the exchange.

exchangeType String

The type of the exchange.

id String

The ID of the Exchange. Its value is same as Queue Name.

instanceId String

The ID of the instance.

virtualHostName String

The name of virtual host where an exchange resides.

attributes {[key: string]: any}

The attributes.

autoDeleteState boolean

Indicates whether the Auto Delete attribute is configured.

createTime string

The creation time.

exchangeName string

The name of the exchange.

exchangeType string

The type of the exchange.

id string

The ID of the Exchange. Its value is same as Queue Name.

instanceId string

The ID of the instance.

virtualHostName string

The name of virtual host where an exchange resides.

attributes Mapping[str, Any]

The attributes.

auto_delete_state bool

Indicates whether the Auto Delete attribute is configured.

create_time str

The creation time.

exchange_name str

The name of the exchange.

exchange_type str

The type of the exchange.

id str

The ID of the Exchange. Its value is same as Queue Name.

instance_id str

The ID of the instance.

virtual_host_name str

The name of virtual host where an exchange resides.

attributes Map<Any>

The attributes.

autoDeleteState Boolean

Indicates whether the Auto Delete attribute is configured.

createTime String

The creation time.

exchangeName String

The name of the exchange.

exchangeType String

The type of the exchange.

id String

The ID of the Exchange. Its value is same as Queue Name.

instanceId String

The ID of the instance.

virtualHostName String

The name of virtual host where an exchange resides.

Package Details

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

This Pulumi package is based on the alicloud Terraform Provider.