1. Packages
  2. Rabbitmq Provider
  3. API Docs
  4. Binding
RabbitMQ v3.3.6 published on Monday, Oct 7, 2024 by Pulumi

rabbitmq.Binding

Explore with Pulumi AI

rabbitmq logo
RabbitMQ v3.3.6 published on Monday, Oct 7, 2024 by Pulumi

    The rabbitmq.Binding resource creates and manages a binding relationship between a queue an exchange.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as rabbitmq from "@pulumi/rabbitmq";
    
    const test = new rabbitmq.VHost("test", {name: "test"});
    const guest = new rabbitmq.Permissions("guest", {
        user: "guest",
        vhost: test.name,
        permissions: {
            configure: ".*",
            write: ".*",
            read: ".*",
        },
    });
    const testExchange = new rabbitmq.Exchange("test", {
        name: "test",
        vhost: guest.vhost,
        settings: {
            type: "fanout",
            durable: false,
            autoDelete: true,
        },
    });
    const testQueue = new rabbitmq.Queue("test", {
        name: "test",
        vhost: guest.vhost,
        settings: {
            durable: true,
            autoDelete: false,
        },
    });
    const testBinding = new rabbitmq.Binding("test", {
        source: testExchange.name,
        vhost: test.name,
        destination: testQueue.name,
        destinationType: "queue",
        routingKey: "#",
    });
    
    import pulumi
    import pulumi_rabbitmq as rabbitmq
    
    test = rabbitmq.VHost("test", name="test")
    guest = rabbitmq.Permissions("guest",
        user="guest",
        vhost=test.name,
        permissions={
            "configure": ".*",
            "write": ".*",
            "read": ".*",
        })
    test_exchange = rabbitmq.Exchange("test",
        name="test",
        vhost=guest.vhost,
        settings={
            "type": "fanout",
            "durable": False,
            "auto_delete": True,
        })
    test_queue = rabbitmq.Queue("test",
        name="test",
        vhost=guest.vhost,
        settings={
            "durable": True,
            "auto_delete": False,
        })
    test_binding = rabbitmq.Binding("test",
        source=test_exchange.name,
        vhost=test.name,
        destination=test_queue.name,
        destination_type="queue",
        routing_key="#")
    
    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 {
    		test, err := rabbitmq.NewVHost(ctx, "test", &rabbitmq.VHostArgs{
    			Name: pulumi.String("test"),
    		})
    		if err != nil {
    			return err
    		}
    		guest, err := rabbitmq.NewPermissions(ctx, "guest", &rabbitmq.PermissionsArgs{
    			User:  pulumi.String("guest"),
    			Vhost: test.Name,
    			Permissions: &rabbitmq.PermissionsPermissionsArgs{
    				Configure: pulumi.String(".*"),
    				Write:     pulumi.String(".*"),
    				Read:      pulumi.String(".*"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		testExchange, err := rabbitmq.NewExchange(ctx, "test", &rabbitmq.ExchangeArgs{
    			Name:  pulumi.String("test"),
    			Vhost: guest.Vhost,
    			Settings: &rabbitmq.ExchangeSettingsArgs{
    				Type:       pulumi.String("fanout"),
    				Durable:    pulumi.Bool(false),
    				AutoDelete: pulumi.Bool(true),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		testQueue, err := rabbitmq.NewQueue(ctx, "test", &rabbitmq.QueueArgs{
    			Name:  pulumi.String("test"),
    			Vhost: guest.Vhost,
    			Settings: &rabbitmq.QueueSettingsArgs{
    				Durable:    pulumi.Bool(true),
    				AutoDelete: pulumi.Bool(false),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = rabbitmq.NewBinding(ctx, "test", &rabbitmq.BindingArgs{
    			Source:          testExchange.Name,
    			Vhost:           test.Name,
    			Destination:     testQueue.Name,
    			DestinationType: pulumi.String("queue"),
    			RoutingKey:      pulumi.String("#"),
    		})
    		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 test = new RabbitMQ.VHost("test", new()
        {
            Name = "test",
        });
    
        var guest = new RabbitMQ.Permissions("guest", new()
        {
            User = "guest",
            Vhost = test.Name,
            PermissionDetails = new RabbitMQ.Inputs.PermissionsPermissionsArgs
            {
                Configure = ".*",
                Write = ".*",
                Read = ".*",
            },
        });
    
        var testExchange = new RabbitMQ.Exchange("test", new()
        {
            Name = "test",
            Vhost = guest.Vhost,
            Settings = new RabbitMQ.Inputs.ExchangeSettingsArgs
            {
                Type = "fanout",
                Durable = false,
                AutoDelete = true,
            },
        });
    
        var testQueue = new RabbitMQ.Queue("test", new()
        {
            Name = "test",
            Vhost = guest.Vhost,
            Settings = new RabbitMQ.Inputs.QueueSettingsArgs
            {
                Durable = true,
                AutoDelete = false,
            },
        });
    
        var testBinding = new RabbitMQ.Binding("test", new()
        {
            Source = testExchange.Name,
            Vhost = test.Name,
            Destination = testQueue.Name,
            DestinationType = "queue",
            RoutingKey = "#",
        });
    
    });
    
    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.VHostArgs;
    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 com.pulumi.rabbitmq.Queue;
    import com.pulumi.rabbitmq.QueueArgs;
    import com.pulumi.rabbitmq.inputs.QueueSettingsArgs;
    import com.pulumi.rabbitmq.Binding;
    import com.pulumi.rabbitmq.BindingArgs;
    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 test = new VHost("test", VHostArgs.builder()
                .name("test")
                .build());
    
            var guest = new Permissions("guest", PermissionsArgs.builder()
                .user("guest")
                .vhost(test.name())
                .permissions(PermissionsPermissionsArgs.builder()
                    .configure(".*")
                    .write(".*")
                    .read(".*")
                    .build())
                .build());
    
            var testExchange = new Exchange("testExchange", ExchangeArgs.builder()
                .name("test")
                .vhost(guest.vhost())
                .settings(ExchangeSettingsArgs.builder()
                    .type("fanout")
                    .durable(false)
                    .autoDelete(true)
                    .build())
                .build());
    
            var testQueue = new Queue("testQueue", QueueArgs.builder()
                .name("test")
                .vhost(guest.vhost())
                .settings(QueueSettingsArgs.builder()
                    .durable(true)
                    .autoDelete(false)
                    .build())
                .build());
    
            var testBinding = new Binding("testBinding", BindingArgs.builder()
                .source(testExchange.name())
                .vhost(test.name())
                .destination(testQueue.name())
                .destinationType("queue")
                .routingKey("#")
                .build());
    
        }
    }
    
    resources:
      test:
        type: rabbitmq:VHost
        properties:
          name: test
      guest:
        type: rabbitmq:Permissions
        properties:
          user: guest
          vhost: ${test.name}
          permissions:
            configure: .*
            write: .*
            read: .*
      testExchange:
        type: rabbitmq:Exchange
        name: test
        properties:
          name: test
          vhost: ${guest.vhost}
          settings:
            type: fanout
            durable: false
            autoDelete: true
      testQueue:
        type: rabbitmq:Queue
        name: test
        properties:
          name: test
          vhost: ${guest.vhost}
          settings:
            durable: true
            autoDelete: false
      testBinding:
        type: rabbitmq:Binding
        name: test
        properties:
          source: ${testExchange.name}
          vhost: ${test.name}
          destination: ${testQueue.name}
          destinationType: queue
          routingKey: '#'
    

    Create Binding Resource

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

    Constructor syntax

    new Binding(name: string, args: BindingArgs, opts?: CustomResourceOptions);
    @overload
    def Binding(resource_name: str,
                args: BindingArgs,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def Binding(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                destination: Optional[str] = None,
                destination_type: Optional[str] = None,
                source: Optional[str] = None,
                vhost: Optional[str] = None,
                arguments: Optional[Mapping[str, str]] = None,
                arguments_json: Optional[str] = None,
                routing_key: Optional[str] = None)
    func NewBinding(ctx *Context, name string, args BindingArgs, opts ...ResourceOption) (*Binding, error)
    public Binding(string name, BindingArgs args, CustomResourceOptions? opts = null)
    public Binding(String name, BindingArgs args)
    public Binding(String name, BindingArgs args, CustomResourceOptions options)
    
    type: rabbitmq:Binding
    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 BindingArgs
    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 BindingArgs
    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 BindingArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args BindingArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args BindingArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

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

    var bindingResource = new RabbitMQ.Binding("bindingResource", new()
    {
        Destination = "string",
        DestinationType = "string",
        Source = "string",
        Vhost = "string",
        Arguments = 
        {
            { "string", "string" },
        },
        ArgumentsJson = "string",
        RoutingKey = "string",
    });
    
    example, err := rabbitmq.NewBinding(ctx, "bindingResource", &rabbitmq.BindingArgs{
    	Destination:     pulumi.String("string"),
    	DestinationType: pulumi.String("string"),
    	Source:          pulumi.String("string"),
    	Vhost:           pulumi.String("string"),
    	Arguments: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	ArgumentsJson: pulumi.String("string"),
    	RoutingKey:    pulumi.String("string"),
    })
    
    var bindingResource = new Binding("bindingResource", BindingArgs.builder()
        .destination("string")
        .destinationType("string")
        .source("string")
        .vhost("string")
        .arguments(Map.of("string", "string"))
        .argumentsJson("string")
        .routingKey("string")
        .build());
    
    binding_resource = rabbitmq.Binding("bindingResource",
        destination="string",
        destination_type="string",
        source="string",
        vhost="string",
        arguments={
            "string": "string",
        },
        arguments_json="string",
        routing_key="string")
    
    const bindingResource = new rabbitmq.Binding("bindingResource", {
        destination: "string",
        destinationType: "string",
        source: "string",
        vhost: "string",
        arguments: {
            string: "string",
        },
        argumentsJson: "string",
        routingKey: "string",
    });
    
    type: rabbitmq:Binding
    properties:
        arguments:
            string: string
        argumentsJson: string
        destination: string
        destinationType: string
        routingKey: string
        source: string
        vhost: string
    

    Binding Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Binding resource accepts the following input properties:

    Destination string
    The destination queue or exchange.
    DestinationType string
    The type of destination (queue or exchange).
    Source string
    The source exchange.
    Vhost string
    The vhost to create the resource in.
    Arguments Dictionary<string, string>
    Additional key/value arguments for the binding.
    ArgumentsJson string
    RoutingKey string
    A routing key for the binding.
    Destination string
    The destination queue or exchange.
    DestinationType string
    The type of destination (queue or exchange).
    Source string
    The source exchange.
    Vhost string
    The vhost to create the resource in.
    Arguments map[string]string
    Additional key/value arguments for the binding.
    ArgumentsJson string
    RoutingKey string
    A routing key for the binding.
    destination String
    The destination queue or exchange.
    destinationType String
    The type of destination (queue or exchange).
    source String
    The source exchange.
    vhost String
    The vhost to create the resource in.
    arguments Map<String,String>
    Additional key/value arguments for the binding.
    argumentsJson String
    routingKey String
    A routing key for the binding.
    destination string
    The destination queue or exchange.
    destinationType string
    The type of destination (queue or exchange).
    source string
    The source exchange.
    vhost string
    The vhost to create the resource in.
    arguments {[key: string]: string}
    Additional key/value arguments for the binding.
    argumentsJson string
    routingKey string
    A routing key for the binding.
    destination str
    The destination queue or exchange.
    destination_type str
    The type of destination (queue or exchange).
    source str
    The source exchange.
    vhost str
    The vhost to create the resource in.
    arguments Mapping[str, str]
    Additional key/value arguments for the binding.
    arguments_json str
    routing_key str
    A routing key for the binding.
    destination String
    The destination queue or exchange.
    destinationType String
    The type of destination (queue or exchange).
    source String
    The source exchange.
    vhost String
    The vhost to create the resource in.
    arguments Map<String>
    Additional key/value arguments for the binding.
    argumentsJson String
    routingKey String
    A routing key for the binding.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    PropertiesKey string
    A unique key to refer to the binding.
    Id string
    The provider-assigned unique ID for this managed resource.
    PropertiesKey string
    A unique key to refer to the binding.
    id String
    The provider-assigned unique ID for this managed resource.
    propertiesKey String
    A unique key to refer to the binding.
    id string
    The provider-assigned unique ID for this managed resource.
    propertiesKey string
    A unique key to refer to the binding.
    id str
    The provider-assigned unique ID for this managed resource.
    properties_key str
    A unique key to refer to the binding.
    id String
    The provider-assigned unique ID for this managed resource.
    propertiesKey String
    A unique key to refer to the binding.

    Look up Existing Binding Resource

    Get an existing Binding 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?: BindingState, opts?: CustomResourceOptions): Binding
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            arguments: Optional[Mapping[str, str]] = None,
            arguments_json: Optional[str] = None,
            destination: Optional[str] = None,
            destination_type: Optional[str] = None,
            properties_key: Optional[str] = None,
            routing_key: Optional[str] = None,
            source: Optional[str] = None,
            vhost: Optional[str] = None) -> Binding
    func GetBinding(ctx *Context, name string, id IDInput, state *BindingState, opts ...ResourceOption) (*Binding, error)
    public static Binding Get(string name, Input<string> id, BindingState? state, CustomResourceOptions? opts = null)
    public static Binding get(String name, Output<String> id, BindingState 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:
    Arguments Dictionary<string, string>
    Additional key/value arguments for the binding.
    ArgumentsJson string
    Destination string
    The destination queue or exchange.
    DestinationType string
    The type of destination (queue or exchange).
    PropertiesKey string
    A unique key to refer to the binding.
    RoutingKey string
    A routing key for the binding.
    Source string
    The source exchange.
    Vhost string
    The vhost to create the resource in.
    Arguments map[string]string
    Additional key/value arguments for the binding.
    ArgumentsJson string
    Destination string
    The destination queue or exchange.
    DestinationType string
    The type of destination (queue or exchange).
    PropertiesKey string
    A unique key to refer to the binding.
    RoutingKey string
    A routing key for the binding.
    Source string
    The source exchange.
    Vhost string
    The vhost to create the resource in.
    arguments Map<String,String>
    Additional key/value arguments for the binding.
    argumentsJson String
    destination String
    The destination queue or exchange.
    destinationType String
    The type of destination (queue or exchange).
    propertiesKey String
    A unique key to refer to the binding.
    routingKey String
    A routing key for the binding.
    source String
    The source exchange.
    vhost String
    The vhost to create the resource in.
    arguments {[key: string]: string}
    Additional key/value arguments for the binding.
    argumentsJson string
    destination string
    The destination queue or exchange.
    destinationType string
    The type of destination (queue or exchange).
    propertiesKey string
    A unique key to refer to the binding.
    routingKey string
    A routing key for the binding.
    source string
    The source exchange.
    vhost string
    The vhost to create the resource in.
    arguments Mapping[str, str]
    Additional key/value arguments for the binding.
    arguments_json str
    destination str
    The destination queue or exchange.
    destination_type str
    The type of destination (queue or exchange).
    properties_key str
    A unique key to refer to the binding.
    routing_key str
    A routing key for the binding.
    source str
    The source exchange.
    vhost str
    The vhost to create the resource in.
    arguments Map<String>
    Additional key/value arguments for the binding.
    argumentsJson String
    destination String
    The destination queue or exchange.
    destinationType String
    The type of destination (queue or exchange).
    propertiesKey String
    A unique key to refer to the binding.
    routingKey String
    A routing key for the binding.
    source String
    The source exchange.
    vhost String
    The vhost to create the resource in.

    Import

    Bindings can be imported using the id which is composed of vhost/source/destination/destination_type/properties_key. E.g.

    $ pulumi import rabbitmq:index/binding:Binding test test/test/test/queue/%23
    

    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.6 published on Monday, Oct 7, 2024 by Pulumi