@pulumiverse/grafana
Version:
A Pulumi package for creating and managing grafana.
131 lines • 5.69 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.DataSourcePermissionItem = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a single permission item for a datasource. Conflicts with the "grafana.enterprise.DataSourcePermission" resource which manages the entire set of permissions for a datasource.
*
* ## 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 foo = new grafana.oss.DataSource("foo", {
* type: "cloudwatch",
* name: "cw-example",
* jsonDataEncoded: JSON.stringify({
* defaultRegion: "us-east-1",
* authType: "keys",
* }),
* secureJsonDataEncoded: JSON.stringify({
* accessKey: "123",
* secretKey: "456",
* }),
* });
* const user = new grafana.oss.User("user", {
* name: "test-ds-permissions",
* email: "test-ds-permissions@example.com",
* login: "test-ds-permissions",
* password: "hunter2",
* });
* const sa = new grafana.oss.ServiceAccount("sa", {
* name: "test-ds-permissions",
* role: "Viewer",
* });
* const teamDataSourcePermissionItem = new grafana.enterprise.DataSourcePermissionItem("team", {
* datasourceUid: foo.uid,
* team: team.id,
* permission: "Edit",
* });
* const userDataSourcePermissionItem = new grafana.enterprise.DataSourcePermissionItem("user", {
* datasourceUid: foo.uid,
* user: user.id,
* permission: "Edit",
* });
* const role = new grafana.enterprise.DataSourcePermissionItem("role", {
* datasourceUid: foo.uid,
* role: "Viewer",
* permission: "Query",
* });
* const serviceAccount = new grafana.enterprise.DataSourcePermissionItem("service_account", {
* datasourceUid: foo.uid,
* user: sa.id,
* permission: "Query",
* });
* ```
*
* ## Import
*
* ```sh
* $ pulumi import grafana:enterprise/dataSourcePermissionItem:DataSourcePermissionItem name "{{ datasourceUID }}:{{ type (role, team, or user) }}:{{ identifier }}"
* ```
*
* ```sh
* $ pulumi import grafana:enterprise/dataSourcePermissionItem:DataSourcePermissionItem name "{{ orgID }}:{{ datasourceUID }}:{{ type (role, team, or user) }}:{{ identifier }}"
* ```
*/
class DataSourcePermissionItem extends pulumi.CustomResource {
/**
* Get an existing DataSourcePermissionItem 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 DataSourcePermissionItem(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of DataSourcePermissionItem. 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'] === DataSourcePermissionItem.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["datasourceUid"] = state ? state.datasourceUid : 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.datasourceUid === undefined) && !opts.urn) {
throw new Error("Missing required property 'datasourceUid'");
}
if ((!args || args.permission === undefined) && !opts.urn) {
throw new Error("Missing required property 'permission'");
}
resourceInputs["datasourceUid"] = args ? args.datasourceUid : 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/dataSourcePermissionItem:DataSourcePermissionItem" }] };
opts = pulumi.mergeOptions(opts, aliasOpts);
super(DataSourcePermissionItem.__pulumiType, name, resourceInputs, opts);
}
}
exports.DataSourcePermissionItem = DataSourcePermissionItem;
/** @internal */
DataSourcePermissionItem.__pulumiType = 'grafana:enterprise/dataSourcePermissionItem:DataSourcePermissionItem';
//# sourceMappingURL=dataSourcePermissionItem.js.map