1. Packages
  2. RabbitMQ
  3. API Docs
  4. Exchange
RabbitMQ v3.3.2 published on Thursday, Mar 21, 2024 by Pulumi

rabbitmq.Exchange

Explore with Pulumi AI

rabbitmq logo
RabbitMQ v3.3.2 published on Thursday, Mar 21, 2024 by Pulumi

    The rabbitmq.Exchange resource creates and manages an exchange.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as rabbitmq from "@pulumi/rabbitmq";
    
    const testVHost = new rabbitmq.VHost("testVHost", {});
    const guest = new rabbitmq.Permissions("guest", {
        permissions: {
            configure: ".*",
            read: ".*",
            write: ".*",
        },
        user: "guest",
        vhost: testVHost.name,
    });
    const testExchange = new rabbitmq.Exchange("testExchange", {
        settings: {
            autoDelete: true,
            durable: false,
            type: "fanout",
        },
        vhost: guest.vhost,
    });
    
    import pulumi
    import pulumi_rabbitmq as rabbitmq
    
    test_v_host = rabbitmq.VHost("testVHost")
    guest = rabbitmq.Permissions("guest",
        permissions=rabbitmq.PermissionsPermissionsArgs(
            configure=".*",
            read=".*",
            write=".*",
        ),
        user="guest",
        vhost=test_v_host.name)
    test_exchange = rabbitmq.Exchange("testExchange",
        settings=rabbitmq.ExchangeSettingsArgs(
            auto_delete=True,
            durable=False,
            type="fanout",
        ),
        vhost=guest.vhost)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-rabbitmq/sdk/v3/go/rabbitmq"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		testVHost, err := rabbitmq.NewVHost(ctx, "testVHost", nil)
    		if err != nil {
    			return err
    		}
    		guest, err := rabbitmq.NewPermissions(ctx, "guest", &rabbitmq.PermissionsArgs{
    			Permissions: &rabbitmq.PermissionsPermissionsArgs{
    				Configure: pulumi.String(".*"),
    				Read:      pulumi.String(".*"),
    				Write:     pulumi.String(".*"),
    			},
    			User:  pulumi.String("guest"),
    			Vhost: testVHost.Name,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = rabbitmq.NewExchange(ctx, "testExchange", &rabbitmq.ExchangeArgs{
    			Settings: &rabbitmq.ExchangeSettingsArgs{
    				AutoDelete: pulumi.Bool(true),
    				Durable:    pulumi.Bool(false),
    				Type:       pulumi.String("fanout"),
    			},
    			Vhost: guest.Vhost,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using RabbitMQ = Pulumi.RabbitMQ;
    
    return await Deployment.RunAsync(() => 
    {
        var testVHost = new RabbitMQ.VHost("testVHost");
    
        var guest = new RabbitMQ.Permissions("guest", new()
        {
            PermissionDetails = new RabbitMQ.Inputs.PermissionsPermissionsArgs
            {
                Configure = ".*",
                Read = ".*",
                Write = ".*",
            },
            User = "guest",
            Vhost = testVHost.Name,
        });
    
        var testExchange = new RabbitMQ.Exchange("testExchange", new()
        {
            Settings = new RabbitMQ.Inputs.ExchangeSettingsArgs
            {
                AutoDelete = true,
                Durable = false,
                Type = "fanout",
            },
            Vhost = guest.Vhost,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.rabbitmq.VHost;
    import com.pulumi.rabbitmq.Permissions;
    import com.pulumi.rabbitmq.PermissionsArgs;
    import com.pulumi.rabbitmq.inputs.PermissionsPermissionsArgs;
    import com.pulumi.rabbitmq.Exchange;
    import com.pulumi.rabbitmq.ExchangeArgs;
    import com.pulumi.rabbitmq.inputs.ExchangeSettingsArgs;
    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) {
            var testVHost = new VHost("testVHost");
    
            var guest = new Permissions("guest", PermissionsArgs.builder()        
                .permissions(PermissionsPermissionsArgs.builder()
                    .configure(".*")
                    .read(".*")
                    .write(".*")
                    .build())
                .user("guest")
                .vhost(testVHost.name())
                .build());
    
            var testExchange = new Exchange("testExchange", ExchangeArgs.builder()        
                .settings(ExchangeSettingsArgs.builder()
                    .autoDelete(true)
                    .durable(false)
                    .type("fanout")
                    .build())
                .vhost(guest.vhost())
                .build());
    
        }
    }
    
    resources:
      testVHost:
        type: rabbitmq:VHost
      guest:
        type: rabbitmq:Permissions
        properties:
          permissions:
            configure: .*
            read: .*
            write: .*
          user: guest
          vhost: ${testVHost.name}
      testExchange:
        type: rabbitmq:Exchange
        properties:
          settings:
            autoDelete: true
            durable: false
            type: fanout
          vhost: ${guest.vhost}
    

    Create Exchange Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Exchange(name: string, args: ExchangeArgs, opts?: CustomResourceOptions);
    @overload
    def Exchange(resource_name: str,
                 args: ExchangeArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def Exchange(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 settings: Optional[ExchangeSettingsArgs] = None,
                 name: Optional[str] = None,
                 vhost: Optional[str] = None)
    func NewExchange(ctx *Context, name string, args ExchangeArgs, opts ...ResourceOption) (*Exchange, error)
    public Exchange(string name, ExchangeArgs args, CustomResourceOptions? opts = null)
    public Exchange(String name, ExchangeArgs args)
    public Exchange(String name, ExchangeArgs args, CustomResourceOptions options)
    
    type: rabbitmq:Exchange
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ExchangeArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ExchangeArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ExchangeArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ExchangeArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ExchangeArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var exchangeResource = new RabbitMQ.Exchange("exchangeResource", new()
    {
        Settings = new RabbitMQ.Inputs.ExchangeSettingsArgs
        {
            Type = "string",
            Arguments = 
            {
                { "string", "any" },
            },
            AutoDelete = false,
            Durable = false,
        },
        Name = "string",
        Vhost = "string",
    });
    
    example, err := rabbitmq.NewExchange(ctx, "exchangeResource", &rabbitmq.ExchangeArgs{
    	Settings: &rabbitmq.ExchangeSettingsArgs{
    		Type: pulumi.String("string"),
    		Arguments: pulumi.Map{
    			"string": pulumi.Any("any"),
    		},
    		AutoDelete: pulumi.Bool(false),
    		Durable:    pulumi.Bool(false),
    	},
    	Name:  pulumi.String("string"),
    	Vhost: pulumi.String("string"),
    })
    
    var exchangeResource = new Exchange("exchangeResource", ExchangeArgs.builder()        
        .settings(ExchangeSettingsArgs.builder()
            .type("string")
            .arguments(Map.of("string", "any"))
            .autoDelete(false)
            .durable(false)
            .build())
        .name("string")
        .vhost("string")
        .build());
    
    exchange_resource = rabbitmq.Exchange("exchangeResource",
        settings=rabbitmq.ExchangeSettingsArgs(
            type="string",
            arguments={
                "string": "any",
            },
            auto_delete=False,
            durable=False,
        ),
        name="string",
        vhost="string")
    
    const exchangeResource = new rabbitmq.Exchange("exchangeResource", {
        settings: {
            type: "string",
            arguments: {
                string: "any",
            },
            autoDelete: false,
            durable: false,
        },
        name: "string",
        vhost: "string",
    });
    
    type: rabbitmq:Exchange
    properties:
        name: string
        settings:
            arguments:
                string: any
            autoDelete: false
            durable: false
            type: string
        vhost: string
    

    Exchange Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Exchange resource accepts the following input properties:

    Settings Pulumi.RabbitMQ.Inputs.ExchangeSettings
    The settings of the exchange. The structure is described below.
    Name string
    The name of the exchange.
    Vhost string
    The vhost to create the resource in.
    Settings ExchangeSettingsArgs
    The settings of the exchange. The structure is described below.
    Name string
    The name of the exchange.
    Vhost string
    The vhost to create the resource in.
    settings ExchangeSettings
    The settings of the exchange. The structure is described below.
    name String
    The name of the exchange.
    vhost String
    The vhost to create the resource in.
    settings ExchangeSettings
    The settings of the exchange. The structure is described below.
    name string
    The name of the exchange.
    vhost string
    The vhost to create the resource in.
    settings ExchangeSettingsArgs
    The settings of the exchange. The structure is described below.
    name str
    The name of the exchange.
    vhost str
    The vhost to create the resource in.
    settings Property Map
    The settings of the exchange. The structure is described below.
    name String
    The name of the exchange.
    vhost String
    The vhost to create the resource in.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Exchange resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Exchange Resource

    Get an existing Exchange resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ExchangeState, opts?: CustomResourceOptions): Exchange
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            settings: Optional[ExchangeSettingsArgs] = None,
            vhost: Optional[str] = None) -> Exchange
    func GetExchange(ctx *Context, name string, id IDInput, state *ExchangeState, opts ...ResourceOption) (*Exchange, error)
    public static Exchange Get(string name, Input<string> id, ExchangeState? state, CustomResourceOptions? opts = null)
    public static Exchange get(String name, Output<String> id, ExchangeState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Name string
    The name of the exchange.
    Settings Pulumi.RabbitMQ.Inputs.ExchangeSettings
    The settings of the exchange. The structure is described below.
    Vhost string
    The vhost to create the resource in.
    Name string
    The name of the exchange.
    Settings ExchangeSettingsArgs
    The settings of the exchange. The structure is described below.
    Vhost string
    The vhost to create the resource in.
    name String
    The name of the exchange.
    settings ExchangeSettings
    The settings of the exchange. The structure is described below.
    vhost String
    The vhost to create the resource in.
    name string
    The name of the exchange.
    settings ExchangeSettings
    The settings of the exchange. The structure is described below.
    vhost string
    The vhost to create the resource in.
    name str
    The name of the exchange.
    settings ExchangeSettingsArgs
    The settings of the exchange. The structure is described below.
    vhost str
    The vhost to create the resource in.
    name String
    The name of the exchange.
    settings Property Map
    The settings of the exchange. The structure is described below.
    vhost String
    The vhost to create the resource in.

    Supporting Types

    ExchangeSettings, ExchangeSettingsArgs

    Type string
    The type of exchange.
    Arguments Dictionary<string, object>
    Additional key/value settings for the exchange.
    AutoDelete bool
    Whether the exchange will self-delete when all queues have finished using it.
    Durable bool
    Whether the exchange survives server restarts. Defaults to false.
    Type string
    The type of exchange.
    Arguments map[string]interface{}
    Additional key/value settings for the exchange.
    AutoDelete bool
    Whether the exchange will self-delete when all queues have finished using it.
    Durable bool
    Whether the exchange survives server restarts. Defaults to false.
    type String
    The type of exchange.
    arguments Map<String,Object>
    Additional key/value settings for the exchange.
    autoDelete Boolean
    Whether the exchange will self-delete when all queues have finished using it.
    durable Boolean
    Whether the exchange survives server restarts. Defaults to false.
    type string
    The type of exchange.
    arguments {[key: string]: any}
    Additional key/value settings for the exchange.
    autoDelete boolean
    Whether the exchange will self-delete when all queues have finished using it.
    durable boolean
    Whether the exchange survives server restarts. Defaults to false.
    type str
    The type of exchange.
    arguments Mapping[str, Any]
    Additional key/value settings for the exchange.
    auto_delete bool
    Whether the exchange will self-delete when all queues have finished using it.
    durable bool
    Whether the exchange survives server restarts. Defaults to false.
    type String
    The type of exchange.
    arguments Map<Any>
    Additional key/value settings for the exchange.
    autoDelete Boolean
    Whether the exchange will self-delete when all queues have finished using it.
    durable Boolean
    Whether the exchange survives server restarts. Defaults to false.

    Import

    Exchanges can be imported using the id which is composed of name@vhost.

    E.g.

    $ pulumi import rabbitmq:index/exchange:Exchange test test@vhost
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    RabbitMQ pulumi/pulumi-rabbitmq
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the rabbitmq Terraform Provider.
    rabbitmq logo
    RabbitMQ v3.3.2 published on Thursday, Mar 21, 2024 by Pulumi