1. Packages
  2. Mailgun
  3. API Docs
  4. Route
Mailgun v3.5.4 published on Tuesday, Jul 2, 2024 by Pulumi

mailgun.Route

Explore with Pulumi AI

mailgun logo
Mailgun v3.5.4 published on Tuesday, Jul 2, 2024 by Pulumi

    Provides a Mailgun Route resource. This can be used to create and manage routes on Mailgun.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as mailgun from "@pulumi/mailgun";
    
    // Create a new Mailgun route
    const _default = new mailgun.Route("default", {
        priority: 0,
        description: "inbound",
        expression: "match_recipient('.*@foo.example.com')",
        actions: [
            "forward('http://example.com/api/v1/foos/')",
            "stop()",
        ],
    });
    
    import pulumi
    import pulumi_mailgun as mailgun
    
    # Create a new Mailgun route
    default = mailgun.Route("default",
        priority=0,
        description="inbound",
        expression="match_recipient('.*@foo.example.com')",
        actions=[
            "forward('http://example.com/api/v1/foos/')",
            "stop()",
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-mailgun/sdk/v3/go/mailgun"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Create a new Mailgun route
    		_, err := mailgun.NewRoute(ctx, "default", &mailgun.RouteArgs{
    			Priority:    pulumi.Int(0),
    			Description: pulumi.String("inbound"),
    			Expression:  pulumi.String("match_recipient('.*@foo.example.com')"),
    			Actions: pulumi.StringArray{
    				pulumi.String("forward('http://example.com/api/v1/foos/')"),
    				pulumi.String("stop()"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Mailgun = Pulumi.Mailgun;
    
    return await Deployment.RunAsync(() => 
    {
        // Create a new Mailgun route
        var @default = new Mailgun.Route("default", new()
        {
            Priority = 0,
            Description = "inbound",
            Expression = "match_recipient('.*@foo.example.com')",
            Actions = new[]
            {
                "forward('http://example.com/api/v1/foos/')",
                "stop()",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.mailgun.Route;
    import com.pulumi.mailgun.RouteArgs;
    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) {
            // Create a new Mailgun route
            var default_ = new Route("default", RouteArgs.builder()
                .priority("0")
                .description("inbound")
                .expression("match_recipient('.*@foo.example.com')")
                .actions(            
                    "forward('http://example.com/api/v1/foos/')",
                    "stop()")
                .build());
    
        }
    }
    
    resources:
      # Create a new Mailgun route
      default:
        type: mailgun:Route
        properties:
          priority: '0'
          description: inbound
          expression: match_recipient('.*@foo.example.com')
          actions:
            - forward('http://example.com/api/v1/foos/')
            - stop()
    

    Create Route Resource

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

    Constructor syntax

    new Route(name: string, args: RouteArgs, opts?: CustomResourceOptions);
    @overload
    def Route(resource_name: str,
              args: RouteArgs,
              opts: Optional[ResourceOptions] = None)
    
    @overload
    def Route(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              actions: Optional[Sequence[str]] = None,
              expression: Optional[str] = None,
              priority: Optional[int] = None,
              description: Optional[str] = None,
              region: Optional[str] = None)
    func NewRoute(ctx *Context, name string, args RouteArgs, opts ...ResourceOption) (*Route, error)
    public Route(string name, RouteArgs args, CustomResourceOptions? opts = null)
    public Route(String name, RouteArgs args)
    public Route(String name, RouteArgs args, CustomResourceOptions options)
    
    type: mailgun:Route
    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 RouteArgs
    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 RouteArgs
    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 RouteArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RouteArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RouteArgs
    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 routeResource = new Mailgun.Route("routeResource", new()
    {
        Actions = new[]
        {
            "string",
        },
        Expression = "string",
        Priority = 0,
        Description = "string",
        Region = "string",
    });
    
    example, err := mailgun.NewRoute(ctx, "routeResource", &mailgun.RouteArgs{
    	Actions: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Expression:  pulumi.String("string"),
    	Priority:    pulumi.Int(0),
    	Description: pulumi.String("string"),
    	Region:      pulumi.String("string"),
    })
    
    var routeResource = new Route("routeResource", RouteArgs.builder()
        .actions("string")
        .expression("string")
        .priority(0)
        .description("string")
        .region("string")
        .build());
    
    route_resource = mailgun.Route("routeResource",
        actions=["string"],
        expression="string",
        priority=0,
        description="string",
        region="string")
    
    const routeResource = new mailgun.Route("routeResource", {
        actions: ["string"],
        expression: "string",
        priority: 0,
        description: "string",
        region: "string",
    });
    
    type: mailgun:Route
    properties:
        actions:
            - string
        description: string
        expression: string
        priority: 0
        region: string
    

    Route 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 Route resource accepts the following input properties:

    Actions List<string>
    Expression string
    A filter expression like match_recipient('.*@gmail.com')
    Priority int
    Smaller number indicates higher priority. Higher priority routes are handled first.
    Description string
    Region string
    The region where domain will be created. Default value is us.
    Actions []string
    Expression string
    A filter expression like match_recipient('.*@gmail.com')
    Priority int
    Smaller number indicates higher priority. Higher priority routes are handled first.
    Description string
    Region string
    The region where domain will be created. Default value is us.
    actions List<String>
    expression String
    A filter expression like match_recipient('.*@gmail.com')
    priority Integer
    Smaller number indicates higher priority. Higher priority routes are handled first.
    description String
    region String
    The region where domain will be created. Default value is us.
    actions string[]
    expression string
    A filter expression like match_recipient('.*@gmail.com')
    priority number
    Smaller number indicates higher priority. Higher priority routes are handled first.
    description string
    region string
    The region where domain will be created. Default value is us.
    actions Sequence[str]
    expression str
    A filter expression like match_recipient('.*@gmail.com')
    priority int
    Smaller number indicates higher priority. Higher priority routes are handled first.
    description str
    region str
    The region where domain will be created. Default value is us.
    actions List<String>
    expression String
    A filter expression like match_recipient('.*@gmail.com')
    priority Number
    Smaller number indicates higher priority. Higher priority routes are handled first.
    description String
    region String
    The region where domain will be created. Default value is us.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Route 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 Route Resource

    Get an existing Route 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?: RouteState, opts?: CustomResourceOptions): Route
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            actions: Optional[Sequence[str]] = None,
            description: Optional[str] = None,
            expression: Optional[str] = None,
            priority: Optional[int] = None,
            region: Optional[str] = None) -> Route
    func GetRoute(ctx *Context, name string, id IDInput, state *RouteState, opts ...ResourceOption) (*Route, error)
    public static Route Get(string name, Input<string> id, RouteState? state, CustomResourceOptions? opts = null)
    public static Route get(String name, Output<String> id, RouteState 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:
    Actions List<string>
    Description string
    Expression string
    A filter expression like match_recipient('.*@gmail.com')
    Priority int
    Smaller number indicates higher priority. Higher priority routes are handled first.
    Region string
    The region where domain will be created. Default value is us.
    Actions []string
    Description string
    Expression string
    A filter expression like match_recipient('.*@gmail.com')
    Priority int
    Smaller number indicates higher priority. Higher priority routes are handled first.
    Region string
    The region where domain will be created. Default value is us.
    actions List<String>
    description String
    expression String
    A filter expression like match_recipient('.*@gmail.com')
    priority Integer
    Smaller number indicates higher priority. Higher priority routes are handled first.
    region String
    The region where domain will be created. Default value is us.
    actions string[]
    description string
    expression string
    A filter expression like match_recipient('.*@gmail.com')
    priority number
    Smaller number indicates higher priority. Higher priority routes are handled first.
    region string
    The region where domain will be created. Default value is us.
    actions Sequence[str]
    description str
    expression str
    A filter expression like match_recipient('.*@gmail.com')
    priority int
    Smaller number indicates higher priority. Higher priority routes are handled first.
    region str
    The region where domain will be created. Default value is us.
    actions List<String>
    description String
    expression String
    A filter expression like match_recipient('.*@gmail.com')
    priority Number
    Smaller number indicates higher priority. Higher priority routes are handled first.
    region String
    The region where domain will be created. Default value is us.

    Import

    Routes can be imported using ROUTE_ID and region via import command. Route ID can be found on Mailgun portal in section Receiving/Routes. Region has to be chosen from eu or us (when no selection us is applied).

    hcl

    $ pulumi import mailgun:index/route:Route test eu:123456789
    

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

    Package Details

    Repository
    Mailgun pulumi/pulumi-mailgun
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the mailgun Terraform Provider.
    mailgun logo
    Mailgun v3.5.4 published on Tuesday, Jul 2, 2024 by Pulumi