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

rabbitmq.Binding

Explore with Pulumi AI

rabbitmq logo
RabbitMQ v3.3.2 published on Thursday, Mar 21, 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 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,
    });
    const testQueue = new rabbitmq.Queue("testQueue", {
        settings: {
            autoDelete: false,
            durable: true,
        },
        vhost: guest.vhost,
    });
    const testBinding = new rabbitmq.Binding("testBinding", {
        destination: testQueue.name,
        destinationType: "queue",
        routingKey: "#",
        source: testExchange.name,
        vhost: testVHost.name,
    });
    
    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)
    test_queue = rabbitmq.Queue("testQueue",
        settings=rabbitmq.QueueSettingsArgs(
            auto_delete=False,
            durable=True,
        ),
        vhost=guest.vhost)
    test_binding = rabbitmq.Binding("testBinding",
        destination=test_queue.name,
        destination_type="queue",
        routing_key="#",
        source=test_exchange.name,
        vhost=test_v_host.name)
    
    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
    		}
    		testExchange, 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
    		}
    		testQueue, err := rabbitmq.NewQueue(ctx, "testQueue", &rabbitmq.QueueArgs{
    			Settings: &rabbitmq.QueueSettingsArgs{
    				AutoDelete: pulumi.Bool(false),
    				Durable:    pulumi.Bool(true),
    			},
    			Vhost: guest.Vhost,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = rabbitmq.NewBinding(ctx, "testBinding", &rabbitmq.BindingArgs{
    			Destination:     testQueue.Name,
    			DestinationType: pulumi.String("queue"),
    			RoutingKey:      pulumi.String("#"),
    			Source:          testExchange.Name,
    			Vhost:           testVHost.Name,
    		})
    		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,
        });
    
        var testQueue = new RabbitMQ.Queue("testQueue", new()
        {
            Settings = new RabbitMQ.Inputs.QueueSettingsArgs
            {
                AutoDelete = false,
                Durable = true,
            },
            Vhost = guest.Vhost,
        });
    
        var testBinding = new RabbitMQ.Binding("testBinding", new()
        {
            Destination = testQueue.Name,
            DestinationType = "queue",
            RoutingKey = "#",
            Source = testExchange.Name,
            Vhost = testVHost.Name,
        });
    
    });
    
    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 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 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());
    
            var testQueue = new Queue("testQueue", QueueArgs.builder()        
                .settings(QueueSettingsArgs.builder()
                    .autoDelete(false)
                    .durable(true)
                    .build())
                .vhost(guest.vhost())
                .build());
    
            var testBinding = new Binding("testBinding", BindingArgs.builder()        
                .destination(testQueue.name())
                .destinationType("queue")
                .routingKey("#")
                .source(testExchange.name())
                .vhost(testVHost.name())
                .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}
      testQueue:
        type: rabbitmq:Queue
        properties:
          settings:
            autoDelete: false
            durable: true
          vhost: ${guest.vhost}
      testBinding:
        type: rabbitmq:Binding
        properties:
          destination: ${testQueue.name}
          destinationType: queue
          routingKey: '#'
          source: ${testExchange.name}
          vhost: ${testVHost.name}
    

    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, Any]] = 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.

    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", "any" },
        },
        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.Map{
    		"string": pulumi.Any("any"),
    	},
    	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", "any"))
        .argumentsJson("string")
        .routingKey("string")
        .build());
    
    binding_resource = rabbitmq.Binding("bindingResource",
        destination="string",
        destination_type="string",
        source="string",
        vhost="string",
        arguments={
            "string": "any",
        },
        arguments_json="string",
        routing_key="string")
    
    const bindingResource = new rabbitmq.Binding("bindingResource", {
        destination: "string",
        destinationType: "string",
        source: "string",
        vhost: "string",
        arguments: {
            string: "any",
        },
        argumentsJson: "string",
        routingKey: "string",
    });
    
    type: rabbitmq:Binding
    properties:
        arguments:
            string: any
        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

    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, object>
    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]interface{}
    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,Object>
    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]: any}
    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, Any]
    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<Any>
    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, Any]] = 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, object>
    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]interface{}
    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,Object>
    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]: any}
    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, Any]
    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<Any>
    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/%!
    (MISSING)```
    
    
    To learn more about importing existing cloud resources, see [Importing resources](/docs/using-pulumi/adopting-pulumi/import/).
    
    
    
    
    <h2 id="package-details">Package Details</h2>
    <dl class="package-details">
    	<dt>Repository</dt>
    	<dd><a href="https://github.com/pulumi/pulumi-rabbitmq">RabbitMQ pulumi/pulumi-rabbitmq</a></dd>
    	<dt>License</dt>
    	<dd>Apache-2.0</dd>
    	<dt>Notes</dt>
    	<dd>This Pulumi package is based on the <a href="https://github.com/terraform-providers/terraform-provider-rabbitmq"><code>rabbitmq</code> Terraform Provider</a>.</dd>
    </dl>
    
    rabbitmq logo
    RabbitMQ v3.3.2 published on Thursday, Mar 21, 2024 by Pulumi