1. Packages
  2. Grafana Cloud
  3. API Docs
  4. getRole
Grafana v0.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse

grafana.getRole

Explore with Pulumi AI

grafana logo
Grafana v0.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse

    Note: This resource is available only with Grafana Enterprise 8.+.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as grafana from "@pulumi/grafana";
    import * as grafana from "@pulumiverse/grafana";
    
    const test = new grafana.Role("test", {
        description: "test-role description",
        uid: "test-ds-role-uid",
        version: 1,
        global: true,
        hidden: false,
        permissions: [
            {
                action: "org.users:add",
                scope: "users:*",
            },
            {
                action: "org.users:write",
                scope: "users:*",
            },
            {
                action: "org.users:read",
                scope: "users:*",
            },
        ],
    });
    const fromName = grafana.getRoleOutput({
        name: test.name,
    });
    
    import pulumi
    import pulumi_grafana as grafana
    import pulumiverse_grafana as grafana
    
    test = grafana.Role("test",
        description="test-role description",
        uid="test-ds-role-uid",
        version=1,
        global_=True,
        hidden=False,
        permissions=[
            grafana.RolePermissionArgs(
                action="org.users:add",
                scope="users:*",
            ),
            grafana.RolePermissionArgs(
                action="org.users:write",
                scope="users:*",
            ),
            grafana.RolePermissionArgs(
                action="org.users:read",
                scope="users:*",
            ),
        ])
    from_name = grafana.get_role_output(name=test.name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-grafana/sdk/go/grafana"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		test, err := grafana.NewRole(ctx, "test", &grafana.RoleArgs{
    			Description: pulumi.String("test-role description"),
    			Uid:         pulumi.String("test-ds-role-uid"),
    			Version:     pulumi.Int(1),
    			Global:      pulumi.Bool(true),
    			Hidden:      pulumi.Bool(false),
    			Permissions: grafana.RolePermissionArray{
    				&grafana.RolePermissionArgs{
    					Action: pulumi.String("org.users:add"),
    					Scope:  pulumi.String("users:*"),
    				},
    				&grafana.RolePermissionArgs{
    					Action: pulumi.String("org.users:write"),
    					Scope:  pulumi.String("users:*"),
    				},
    				&grafana.RolePermissionArgs{
    					Action: pulumi.String("org.users:read"),
    					Scope:  pulumi.String("users:*"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_ = grafana.LookupRoleOutput(ctx, grafana.GetRoleOutputArgs{
    			Name: test.Name,
    		}, nil)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Grafana = Pulumi.Grafana;
    using Grafana = Pulumiverse.Grafana;
    
    return await Deployment.RunAsync(() => 
    {
        var test = new Grafana.Role("test", new()
        {
            Description = "test-role description",
            Uid = "test-ds-role-uid",
            Version = 1,
            Global = true,
            Hidden = false,
            Permissions = new[]
            {
                new Grafana.Inputs.RolePermissionArgs
                {
                    Action = "org.users:add",
                    Scope = "users:*",
                },
                new Grafana.Inputs.RolePermissionArgs
                {
                    Action = "org.users:write",
                    Scope = "users:*",
                },
                new Grafana.Inputs.RolePermissionArgs
                {
                    Action = "org.users:read",
                    Scope = "users:*",
                },
            },
        });
    
        var fromName = Grafana.GetRole.Invoke(new()
        {
            Name = test.Name,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.grafana.Role;
    import com.pulumi.grafana.RoleArgs;
    import com.pulumi.grafana.inputs.RolePermissionArgs;
    import com.pulumi.grafana.GrafanaFunctions;
    import com.pulumi.grafana.inputs.GetRoleArgs;
    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 Role("test", RoleArgs.builder()        
                .description("test-role description")
                .uid("test-ds-role-uid")
                .version(1)
                .global(true)
                .hidden(false)
                .permissions(            
                    RolePermissionArgs.builder()
                        .action("org.users:add")
                        .scope("users:*")
                        .build(),
                    RolePermissionArgs.builder()
                        .action("org.users:write")
                        .scope("users:*")
                        .build(),
                    RolePermissionArgs.builder()
                        .action("org.users:read")
                        .scope("users:*")
                        .build())
                .build());
    
            final var fromName = GrafanaFunctions.getRole(GetRoleArgs.builder()
                .name(test.name())
                .build());
    
        }
    }
    
    resources:
      test:
        type: grafana:Role
        properties:
          description: test-role description
          uid: test-ds-role-uid
          version: 1
          global: true
          hidden: false
          permissions:
            - action: org.users:add
              scope: users:*
            - action: org.users:write
              scope: users:*
            - action: org.users:read
              scope: users:*
    variables:
      fromName:
        fn::invoke:
          Function: grafana:getRole
          Arguments:
            name: ${test.name}
    

    Using getRole

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getRole(args: GetRoleArgs, opts?: InvokeOptions): Promise<GetRoleResult>
    function getRoleOutput(args: GetRoleOutputArgs, opts?: InvokeOptions): Output<GetRoleResult>
    def get_role(name: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetRoleResult
    def get_role_output(name: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetRoleResult]
    func LookupRole(ctx *Context, args *LookupRoleArgs, opts ...InvokeOption) (*LookupRoleResult, error)
    func LookupRoleOutput(ctx *Context, args *LookupRoleOutputArgs, opts ...InvokeOption) LookupRoleResultOutput

    > Note: This function is named LookupRole in the Go SDK.

    public static class GetRole 
    {
        public static Task<GetRoleResult> InvokeAsync(GetRoleArgs args, InvokeOptions? opts = null)
        public static Output<GetRoleResult> Invoke(GetRoleInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetRoleResult> getRole(GetRoleArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: grafana:index/getRole:getRole
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Name of the role
    Name string
    Name of the role
    name String
    Name of the role
    name string
    Name of the role
    name str
    Name of the role
    name String
    Name of the role

    getRole Result

    The following output properties are available:

    Description string
    Description of the role.
    DisplayName string
    Display name of the role. Available with Grafana 8.5+.
    Global bool
    Boolean to state whether the role is available across all organizations or not.
    Group string
    Group of the role. Available with Grafana 8.5+.
    Hidden bool
    Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Name of the role
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    Permissions List<Pulumiverse.Grafana.Outputs.GetRolePermission>
    Specific set of actions granted by the role.
    Uid string
    Unique identifier of the role. Used for assignments.
    Version int
    Version of the role. A role is updated only on version increase. This field or auto_increment_version should be set.
    Description string
    Description of the role.
    DisplayName string
    Display name of the role. Available with Grafana 8.5+.
    Global bool
    Boolean to state whether the role is available across all organizations or not.
    Group string
    Group of the role. Available with Grafana 8.5+.
    Hidden bool
    Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Name of the role
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    Permissions []GetRolePermission
    Specific set of actions granted by the role.
    Uid string
    Unique identifier of the role. Used for assignments.
    Version int
    Version of the role. A role is updated only on version increase. This field or auto_increment_version should be set.
    description String
    Description of the role.
    displayName String
    Display name of the role. Available with Grafana 8.5+.
    global Boolean
    Boolean to state whether the role is available across all organizations or not.
    group String
    Group of the role. Available with Grafana 8.5+.
    hidden Boolean
    Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    Name of the role
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    permissions List<GetRolePermission>
    Specific set of actions granted by the role.
    uid String
    Unique identifier of the role. Used for assignments.
    version Integer
    Version of the role. A role is updated only on version increase. This field or auto_increment_version should be set.
    description string
    Description of the role.
    displayName string
    Display name of the role. Available with Grafana 8.5+.
    global boolean
    Boolean to state whether the role is available across all organizations or not.
    group string
    Group of the role. Available with Grafana 8.5+.
    hidden boolean
    Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    Name of the role
    orgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    permissions GetRolePermission[]
    Specific set of actions granted by the role.
    uid string
    Unique identifier of the role. Used for assignments.
    version number
    Version of the role. A role is updated only on version increase. This field or auto_increment_version should be set.
    description str
    Description of the role.
    display_name str
    Display name of the role. Available with Grafana 8.5+.
    global_ bool
    Boolean to state whether the role is available across all organizations or not.
    group str
    Group of the role. Available with Grafana 8.5+.
    hidden bool
    Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    Name of the role
    org_id str
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    permissions Sequence[GetRolePermission]
    Specific set of actions granted by the role.
    uid str
    Unique identifier of the role. Used for assignments.
    version int
    Version of the role. A role is updated only on version increase. This field or auto_increment_version should be set.
    description String
    Description of the role.
    displayName String
    Display name of the role. Available with Grafana 8.5+.
    global Boolean
    Boolean to state whether the role is available across all organizations or not.
    group String
    Group of the role. Available with Grafana 8.5+.
    hidden Boolean
    Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    Name of the role
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    permissions List<Property Map>
    Specific set of actions granted by the role.
    uid String
    Unique identifier of the role. Used for assignments.
    version Number
    Version of the role. A role is updated only on version increase. This field or auto_increment_version should be set.

    Supporting Types

    GetRolePermission

    Action string
    Specific action users granted with the role will be allowed to perform (for example: users:read)
    Scope string
    Scope to restrict the action to a set of resources (for example: users:* or roles:customrole1)
    Action string
    Specific action users granted with the role will be allowed to perform (for example: users:read)
    Scope string
    Scope to restrict the action to a set of resources (for example: users:* or roles:customrole1)
    action String
    Specific action users granted with the role will be allowed to perform (for example: users:read)
    scope String
    Scope to restrict the action to a set of resources (for example: users:* or roles:customrole1)
    action string
    Specific action users granted with the role will be allowed to perform (for example: users:read)
    scope string
    Scope to restrict the action to a set of resources (for example: users:* or roles:customrole1)
    action str
    Specific action users granted with the role will be allowed to perform (for example: users:read)
    scope str
    Scope to restrict the action to a set of resources (for example: users:* or roles:customrole1)
    action String
    Specific action users granted with the role will be allowed to perform (for example: users:read)
    scope String
    Scope to restrict the action to a set of resources (for example: users:* or roles:customrole1)

    Package Details

    Repository
    grafana pulumiverse/pulumi-grafana
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the grafana Terraform Provider.
    grafana logo
    Grafana v0.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse