@pulumiverse/grafana
Version:
A Pulumi package for creating and managing grafana.
109 lines • 4.43 kB
JavaScript
;
// *** 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.RoleAssignment = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages the entire set of assignments for a role. Assignments that aren't specified when applying this resource will be removed.
* **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/developer-resources/api-reference/http-api/api-legacy/access_control/)
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@pulumiverse/grafana";
*
* const testRole = new grafana.enterprise.Role("test_role", {
* name: "Test Role",
* uid: "testrole",
* version: 1,
* global: true,
* permissions: [{
* action: "org.users:add",
* scope: "users:*",
* }],
* });
* const testTeam = new grafana.oss.Team("test_team", {name: "terraform_test_team"});
* const testUser = new grafana.oss.User("test_user", {
* email: "terraform_user@test.com",
* login: "terraform_user@test.com",
* password: "password",
* });
* const testSa = new grafana.oss.ServiceAccount("test_sa", {
* name: "terraform_test_sa",
* role: "Viewer",
* });
* const test = new grafana.enterprise.RoleAssignment("test", {
* roleUid: testRole.uid,
* users: [testUser.id],
* teams: [testTeam.id],
* serviceAccounts: [testSa.id],
* });
* ```
*
* ## Import
*
* ```sh
* terraform import grafana_role_assignment.name "{{ roleUID }}"
* terraform import grafana_role_assignment.name "{{ orgID }}:{{ roleUID }}"
* ```
*/
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, { ...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?.orgId;
resourceInputs["roleUid"] = state?.roleUid;
resourceInputs["serviceAccounts"] = state?.serviceAccounts;
resourceInputs["teams"] = state?.teams;
resourceInputs["users"] = state?.users;
}
else {
const args = argsOrState;
if (args?.roleUid === undefined && !opts.urn) {
throw new Error("Missing required property 'roleUid'");
}
resourceInputs["orgId"] = args?.orgId;
resourceInputs["roleUid"] = args?.roleUid;
resourceInputs["serviceAccounts"] = args?.serviceAccounts;
resourceInputs["teams"] = args?.teams;
resourceInputs["users"] = args?.users;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const aliasOpts = { aliases: [{ type: "grafana:index/roleAssignment:RoleAssignment" }] };
opts = pulumi.mergeOptions(opts, aliasOpts);
super(RoleAssignment.__pulumiType, name, resourceInputs, opts);
}
}
exports.RoleAssignment = RoleAssignment;
/** @internal */
RoleAssignment.__pulumiType = 'grafana:enterprise/roleAssignment:RoleAssignment';
//# sourceMappingURL=roleAssignment.js.map