1. Packages
  2. Grafana Cloud
  3. API Docs
  4. FolderPermission
Grafana v0.1.0 published on Monday, Sep 11, 2023 by lbrlabs

grafana.FolderPermission

Explore with Pulumi AI

grafana logo
Grafana v0.1.0 published on Monday, Sep 11, 2023 by lbrlabs

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Grafana = Lbrlabs.PulumiPackage.Grafana;
    
    return await Deployment.RunAsync(() => 
    {
        var team = new Grafana.Team("team");
    
        var user = new Grafana.User("user", new()
        {
            Email = "user.name@example.com",
        });
    
        var collection = new Grafana.Folder("collection", new()
        {
            Title = "Folder Title",
        });
    
        var collectionPermission = new Grafana.FolderPermission("collectionPermission", new()
        {
            FolderUid = collection.Uid,
            Permissions = new[]
            {
                new Grafana.Inputs.FolderPermissionPermissionArgs
                {
                    Role = "Editor",
                    Permission = "Edit",
                },
                new Grafana.Inputs.FolderPermissionPermissionArgs
                {
                    TeamId = team.Id,
                    Permission = "View",
                },
                new Grafana.Inputs.FolderPermissionPermissionArgs
                {
                    UserId = user.Id,
                    Permission = "Admin",
                },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/lbrlabs/pulumi-grafana/sdk/go/grafana"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		team, err := grafana.NewTeam(ctx, "team", nil)
    		if err != nil {
    			return err
    		}
    		user, err := grafana.NewUser(ctx, "user", &grafana.UserArgs{
    			Email: pulumi.String("user.name@example.com"),
    		})
    		if err != nil {
    			return err
    		}
    		collection, err := grafana.NewFolder(ctx, "collection", &grafana.FolderArgs{
    			Title: pulumi.String("Folder Title"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = grafana.NewFolderPermission(ctx, "collectionPermission", &grafana.FolderPermissionArgs{
    			FolderUid: collection.Uid,
    			Permissions: grafana.FolderPermissionPermissionArray{
    				&grafana.FolderPermissionPermissionArgs{
    					Role:       pulumi.String("Editor"),
    					Permission: pulumi.String("Edit"),
    				},
    				&grafana.FolderPermissionPermissionArgs{
    					TeamId:     team.ID(),
    					Permission: pulumi.String("View"),
    				},
    				&grafana.FolderPermissionPermissionArgs{
    					UserId:     user.ID(),
    					Permission: pulumi.String("Admin"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.grafana.Team;
    import com.pulumi.grafana.User;
    import com.pulumi.grafana.UserArgs;
    import com.pulumi.grafana.Folder;
    import com.pulumi.grafana.FolderArgs;
    import com.pulumi.grafana.FolderPermission;
    import com.pulumi.grafana.FolderPermissionArgs;
    import com.pulumi.grafana.inputs.FolderPermissionPermissionArgs;
    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 team = new Team("team");
    
            var user = new User("user", UserArgs.builder()        
                .email("user.name@example.com")
                .build());
    
            var collection = new Folder("collection", FolderArgs.builder()        
                .title("Folder Title")
                .build());
    
            var collectionPermission = new FolderPermission("collectionPermission", FolderPermissionArgs.builder()        
                .folderUid(collection.uid())
                .permissions(            
                    FolderPermissionPermissionArgs.builder()
                        .role("Editor")
                        .permission("Edit")
                        .build(),
                    FolderPermissionPermissionArgs.builder()
                        .teamId(team.id())
                        .permission("View")
                        .build(),
                    FolderPermissionPermissionArgs.builder()
                        .userId(user.id())
                        .permission("Admin")
                        .build())
                .build());
    
        }
    }
    
    import pulumi
    import lbrlabs_pulumi_grafana as grafana
    
    team = grafana.Team("team")
    user = grafana.User("user", email="user.name@example.com")
    collection = grafana.Folder("collection", title="Folder Title")
    collection_permission = grafana.FolderPermission("collectionPermission",
        folder_uid=collection.uid,
        permissions=[
            grafana.FolderPermissionPermissionArgs(
                role="Editor",
                permission="Edit",
            ),
            grafana.FolderPermissionPermissionArgs(
                team_id=team.id,
                permission="View",
            ),
            grafana.FolderPermissionPermissionArgs(
                user_id=user.id,
                permission="Admin",
            ),
        ])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as grafana from "@lbrlabs/pulumi-grafana";
    
    const team = new grafana.Team("team", {});
    const user = new grafana.User("user", {email: "user.name@example.com"});
    const collection = new grafana.Folder("collection", {title: "Folder Title"});
    const collectionPermission = new grafana.FolderPermission("collectionPermission", {
        folderUid: collection.uid,
        permissions: [
            {
                role: "Editor",
                permission: "Edit",
            },
            {
                teamId: team.id,
                permission: "View",
            },
            {
                userId: user.id,
                permission: "Admin",
            },
        ],
    });
    
    resources:
      team:
        type: grafana:Team
      user:
        type: grafana:User
        properties:
          email: user.name@example.com
      collection:
        type: grafana:Folder
        properties:
          title: Folder Title
      collectionPermission:
        type: grafana:FolderPermission
        properties:
          folderUid: ${collection.uid}
          permissions:
            - role: Editor
              permission: Edit
            - teamId: ${team.id}
              permission: View
            - userId: ${user.id}
              permission: Admin
    

    Create FolderPermission Resource

    new FolderPermission(name: string, args: FolderPermissionArgs, opts?: CustomResourceOptions);
    @overload
    def FolderPermission(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         folder_uid: Optional[str] = None,
                         org_id: Optional[str] = None,
                         permissions: Optional[Sequence[FolderPermissionPermissionArgs]] = None)
    @overload
    def FolderPermission(resource_name: str,
                         args: FolderPermissionArgs,
                         opts: Optional[ResourceOptions] = None)
    func NewFolderPermission(ctx *Context, name string, args FolderPermissionArgs, opts ...ResourceOption) (*FolderPermission, error)
    public FolderPermission(string name, FolderPermissionArgs args, CustomResourceOptions? opts = null)
    public FolderPermission(String name, FolderPermissionArgs args)
    public FolderPermission(String name, FolderPermissionArgs args, CustomResourceOptions options)
    
    type: grafana:FolderPermission
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args FolderPermissionArgs
    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 FolderPermissionArgs
    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 FolderPermissionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args FolderPermissionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args FolderPermissionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    FolderUid string

    The UID of the folder.

    Permissions List<Lbrlabs.PulumiPackage.Grafana.Inputs.FolderPermissionPermission>

    The permission items to add/update. Items that are omitted from the list will be removed.

    OrgId string

    The Organization ID. If not set, the Org ID defined in the provider block will be used.

    FolderUid string

    The UID of the folder.

    Permissions []FolderPermissionPermissionArgs

    The permission items to add/update. Items that are omitted from the list will be removed.

    OrgId string

    The Organization ID. If not set, the Org ID defined in the provider block will be used.

    folderUid String

    The UID of the folder.

    permissions List<FolderPermissionPermission>

    The permission items to add/update. Items that are omitted from the list will be removed.

    orgId String

    The Organization ID. If not set, the Org ID defined in the provider block will be used.

    folderUid string

    The UID of the folder.

    permissions FolderPermissionPermission[]

    The permission items to add/update. Items that are omitted from the list will be removed.

    orgId string

    The Organization ID. If not set, the Org ID defined in the provider block will be used.

    folder_uid str

    The UID of the folder.

    permissions Sequence[FolderPermissionPermissionArgs]

    The permission items to add/update. Items that are omitted from the list will be removed.

    org_id str

    The Organization ID. If not set, the Org ID defined in the provider block will be used.

    folderUid String

    The UID of the folder.

    permissions List<Property Map>

    The permission items to add/update. Items that are omitted from the list will be removed.

    orgId String

    The Organization ID. If not set, the Org ID defined in the provider block will be used.

    Outputs

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

    Get an existing FolderPermission 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?: FolderPermissionState, opts?: CustomResourceOptions): FolderPermission
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            folder_uid: Optional[str] = None,
            org_id: Optional[str] = None,
            permissions: Optional[Sequence[FolderPermissionPermissionArgs]] = None) -> FolderPermission
    func GetFolderPermission(ctx *Context, name string, id IDInput, state *FolderPermissionState, opts ...ResourceOption) (*FolderPermission, error)
    public static FolderPermission Get(string name, Input<string> id, FolderPermissionState? state, CustomResourceOptions? opts = null)
    public static FolderPermission get(String name, Output<String> id, FolderPermissionState 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:
    FolderUid string

    The UID of the folder.

    OrgId string

    The Organization ID. If not set, the Org ID defined in the provider block will be used.

    Permissions List<Lbrlabs.PulumiPackage.Grafana.Inputs.FolderPermissionPermission>

    The permission items to add/update. Items that are omitted from the list will be removed.

    FolderUid string

    The UID of the folder.

    OrgId string

    The Organization ID. If not set, the Org ID defined in the provider block will be used.

    Permissions []FolderPermissionPermissionArgs

    The permission items to add/update. Items that are omitted from the list will be removed.

    folderUid String

    The UID of the folder.

    orgId String

    The Organization ID. If not set, the Org ID defined in the provider block will be used.

    permissions List<FolderPermissionPermission>

    The permission items to add/update. Items that are omitted from the list will be removed.

    folderUid string

    The UID of the folder.

    orgId string

    The Organization ID. If not set, the Org ID defined in the provider block will be used.

    permissions FolderPermissionPermission[]

    The permission items to add/update. Items that are omitted from the list will be removed.

    folder_uid str

    The UID of the folder.

    org_id str

    The Organization ID. If not set, the Org ID defined in the provider block will be used.

    permissions Sequence[FolderPermissionPermissionArgs]

    The permission items to add/update. Items that are omitted from the list will be removed.

    folderUid String

    The UID of the folder.

    orgId String

    The Organization ID. If not set, the Org ID defined in the provider block will be used.

    permissions List<Property Map>

    The permission items to add/update. Items that are omitted from the list will be removed.

    Supporting Types

    FolderPermissionPermission, FolderPermissionPermissionArgs

    Permission string

    Permission to associate with item. Must be one of View, Edit, or Admin.

    Role string

    Manage permissions for Viewer or Editor roles.

    TeamId string

    ID of the team to manage permissions for. Defaults to 0.

    UserId int

    ID of the user to manage permissions for. Defaults to 0.

    Permission string

    Permission to associate with item. Must be one of View, Edit, or Admin.

    Role string

    Manage permissions for Viewer or Editor roles.

    TeamId string

    ID of the team to manage permissions for. Defaults to 0.

    UserId int

    ID of the user to manage permissions for. Defaults to 0.

    permission String

    Permission to associate with item. Must be one of View, Edit, or Admin.

    role String

    Manage permissions for Viewer or Editor roles.

    teamId String

    ID of the team to manage permissions for. Defaults to 0.

    userId Integer

    ID of the user to manage permissions for. Defaults to 0.

    permission string

    Permission to associate with item. Must be one of View, Edit, or Admin.

    role string

    Manage permissions for Viewer or Editor roles.

    teamId string

    ID of the team to manage permissions for. Defaults to 0.

    userId number

    ID of the user to manage permissions for. Defaults to 0.

    permission str

    Permission to associate with item. Must be one of View, Edit, or Admin.

    role str

    Manage permissions for Viewer or Editor roles.

    team_id str

    ID of the team to manage permissions for. Defaults to 0.

    user_id int

    ID of the user to manage permissions for. Defaults to 0.

    permission String

    Permission to associate with item. Must be one of View, Edit, or Admin.

    role String

    Manage permissions for Viewer or Editor roles.

    teamId String

    ID of the team to manage permissions for. Defaults to 0.

    userId Number

    ID of the user to manage permissions for. Defaults to 0.

    Package Details

    Repository
    grafana lbrlabs/pulumi-grafana
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the grafana Terraform Provider.

    grafana logo
    Grafana v0.1.0 published on Monday, Sep 11, 2023 by lbrlabs