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

grafana.FolderPermissionItem

Explore with Pulumi AI

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

    Manages a single permission item for a folder. Conflicts with the “grafana.FolderPermission” resource which manages the entire set of permissions for a folder. * Official documentation * HTTP API

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as grafana from "@pulumiverse/grafana";
    
    const team = new grafana.Team("team", {});
    const user = new grafana.User("user", {
        email: "user.name@example.com",
        login: "user.name",
        password: "my-password",
    });
    const collection = new grafana.Folder("collection", {title: "Folder Title"});
    const onRole = new grafana.FolderPermissionItem("onRole", {
        folderUid: collection.uid,
        role: "Viewer",
        permission: "Edit",
    });
    const onTeam = new grafana.FolderPermissionItem("onTeam", {
        folderUid: collection.uid,
        team: team.id,
        permission: "View",
    });
    const onUser = new grafana.FolderPermissionItem("onUser", {
        folderUid: collection.uid,
        user: user.id,
        permission: "Admin",
    });
    
    import pulumi
    import pulumiverse_grafana as grafana
    
    team = grafana.Team("team")
    user = grafana.User("user",
        email="user.name@example.com",
        login="user.name",
        password="my-password")
    collection = grafana.Folder("collection", title="Folder Title")
    on_role = grafana.FolderPermissionItem("onRole",
        folder_uid=collection.uid,
        role="Viewer",
        permission="Edit")
    on_team = grafana.FolderPermissionItem("onTeam",
        folder_uid=collection.uid,
        team=team.id,
        permission="View")
    on_user = grafana.FolderPermissionItem("onUser",
        folder_uid=collection.uid,
        user=user.id,
        permission="Admin")
    
    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 {
    		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"),
    			Login:    pulumi.String("user.name"),
    			Password: pulumi.String("my-password"),
    		})
    		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.NewFolderPermissionItem(ctx, "onRole", &grafana.FolderPermissionItemArgs{
    			FolderUid:  collection.Uid,
    			Role:       pulumi.String("Viewer"),
    			Permission: pulumi.String("Edit"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = grafana.NewFolderPermissionItem(ctx, "onTeam", &grafana.FolderPermissionItemArgs{
    			FolderUid:  collection.Uid,
    			Team:       team.ID(),
    			Permission: pulumi.String("View"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = grafana.NewFolderPermissionItem(ctx, "onUser", &grafana.FolderPermissionItemArgs{
    			FolderUid:  collection.Uid,
    			User:       user.ID(),
    			Permission: pulumi.String("Admin"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Grafana = Pulumiverse.Grafana;
    
    return await Deployment.RunAsync(() => 
    {
        var team = new Grafana.Team("team");
    
        var user = new Grafana.User("user", new()
        {
            Email = "user.name@example.com",
            Login = "user.name",
            Password = "my-password",
        });
    
        var collection = new Grafana.Folder("collection", new()
        {
            Title = "Folder Title",
        });
    
        var onRole = new Grafana.FolderPermissionItem("onRole", new()
        {
            FolderUid = collection.Uid,
            Role = "Viewer",
            Permission = "Edit",
        });
    
        var onTeam = new Grafana.FolderPermissionItem("onTeam", new()
        {
            FolderUid = collection.Uid,
            Team = team.Id,
            Permission = "View",
        });
    
        var onUser = new Grafana.FolderPermissionItem("onUser", new()
        {
            FolderUid = collection.Uid,
            User = user.Id,
            Permission = "Admin",
        });
    
    });
    
    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.FolderPermissionItem;
    import com.pulumi.grafana.FolderPermissionItemArgs;
    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")
                .login("user.name")
                .password("my-password")
                .build());
    
            var collection = new Folder("collection", FolderArgs.builder()        
                .title("Folder Title")
                .build());
    
            var onRole = new FolderPermissionItem("onRole", FolderPermissionItemArgs.builder()        
                .folderUid(collection.uid())
                .role("Viewer")
                .permission("Edit")
                .build());
    
            var onTeam = new FolderPermissionItem("onTeam", FolderPermissionItemArgs.builder()        
                .folderUid(collection.uid())
                .team(team.id())
                .permission("View")
                .build());
    
            var onUser = new FolderPermissionItem("onUser", FolderPermissionItemArgs.builder()        
                .folderUid(collection.uid())
                .user(user.id())
                .permission("Admin")
                .build());
    
        }
    }
    
    resources:
      team:
        type: grafana:Team
      user:
        type: grafana:User
        properties:
          email: user.name@example.com
          login: user.name
          password: my-password
      collection:
        type: grafana:Folder
        properties:
          title: Folder Title
      onRole:
        type: grafana:FolderPermissionItem
        properties:
          folderUid: ${collection.uid}
          role: Viewer
          permission: Edit
      onTeam:
        type: grafana:FolderPermissionItem
        properties:
          folderUid: ${collection.uid}
          team: ${team.id}
          permission: View
      onUser:
        type: grafana:FolderPermissionItem
        properties:
          folderUid: ${collection.uid}
          user: ${user.id}
          permission: Admin
    

    Create FolderPermissionItem Resource

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

    Constructor syntax

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

    Example

    The following reference example uses placeholder values for all input properties.

    var folderPermissionItemResource = new Grafana.FolderPermissionItem("folderPermissionItemResource", new()
    {
        FolderUid = "string",
        Permission = "string",
        OrgId = "string",
        Role = "string",
        Team = "string",
        User = "string",
    });
    
    example, err := grafana.NewFolderPermissionItem(ctx, "folderPermissionItemResource", &grafana.FolderPermissionItemArgs{
    	FolderUid:  pulumi.String("string"),
    	Permission: pulumi.String("string"),
    	OrgId:      pulumi.String("string"),
    	Role:       pulumi.String("string"),
    	Team:       pulumi.String("string"),
    	User:       pulumi.String("string"),
    })
    
    var folderPermissionItemResource = new FolderPermissionItem("folderPermissionItemResource", FolderPermissionItemArgs.builder()
        .folderUid("string")
        .permission("string")
        .orgId("string")
        .role("string")
        .team("string")
        .user("string")
        .build());
    
    folder_permission_item_resource = grafana.FolderPermissionItem("folderPermissionItemResource",
        folder_uid="string",
        permission="string",
        org_id="string",
        role="string",
        team="string",
        user="string")
    
    const folderPermissionItemResource = new grafana.FolderPermissionItem("folderPermissionItemResource", {
        folderUid: "string",
        permission: "string",
        orgId: "string",
        role: "string",
        team: "string",
        user: "string",
    });
    
    type: grafana:FolderPermissionItem
    properties:
        folderUid: string
        orgId: string
        permission: string
        role: string
        team: string
        user: string
    

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

    FolderUid string
    The UID of the folder.
    Permission string
    the permission to be assigned
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    Role string
    the role onto which the permission is to be assigned
    Team string
    the team onto which the permission is to be assigned
    User string
    the user or service account onto which the permission is to be assigned
    FolderUid string
    The UID of the folder.
    Permission string
    the permission to be assigned
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    Role string
    the role onto which the permission is to be assigned
    Team string
    the team onto which the permission is to be assigned
    User string
    the user or service account onto which the permission is to be assigned
    folderUid String
    The UID of the folder.
    permission String
    the permission to be assigned
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    role String
    the role onto which the permission is to be assigned
    team String
    the team onto which the permission is to be assigned
    user String
    the user or service account onto which the permission is to be assigned
    folderUid string
    The UID of the folder.
    permission string
    the permission to be assigned
    orgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    role string
    the role onto which the permission is to be assigned
    team string
    the team onto which the permission is to be assigned
    user string
    the user or service account onto which the permission is to be assigned
    folder_uid str
    The UID of the folder.
    permission str
    the permission to be assigned
    org_id str
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    role str
    the role onto which the permission is to be assigned
    team str
    the team onto which the permission is to be assigned
    user str
    the user or service account onto which the permission is to be assigned
    folderUid String
    The UID of the folder.
    permission String
    the permission to be assigned
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    role String
    the role onto which the permission is to be assigned
    team String
    the team onto which the permission is to be assigned
    user String
    the user or service account onto which the permission is to be assigned

    Outputs

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

    Get an existing FolderPermissionItem 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?: FolderPermissionItemState, opts?: CustomResourceOptions): FolderPermissionItem
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            folder_uid: Optional[str] = None,
            org_id: Optional[str] = None,
            permission: Optional[str] = None,
            role: Optional[str] = None,
            team: Optional[str] = None,
            user: Optional[str] = None) -> FolderPermissionItem
    func GetFolderPermissionItem(ctx *Context, name string, id IDInput, state *FolderPermissionItemState, opts ...ResourceOption) (*FolderPermissionItem, error)
    public static FolderPermissionItem Get(string name, Input<string> id, FolderPermissionItemState? state, CustomResourceOptions? opts = null)
    public static FolderPermissionItem get(String name, Output<String> id, FolderPermissionItemState 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.
    Permission string
    the permission to be assigned
    Role string
    the role onto which the permission is to be assigned
    Team string
    the team onto which the permission is to be assigned
    User string
    the user or service account onto which the permission is to be assigned
    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.
    Permission string
    the permission to be assigned
    Role string
    the role onto which the permission is to be assigned
    Team string
    the team onto which the permission is to be assigned
    User string
    the user or service account onto which the permission is to be assigned
    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.
    permission String
    the permission to be assigned
    role String
    the role onto which the permission is to be assigned
    team String
    the team onto which the permission is to be assigned
    user String
    the user or service account onto which the permission is to be assigned
    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.
    permission string
    the permission to be assigned
    role string
    the role onto which the permission is to be assigned
    team string
    the team onto which the permission is to be assigned
    user string
    the user or service account onto which the permission is to be assigned
    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.
    permission str
    the permission to be assigned
    role str
    the role onto which the permission is to be assigned
    team str
    the team onto which the permission is to be assigned
    user str
    the user or service account onto which the permission is to be assigned
    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.
    permission String
    the permission to be assigned
    role String
    the role onto which the permission is to be assigned
    team String
    the team onto which the permission is to be assigned
    user String
    the user or service account onto which the permission is to be assigned

    Import

    $ pulumi import grafana:index/folderPermissionItem:FolderPermissionItem name "{{ folderUID }}:{{ type (role, team, or user) }}:{{ identifier }}"
    
    $ pulumi import grafana:index/folderPermissionItem:FolderPermissionItem name "{{ orgID }}:{{ folderUID }}:{{ type (role, team, or user) }}:{{ identifier }}"
    

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

    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