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

nexus.SecurityRole

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 Role.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as nexus from "@pulumi/nexus";
    
    // Example Usage - Create a group with roles
    const nxAdmin = new nexus.SecurityRole("nxAdmin", {
        description: "Administrator role",
        privileges: ["nx-all"],
        roleid: "nx-admin",
        roles: [],
    });
    // Example Usage - Create a group with privileges
    const dockerDeploy = new nexus.SecurityRole("dockerDeploy", {
        description: "Docker deployment role",
        privileges: ["nx-repository-view-docker-*-*"],
        roleid: "docker-deploy",
    });
    
    import pulumi
    import pulumi_nexus as nexus
    
    # Example Usage - Create a group with roles
    nx_admin = nexus.SecurityRole("nxAdmin",
        description="Administrator role",
        privileges=["nx-all"],
        roleid="nx-admin",
        roles=[])
    # Example Usage - Create a group with privileges
    docker_deploy = nexus.SecurityRole("dockerDeploy",
        description="Docker deployment role",
        privileges=["nx-repository-view-docker-*-*"],
        roleid="docker-deploy")
    
    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 {
    		// Example Usage - Create a group with roles
    		_, err := nexus.NewSecurityRole(ctx, "nxAdmin", &nexus.SecurityRoleArgs{
    			Description: pulumi.String("Administrator role"),
    			Privileges: pulumi.StringArray{
    				pulumi.String("nx-all"),
    			},
    			Roleid: pulumi.String("nx-admin"),
    			Roles:  pulumi.StringArray{},
    		})
    		if err != nil {
    			return err
    		}
    		// Example Usage - Create a group with privileges
    		_, err = nexus.NewSecurityRole(ctx, "dockerDeploy", &nexus.SecurityRoleArgs{
    			Description: pulumi.String("Docker deployment role"),
    			Privileges: pulumi.StringArray{
    				pulumi.String("nx-repository-view-docker-*-*"),
    			},
    			Roleid: pulumi.String("docker-deploy"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Nexus = Pulumi.Nexus;
    
    return await Deployment.RunAsync(() => 
    {
        // Example Usage - Create a group with roles
        var nxAdmin = new Nexus.SecurityRole("nxAdmin", new()
        {
            Description = "Administrator role",
            Privileges = new[]
            {
                "nx-all",
            },
            Roleid = "nx-admin",
            Roles = new[] {},
        });
    
        // Example Usage - Create a group with privileges
        var dockerDeploy = new Nexus.SecurityRole("dockerDeploy", new()
        {
            Description = "Docker deployment role",
            Privileges = new[]
            {
                "nx-repository-view-docker-*-*",
            },
            Roleid = "docker-deploy",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.nexus.SecurityRole;
    import com.pulumi.nexus.SecurityRoleArgs;
    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) {
            // Example Usage - Create a group with roles
            var nxAdmin = new SecurityRole("nxAdmin", SecurityRoleArgs.builder()
                .description("Administrator role")
                .privileges("nx-all")
                .roleid("nx-admin")
                .roles()
                .build());
    
            // Example Usage - Create a group with privileges
            var dockerDeploy = new SecurityRole("dockerDeploy", SecurityRoleArgs.builder()
                .description("Docker deployment role")
                .privileges("nx-repository-view-docker-*-*")
                .roleid("docker-deploy")
                .build());
    
        }
    }
    
    resources:
      # Example Usage - Create a group with roles
      nxAdmin:
        type: nexus:SecurityRole
        properties:
          description: Administrator role
          privileges:
            - nx-all
          roleid: nx-admin
          roles: []
      # Example Usage - Create a group with privileges
      dockerDeploy:
        type: nexus:SecurityRole
        properties:
          description: Docker deployment role
          privileges:
            - nx-repository-view-docker-*-*
          roleid: docker-deploy
    

    Create SecurityRole Resource

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

    Constructor syntax

    new SecurityRole(name: string, args: SecurityRoleArgs, opts?: CustomResourceOptions);
    @overload
    def SecurityRole(resource_name: str,
                     args: SecurityRoleArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def SecurityRole(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     roleid: Optional[str] = None,
                     description: Optional[str] = None,
                     name: Optional[str] = None,
                     privileges: Optional[Sequence[str]] = None,
                     roles: Optional[Sequence[str]] = None)
    func NewSecurityRole(ctx *Context, name string, args SecurityRoleArgs, opts ...ResourceOption) (*SecurityRole, error)
    public SecurityRole(string name, SecurityRoleArgs args, CustomResourceOptions? opts = null)
    public SecurityRole(String name, SecurityRoleArgs args)
    public SecurityRole(String name, SecurityRoleArgs args, CustomResourceOptions options)
    
    type: nexus:SecurityRole
    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 SecurityRoleArgs
    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 SecurityRoleArgs
    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 SecurityRoleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SecurityRoleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SecurityRoleArgs
    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 securityRoleResource = new Nexus.SecurityRole("securityRoleResource", new()
    {
        Roleid = "string",
        Description = "string",
        Name = "string",
        Privileges = new[]
        {
            "string",
        },
        Roles = new[]
        {
            "string",
        },
    });
    
    example, err := nexus.NewSecurityRole(ctx, "securityRoleResource", &nexus.SecurityRoleArgs{
    	Roleid:      pulumi.String("string"),
    	Description: pulumi.String("string"),
    	Name:        pulumi.String("string"),
    	Privileges: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Roles: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var securityRoleResource = new SecurityRole("securityRoleResource", SecurityRoleArgs.builder()
        .roleid("string")
        .description("string")
        .name("string")
        .privileges("string")
        .roles("string")
        .build());
    
    security_role_resource = nexus.SecurityRole("securityRoleResource",
        roleid="string",
        description="string",
        name="string",
        privileges=["string"],
        roles=["string"])
    
    const securityRoleResource = new nexus.SecurityRole("securityRoleResource", {
        roleid: "string",
        description: "string",
        name: "string",
        privileges: ["string"],
        roles: ["string"],
    });
    
    type: nexus:SecurityRole
    properties:
        description: string
        name: string
        privileges:
            - string
        roleid: string
        roles:
            - string
    

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

    Roleid string
    The id of the role.
    Description string
    The description of this role.
    Name string
    The name of the role.
    Privileges List<string>
    The privileges of this role.
    Roles List<string>
    The roles of this role.
    Roleid string
    The id of the role.
    Description string
    The description of this role.
    Name string
    The name of the role.
    Privileges []string
    The privileges of this role.
    Roles []string
    The roles of this role.
    roleid String
    The id of the role.
    description String
    The description of this role.
    name String
    The name of the role.
    privileges List<String>
    The privileges of this role.
    roles List<String>
    The roles of this role.
    roleid string
    The id of the role.
    description string
    The description of this role.
    name string
    The name of the role.
    privileges string[]
    The privileges of this role.
    roles string[]
    The roles of this role.
    roleid str
    The id of the role.
    description str
    The description of this role.
    name str
    The name of the role.
    privileges Sequence[str]
    The privileges of this role.
    roles Sequence[str]
    The roles of this role.
    roleid String
    The id of the role.
    description String
    The description of this role.
    name String
    The name of the role.
    privileges List<String>
    The privileges of this role.
    roles List<String>
    The roles of this role.

    Outputs

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

    Get an existing SecurityRole 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?: SecurityRoleState, opts?: CustomResourceOptions): SecurityRole
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            name: Optional[str] = None,
            privileges: Optional[Sequence[str]] = None,
            roleid: Optional[str] = None,
            roles: Optional[Sequence[str]] = None) -> SecurityRole
    func GetSecurityRole(ctx *Context, name string, id IDInput, state *SecurityRoleState, opts ...ResourceOption) (*SecurityRole, error)
    public static SecurityRole Get(string name, Input<string> id, SecurityRoleState? state, CustomResourceOptions? opts = null)
    public static SecurityRole get(String name, Output<String> id, SecurityRoleState state, CustomResourceOptions options)
    resources:  _:    type: nexus:SecurityRole    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 this role.
    Name string
    The name of the role.
    Privileges List<string>
    The privileges of this role.
    Roleid string
    The id of the role.
    Roles List<string>
    The roles of this role.
    Description string
    The description of this role.
    Name string
    The name of the role.
    Privileges []string
    The privileges of this role.
    Roleid string
    The id of the role.
    Roles []string
    The roles of this role.
    description String
    The description of this role.
    name String
    The name of the role.
    privileges List<String>
    The privileges of this role.
    roleid String
    The id of the role.
    roles List<String>
    The roles of this role.
    description string
    The description of this role.
    name string
    The name of the role.
    privileges string[]
    The privileges of this role.
    roleid string
    The id of the role.
    roles string[]
    The roles of this role.
    description str
    The description of this role.
    name str
    The name of the role.
    privileges Sequence[str]
    The privileges of this role.
    roleid str
    The id of the role.
    roles Sequence[str]
    The roles of this role.
    description String
    The description of this role.
    name String
    The name of the role.
    privileges List<String>
    The privileges of this role.
    roleid String
    The id of the role.
    roles List<String>
    The roles of this role.

    Import

    import using the roleid of the security role

    $ pulumi import nexus:index/securityRole:SecurityRole nx_admin nx-admin
    

    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