UNPKG

@pulumiverse/grafana

Version:

A Pulumi package for creating and managing grafana.

115 lines 4.89 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.RoleAssignmentItem = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages a single assignment for a role. Conflicts with the "grafana.enterprise.RoleAssignment" resource which manages the entire set of assignments for a role. * * ## 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 user = new grafana.enterprise.RoleAssignmentItem("user", { * roleUid: testRole.uid, * userId: testUser.id, * }); * const team = new grafana.enterprise.RoleAssignmentItem("team", { * roleUid: testRole.uid, * teamId: testTeam.id, * }); * const serviceAccount = new grafana.enterprise.RoleAssignmentItem("service_account", { * roleUid: testRole.uid, * serviceAccountId: testSa.id, * }); * ``` * * ## Import * * ```sh * $ pulumi import grafana:enterprise/roleAssignmentItem:RoleAssignmentItem name "{{ roleUID }}:{{ type (user, team or service_account) }}:{{ identifier }}" * ``` * * ```sh * $ pulumi import grafana:enterprise/roleAssignmentItem:RoleAssignmentItem name "{{ orgID }}:{{ roleUID }}:{{ type (user, team or service_account) }}:{{ identifier }}" * ``` */ class RoleAssignmentItem extends pulumi.CustomResource { /** * Get an existing RoleAssignmentItem 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 RoleAssignmentItem(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of RoleAssignmentItem. 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'] === RoleAssignmentItem.__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["serviceAccountId"] = state ? state.serviceAccountId : undefined; resourceInputs["teamId"] = state ? state.teamId : undefined; resourceInputs["userId"] = state ? state.userId : 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["serviceAccountId"] = args ? args.serviceAccountId : undefined; resourceInputs["teamId"] = args ? args.teamId : undefined; resourceInputs["userId"] = args ? args.userId : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const aliasOpts = { aliases: [{ type: "grafana:index/roleAssignmentItem:RoleAssignmentItem" }] }; opts = pulumi.mergeOptions(opts, aliasOpts); super(RoleAssignmentItem.__pulumiType, name, resourceInputs, opts); } } exports.RoleAssignmentItem = RoleAssignmentItem; /** @internal */ RoleAssignmentItem.__pulumiType = 'grafana:enterprise/roleAssignmentItem:RoleAssignmentItem'; //# sourceMappingURL=roleAssignmentItem.js.map