1. Packages
  2. Nexus Provider
  3. API Docs
  4. RoutingRule
nexus 2.5.0 published on Monday, Apr 14, 2025 by datadrivers

nexus.RoutingRule

Explore with Pulumi AI

nexus logo
nexus 2.5.0 published on Monday, Apr 14, 2025 by datadrivers

    Use this resource to create a Nexus Routing Rule.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as nexus from "@pulumi/nexus";
    
    const stopLeaks = new nexus.RoutingRule("stopLeaks", {
        description: "Prevent requests of internal names",
        matchers: [
            "^/com/example/.*",
            "^/org/example/.*",
        ],
        mode: "BLOCK",
    });
    
    import pulumi
    import pulumi_nexus as nexus
    
    stop_leaks = nexus.RoutingRule("stopLeaks",
        description="Prevent requests of internal names",
        matchers=[
            "^/com/example/.*",
            "^/org/example/.*",
        ],
        mode="BLOCK")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/nexus/v2/nexus"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := nexus.NewRoutingRule(ctx, "stopLeaks", &nexus.RoutingRuleArgs{
    			Description: pulumi.String("Prevent requests of internal names"),
    			Matchers: pulumi.StringArray{
    				pulumi.String("^/com/example/.*"),
    				pulumi.String("^/org/example/.*"),
    			},
    			Mode: pulumi.String("BLOCK"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Nexus = Pulumi.Nexus;
    
    return await Deployment.RunAsync(() => 
    {
        var stopLeaks = new Nexus.RoutingRule("stopLeaks", new()
        {
            Description = "Prevent requests of internal names",
            Matchers = new[]
            {
                "^/com/example/.*",
                "^/org/example/.*",
            },
            Mode = "BLOCK",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.nexus.RoutingRule;
    import com.pulumi.nexus.RoutingRuleArgs;
    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 stopLeaks = new RoutingRule("stopLeaks", RoutingRuleArgs.builder()
                .description("Prevent requests of internal names")
                .matchers(            
                    "^/com/example/.*",
                    "^/org/example/.*")
                .mode("BLOCK")
                .build());
    
        }
    }
    
    resources:
      stopLeaks:
        type: nexus:RoutingRule
        properties:
          description: Prevent requests of internal names
          matchers:
            - ^/com/example/.*
            - ^/org/example/.*
          mode: BLOCK
    

    Create RoutingRule Resource

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

    Constructor syntax

    new RoutingRule(name: string, args: RoutingRuleArgs, opts?: CustomResourceOptions);
    @overload
    def RoutingRule(resource_name: str,
                    args: RoutingRuleArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def RoutingRule(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    matchers: Optional[Sequence[str]] = None,
                    description: Optional[str] = None,
                    mode: Optional[str] = None,
                    name: Optional[str] = None)
    func NewRoutingRule(ctx *Context, name string, args RoutingRuleArgs, opts ...ResourceOption) (*RoutingRule, error)
    public RoutingRule(string name, RoutingRuleArgs args, CustomResourceOptions? opts = null)
    public RoutingRule(String name, RoutingRuleArgs args)
    public RoutingRule(String name, RoutingRuleArgs args, CustomResourceOptions options)
    
    type: nexus:RoutingRule
    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 RoutingRuleArgs
    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 RoutingRuleArgs
    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 RoutingRuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RoutingRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RoutingRuleArgs
    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 routingRuleResource = new Nexus.RoutingRule("routingRuleResource", new()
    {
        Matchers = new[]
        {
            "string",
        },
        Description = "string",
        Mode = "string",
        Name = "string",
    });
    
    example, err := nexus.NewRoutingRule(ctx, "routingRuleResource", &nexus.RoutingRuleArgs{
    	Matchers: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Description: pulumi.String("string"),
    	Mode:        pulumi.String("string"),
    	Name:        pulumi.String("string"),
    })
    
    var routingRuleResource = new RoutingRule("routingRuleResource", RoutingRuleArgs.builder()
        .matchers("string")
        .description("string")
        .mode("string")
        .name("string")
        .build());
    
    routing_rule_resource = nexus.RoutingRule("routingRuleResource",
        matchers=["string"],
        description="string",
        mode="string",
        name="string")
    
    const routingRuleResource = new nexus.RoutingRule("routingRuleResource", {
        matchers: ["string"],
        description: "string",
        mode: "string",
        name: "string",
    });
    
    type: nexus:RoutingRule
    properties:
        description: string
        matchers:
            - string
        mode: string
        name: string
    

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

    Matchers List<string>
    Matchers is a list of regular expressions used to identify request paths that are allowed or blocked (depending on above mode)
    Description string
    The description of the routing rule
    Mode string
    The mode describe how to hande with mathing requests. Possible values: BLOCK or ALLOW Default: BLOCK
    Name string
    The name of the routing rule
    Matchers []string
    Matchers is a list of regular expressions used to identify request paths that are allowed or blocked (depending on above mode)
    Description string
    The description of the routing rule
    Mode string
    The mode describe how to hande with mathing requests. Possible values: BLOCK or ALLOW Default: BLOCK
    Name string
    The name of the routing rule
    matchers List<String>
    Matchers is a list of regular expressions used to identify request paths that are allowed or blocked (depending on above mode)
    description String
    The description of the routing rule
    mode String
    The mode describe how to hande with mathing requests. Possible values: BLOCK or ALLOW Default: BLOCK
    name String
    The name of the routing rule
    matchers string[]
    Matchers is a list of regular expressions used to identify request paths that are allowed or blocked (depending on above mode)
    description string
    The description of the routing rule
    mode string
    The mode describe how to hande with mathing requests. Possible values: BLOCK or ALLOW Default: BLOCK
    name string
    The name of the routing rule
    matchers Sequence[str]
    Matchers is a list of regular expressions used to identify request paths that are allowed or blocked (depending on above mode)
    description str
    The description of the routing rule
    mode str
    The mode describe how to hande with mathing requests. Possible values: BLOCK or ALLOW Default: BLOCK
    name str
    The name of the routing rule
    matchers List<String>
    Matchers is a list of regular expressions used to identify request paths that are allowed or blocked (depending on above mode)
    description String
    The description of the routing rule
    mode String
    The mode describe how to hande with mathing requests. Possible values: BLOCK or ALLOW Default: BLOCK
    name String
    The name of the routing rule

    Outputs

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

    Get an existing RoutingRule 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?: RoutingRuleState, opts?: CustomResourceOptions): RoutingRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            matchers: Optional[Sequence[str]] = None,
            mode: Optional[str] = None,
            name: Optional[str] = None) -> RoutingRule
    func GetRoutingRule(ctx *Context, name string, id IDInput, state *RoutingRuleState, opts ...ResourceOption) (*RoutingRule, error)
    public static RoutingRule Get(string name, Input<string> id, RoutingRuleState? state, CustomResourceOptions? opts = null)
    public static RoutingRule get(String name, Output<String> id, RoutingRuleState state, CustomResourceOptions options)
    resources:  _:    type: nexus:RoutingRule    get:      id: ${id}
    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:
    Description string
    The description of the routing rule
    Matchers List<string>
    Matchers is a list of regular expressions used to identify request paths that are allowed or blocked (depending on above mode)
    Mode string
    The mode describe how to hande with mathing requests. Possible values: BLOCK or ALLOW Default: BLOCK
    Name string
    The name of the routing rule
    Description string
    The description of the routing rule
    Matchers []string
    Matchers is a list of regular expressions used to identify request paths that are allowed or blocked (depending on above mode)
    Mode string
    The mode describe how to hande with mathing requests. Possible values: BLOCK or ALLOW Default: BLOCK
    Name string
    The name of the routing rule
    description String
    The description of the routing rule
    matchers List<String>
    Matchers is a list of regular expressions used to identify request paths that are allowed or blocked (depending on above mode)
    mode String
    The mode describe how to hande with mathing requests. Possible values: BLOCK or ALLOW Default: BLOCK
    name String
    The name of the routing rule
    description string
    The description of the routing rule
    matchers string[]
    Matchers is a list of regular expressions used to identify request paths that are allowed or blocked (depending on above mode)
    mode string
    The mode describe how to hande with mathing requests. Possible values: BLOCK or ALLOW Default: BLOCK
    name string
    The name of the routing rule
    description str
    The description of the routing rule
    matchers Sequence[str]
    Matchers is a list of regular expressions used to identify request paths that are allowed or blocked (depending on above mode)
    mode str
    The mode describe how to hande with mathing requests. Possible values: BLOCK or ALLOW Default: BLOCK
    name str
    The name of the routing rule
    description String
    The description of the routing rule
    matchers List<String>
    Matchers is a list of regular expressions used to identify request paths that are allowed or blocked (depending on above mode)
    mode String
    The mode describe how to hande with mathing requests. Possible values: BLOCK or ALLOW Default: BLOCK
    name String
    The name of the routing rule

    Import

    import using the name of routing rule

    $ pulumi import nexus:index/routingRule:RoutingRule stop_leaks stop-leaks
    

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

    Package Details

    Repository
    nexus datadrivers/terraform-provider-nexus
    License
    Notes
    This Pulumi package is based on the nexus Terraform Provider.
    nexus logo
    nexus 2.5.0 published on Monday, Apr 14, 2025 by datadrivers