UNPKG

@pulumiverse/grafana

Version:

A Pulumi package for creating and managing grafana.

109 lines 4.77 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.FolderPermissionItem = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages a single permission item for a folder. Conflicts with the "grafana.oss.FolderPermission" resource which manages the entire set of permissions for a folder. * * [Official documentation](https://grafana.com/docs/grafana/latest/administration/roles-and-permissions/access-control/) * * [HTTP API](https://grafana.com/docs/grafana/latest/developer-resources/api-reference/http-api/api-legacy/folder_permissions/) * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as grafana from "@pulumiverse/grafana"; * * const team = new grafana.oss.Team("team", {name: "Team Name"}); * const user = new grafana.oss.User("user", { * email: "user.name@example.com", * login: "user.name", * password: "my-password", * }); * const collection = new grafana.oss.Folder("collection", {title: "Folder Title"}); * const onRole = new grafana.oss.FolderPermissionItem("on_role", { * folderUid: collection.uid, * role: "Viewer", * permission: "Edit", * }); * const onTeam = new grafana.oss.FolderPermissionItem("on_team", { * folderUid: collection.uid, * team: team.id, * permission: "View", * }); * const onUser = new grafana.oss.FolderPermissionItem("on_user", { * folderUid: collection.uid, * user: user.id, * permission: "Admin", * }); * ``` * * ## Import * * ```sh * terraform import grafana_folder_permission_item.name "{{ folderUID }}:{{ type (role, team, or user) }}:{{ identifier }}" * terraform import grafana_folder_permission_item.name "{{ orgID }}:{{ folderUID }}:{{ type (role, team, or user) }}:{{ identifier }}" * ``` */ class FolderPermissionItem extends pulumi.CustomResource { /** * Get an existing FolderPermissionItem resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new FolderPermissionItem(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of FolderPermissionItem. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === FolderPermissionItem.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["folderUid"] = state?.folderUid; resourceInputs["orgId"] = state?.orgId; resourceInputs["permission"] = state?.permission; resourceInputs["role"] = state?.role; resourceInputs["team"] = state?.team; resourceInputs["user"] = state?.user; } else { const args = argsOrState; if (args?.folderUid === undefined && !opts.urn) { throw new Error("Missing required property 'folderUid'"); } if (args?.permission === undefined && !opts.urn) { throw new Error("Missing required property 'permission'"); } resourceInputs["folderUid"] = args?.folderUid; resourceInputs["orgId"] = args?.orgId; resourceInputs["permission"] = args?.permission; resourceInputs["role"] = args?.role; resourceInputs["team"] = args?.team; resourceInputs["user"] = args?.user; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const aliasOpts = { aliases: [{ type: "grafana:index/folderPermissionItem:FolderPermissionItem" }] }; opts = pulumi.mergeOptions(opts, aliasOpts); super(FolderPermissionItem.__pulumiType, name, resourceInputs, opts); } } exports.FolderPermissionItem = FolderPermissionItem; /** @internal */ FolderPermissionItem.__pulumiType = 'grafana:oss/folderPermissionItem:FolderPermissionItem'; //# sourceMappingURL=folderPermissionItem.js.map