UNPKG

@lbrlabs/pulumi-grafana

Version:

A Pulumi package for creating and managing grafana.

95 lines 4.04 kB
"use strict"; // *** 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.RoleAssignment = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * **Note:** This resource is available only with Grafana Enterprise 9.2+. * * [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/access_control/) * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as grafana from "@lbrlabs/pulumi-grafana"; * * const testRole = new grafana.Role("testRole", { * uid: "testrole", * version: 1, * global: true, * permissions: [{ * action: "org.users:add", * scope: "users:*", * }], * }); * const testTeam = new grafana.Team("testTeam", {}); * const testUser = new grafana.User("testUser", { * email: "terraform_user@test.com", * login: "terraform_user@test.com", * password: "password", * }); * const testSa = new grafana.ServiceAccount("testSa", {role: "Viewer"}); * const test = new grafana.RoleAssignment("test", { * roleUid: testRole.uid, * users: [testUser.id], * teams: [testTeam.id], * serviceAccounts: [testSa.id], * }); * ``` */ class RoleAssignment extends pulumi.CustomResource { /** * Get an existing RoleAssignment 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 RoleAssignment(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of RoleAssignment. 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'] === RoleAssignment.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["orgId"] = state ? state.orgId : undefined; resourceInputs["roleUid"] = state ? state.roleUid : undefined; resourceInputs["serviceAccounts"] = state ? state.serviceAccounts : undefined; resourceInputs["teams"] = state ? state.teams : undefined; resourceInputs["users"] = state ? state.users : undefined; } else { const args = argsOrState; if ((!args || args.roleUid === undefined) && !opts.urn) { throw new Error("Missing required property 'roleUid'"); } resourceInputs["orgId"] = args ? args.orgId : undefined; resourceInputs["roleUid"] = args ? args.roleUid : undefined; resourceInputs["serviceAccounts"] = args ? args.serviceAccounts : undefined; resourceInputs["teams"] = args ? args.teams : undefined; resourceInputs["users"] = args ? args.users : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(RoleAssignment.__pulumiType, name, resourceInputs, opts); } } exports.RoleAssignment = RoleAssignment; /** @internal */ RoleAssignment.__pulumiType = 'grafana:index/roleAssignment:RoleAssignment'; //# sourceMappingURL=roleAssignment.js.map