@pulumiverse/grafana
Version:
A Pulumi package for creating and managing grafana.
112 lines • 5.09 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** 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/developers/http_api/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
* $ pulumi import grafana:oss/folderPermissionItem:FolderPermissionItem name "{{ folderUID }}:{{ type (role, team, or user) }}:{{ identifier }}"
* ```
*
* ```sh
* $ pulumi import grafana:oss/folderPermissionItem:FolderPermissionItem 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, Object.assign(Object.assign({}, 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 ? state.folderUid : undefined;
resourceInputs["orgId"] = state ? state.orgId : undefined;
resourceInputs["permission"] = state ? state.permission : undefined;
resourceInputs["role"] = state ? state.role : undefined;
resourceInputs["team"] = state ? state.team : undefined;
resourceInputs["user"] = state ? state.user : undefined;
}
else {
const args = argsOrState;
if ((!args || args.folderUid === undefined) && !opts.urn) {
throw new Error("Missing required property 'folderUid'");
}
if ((!args || args.permission === undefined) && !opts.urn) {
throw new Error("Missing required property 'permission'");
}
resourceInputs["folderUid"] = args ? args.folderUid : undefined;
resourceInputs["orgId"] = args ? args.orgId : undefined;
resourceInputs["permission"] = args ? args.permission : undefined;
resourceInputs["role"] = args ? args.role : undefined;
resourceInputs["team"] = args ? args.team : undefined;
resourceInputs["user"] = args ? args.user : undefined;
}
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