UNPKG

@pulumiverse/grafana

Version:

A Pulumi package for creating and managing grafana.

105 lines 4.25 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.DashboardPermission = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages the entire set of permissions for a dashboard. Permissions that aren't specified when applying this resource will be removed. * * [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/dashboard_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", * password: "my-password", * login: "user.name", * }); * const metrics = new grafana.oss.Dashboard("metrics", {configJson: JSON.stringify({ * title: "My Dashboard", * uid: "my-dashboard-uid", * })}); * const collectionPermission = new grafana.oss.DashboardPermission("collectionPermission", { * dashboardUid: metrics.uid, * permissions: [ * { * role: "Editor", * permission: "Edit", * }, * { * teamId: team.id, * permission: "View", * }, * { * userId: user.id, * permission: "Admin", * }, * ], * }); * ``` * * ## Import * * ```sh * terraform import grafana_dashboard_permission.name "{{ dashboardUID }}" * terraform import grafana_dashboard_permission.name "{{ orgID }}:{{ dashboardUID }}" * ``` */ class DashboardPermission extends pulumi.CustomResource { /** * Get an existing DashboardPermission 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 DashboardPermission(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of DashboardPermission. 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'] === DashboardPermission.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["dashboardUid"] = state?.dashboardUid; resourceInputs["orgId"] = state?.orgId; resourceInputs["permissions"] = state?.permissions; } else { const args = argsOrState; if (args?.dashboardUid === undefined && !opts.urn) { throw new Error("Missing required property 'dashboardUid'"); } resourceInputs["dashboardUid"] = args?.dashboardUid; resourceInputs["orgId"] = args?.orgId; resourceInputs["permissions"] = args?.permissions; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const aliasOpts = { aliases: [{ type: "grafana:index/dashboardPermission:DashboardPermission" }] }; opts = pulumi.mergeOptions(opts, aliasOpts); super(DashboardPermission.__pulumiType, name, resourceInputs, opts); } } exports.DashboardPermission = DashboardPermission; /** @internal */ DashboardPermission.__pulumiType = 'grafana:oss/dashboardPermission:DashboardPermission'; //# sourceMappingURL=dashboardPermission.js.map