Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi
alicloud.amqp.getExchanges
Explore with Pulumi AI
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);
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)
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
	})
}
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),
    };
});
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()));
    }
}
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 dictionaryThe following arguments are supported:
- Instance
Id string - The ID of the instance.
 - Virtual
Host stringName  - 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.
 - Name
Regex string - A regex string to filter results by Exchange name.
 - Output
File string - File name where to save data source results (after running 
pulumi preview). 
- Instance
Id string - The ID of the instance.
 - Virtual
Host stringName  - The name of virtual host where an exchange resides.
 - Ids []string
 - A list of Exchange IDs. Its element value is same as Exchange Name.
 - Name
Regex string - A regex string to filter results by Exchange name.
 - Output
File string - File name where to save data source results (after running 
pulumi preview). 
- instance
Id String - The ID of the instance.
 - virtual
Host StringName  - 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.
 - name
Regex String - A regex string to filter results by Exchange name.
 - output
File String - File name where to save data source results (after running 
pulumi preview). 
- instance
Id string - The ID of the instance.
 - virtual
Host stringName  - The name of virtual host where an exchange resides.
 - ids string[]
 - A list of Exchange IDs. Its element value is same as Exchange Name.
 - name
Regex string - A regex string to filter results by Exchange name.
 - output
File string - File name where to save data source results (after running 
pulumi preview). 
- instance_
id str - The ID of the instance.
 - virtual_
host_ strname  - 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 - File name where to save data source results (after running 
pulumi preview). 
- instance
Id String - The ID of the instance.
 - virtual
Host StringName  - 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.
 - name
Regex String - A regex string to filter results by Exchange name.
 - output
File String - File name where to save data source results (after running 
pulumi preview). 
getExchanges Result
The following output properties are available:
- Exchanges
List<Pulumi.
Ali Cloud. Amqp. Outputs. Get Exchanges Exchange>  - Id string
 - The provider-assigned unique ID for this managed resource.
 - Ids List<string>
 - Instance
Id string - Names List<string>
 - Virtual
Host stringName  - Name
Regex string - Output
File string 
- Exchanges
[]Get
Exchanges Exchange  - Id string
 - The provider-assigned unique ID for this managed resource.
 - Ids []string
 - Instance
Id string - Names []string
 - Virtual
Host stringName  - Name
Regex string - Output
File string 
- exchanges
List<Get
Exchanges Exchange>  - id String
 - The provider-assigned unique ID for this managed resource.
 - ids List<String>
 - instance
Id String - names List<String>
 - virtual
Host StringName  - name
Regex String - output
File String 
- exchanges
Get
Exchanges Exchange[]  - id string
 - The provider-assigned unique ID for this managed resource.
 - ids string[]
 - instance
Id string - names string[]
 - virtual
Host stringName  - name
Regex string - output
File string 
- exchanges
Sequence[Get
Exchanges Exchange]  - id str
 - The provider-assigned unique ID for this managed resource.
 - ids Sequence[str]
 - instance_
id str - names Sequence[str]
 - virtual_
host_ strname  - name_
regex str - output_
file str 
- exchanges List<Property Map>
 - id String
 - The provider-assigned unique ID for this managed resource.
 - ids List<String>
 - instance
Id String - names List<String>
 - virtual
Host StringName  - name
Regex String - output
File String 
Supporting Types
GetExchangesExchange  
- Attributes Dictionary<string, object>
 - The attributes.
 - Auto
Delete boolState  - Indicates whether the Auto Delete attribute is configured.
 - Create
Time string - The creation time.
 - Exchange
Name string - The name of the exchange.
 - Exchange
Type string - The type of the exchange.
 - Id string
 - The ID of the Exchange. Its value is same as Queue Name.
 - Instance
Id string - The ID of the instance.
 - Virtual
Host stringName  - The name of virtual host where an exchange resides.
 
- Attributes map[string]interface{}
 - The attributes.
 - Auto
Delete boolState  - Indicates whether the Auto Delete attribute is configured.
 - Create
Time string - The creation time.
 - Exchange
Name string - The name of the exchange.
 - Exchange
Type string - The type of the exchange.
 - Id string
 - The ID of the Exchange. Its value is same as Queue Name.
 - Instance
Id string - The ID of the instance.
 - Virtual
Host stringName  - The name of virtual host where an exchange resides.
 
- attributes Map<String,Object>
 - The attributes.
 - auto
Delete BooleanState  - Indicates whether the Auto Delete attribute is configured.
 - create
Time String - The creation time.
 - exchange
Name String - The name of the exchange.
 - exchange
Type String - The type of the exchange.
 - id String
 - The ID of the Exchange. Its value is same as Queue Name.
 - instance
Id String - The ID of the instance.
 - virtual
Host StringName  - The name of virtual host where an exchange resides.
 
- attributes {[key: string]: any}
 - The attributes.
 - auto
Delete booleanState  - Indicates whether the Auto Delete attribute is configured.
 - create
Time string - The creation time.
 - exchange
Name string - The name of the exchange.
 - exchange
Type string - The type of the exchange.
 - id string
 - The ID of the Exchange. Its value is same as Queue Name.
 - instance
Id string - The ID of the instance.
 - virtual
Host stringName  - The name of virtual host where an exchange resides.
 
- attributes Mapping[str, Any]
 - The attributes.
 - auto_
delete_ boolstate  - 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_ strname  - The name of virtual host where an exchange resides.
 
- attributes Map<Any>
 - The attributes.
 - auto
Delete BooleanState  - Indicates whether the Auto Delete attribute is configured.
 - create
Time String - The creation time.
 - exchange
Name String - The name of the exchange.
 - exchange
Type String - The type of the exchange.
 - id String
 - The ID of the Exchange. Its value is same as Queue Name.
 - instance
Id String - The ID of the instance.
 - virtual
Host StringName  - 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 
alicloudTerraform Provider.