UNPKG

@lbrlabs/pulumi-grafana

Version:

A Pulumi package for creating and managing grafana.

109 lines 4.24 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.DataSourcePermission = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * * [HTTP API](https://grafana.com/docs/grafana/latest/developers/http_api/datasource_permissions/) * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as grafana from "@lbrlabs/pulumi-grafana"; * * const team = new grafana.Team("team", {}); * const foo = new grafana.DataSource("foo", { * type: "cloudwatch", * jsonDataEncoded: JSON.stringify({ * defaultRegion: "us-east-1", * authType: "keys", * }), * secureJsonDataEncoded: JSON.stringify({ * accessKey: "123", * secretKey: "456", * }), * }); * const user = new grafana.User("user", { * email: "test-ds-permissions@example.com", * login: "test-ds-permissions", * password: "hunter2", * }); * const sa = new grafana.ServiceAccount("sa", {role: "Viewer"}); * const fooPermissions = new grafana.DataSourcePermission("fooPermissions", { * datasourceId: foo.id, * permissions: [ * { * teamId: team.id, * permission: "Query", * }, * { * userId: user.id, * permission: "Edit", * }, * { * builtInRole: "Viewer", * permission: "Query", * }, * { * userId: sa.id, * permission: "Query", * }, * ], * }); * ``` */ class DataSourcePermission extends pulumi.CustomResource { /** * Get an existing DataSourcePermission 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 DataSourcePermission(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of DataSourcePermission. 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'] === DataSourcePermission.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["datasourceId"] = state ? state.datasourceId : undefined; resourceInputs["orgId"] = state ? state.orgId : undefined; resourceInputs["permissions"] = state ? state.permissions : undefined; } else { const args = argsOrState; if ((!args || args.datasourceId === undefined) && !opts.urn) { throw new Error("Missing required property 'datasourceId'"); } if ((!args || args.permissions === undefined) && !opts.urn) { throw new Error("Missing required property 'permissions'"); } resourceInputs["datasourceId"] = args ? args.datasourceId : undefined; resourceInputs["orgId"] = args ? args.orgId : undefined; resourceInputs["permissions"] = args ? args.permissions : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(DataSourcePermission.__pulumiType, name, resourceInputs, opts); } } exports.DataSourcePermission = DataSourcePermission; /** @internal */ DataSourcePermission.__pulumiType = 'grafana:index/dataSourcePermission:DataSourcePermission'; //# sourceMappingURL=dataSourcePermission.js.map