@pulumiverse/grafana
Version:
A Pulumi package for creating and managing grafana.
105 lines • 4.38 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.Dashboard = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages Grafana dashboards.
*
* * [Official documentation](https://grafana.com/docs/grafana/latest/dashboards/)
* * [HTTP API](https://grafana.com/docs/grafana/latest/developers/http_api/dashboard/)
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@pulumiverse/grafana";
*
* const test = new grafana.oss.Folder("test", {
* title: "My Folder",
* uid: "my-folder-uid",
* });
* const testDashboard = new grafana.oss.Dashboard("test", {
* folder: test.uid,
* configJson: JSON.stringify({
* title: "My Dashboard",
* uid: "my-dashboard-uid",
* }),
* });
* ```
*
* ## Import
*
* ```sh
* $ pulumi import grafana:oss/dashboard:Dashboard name "{{ uid }}"
* ```
*
* ```sh
* $ pulumi import grafana:oss/dashboard:Dashboard name "{{ orgID }}:{{ uid }}"
* ```
*/
class Dashboard extends pulumi.CustomResource {
/**
* Get an existing Dashboard 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 Dashboard(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Dashboard. 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'] === Dashboard.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["configJson"] = state ? state.configJson : undefined;
resourceInputs["dashboardId"] = state ? state.dashboardId : undefined;
resourceInputs["folder"] = state ? state.folder : undefined;
resourceInputs["message"] = state ? state.message : undefined;
resourceInputs["orgId"] = state ? state.orgId : undefined;
resourceInputs["overwrite"] = state ? state.overwrite : undefined;
resourceInputs["uid"] = state ? state.uid : undefined;
resourceInputs["url"] = state ? state.url : undefined;
resourceInputs["version"] = state ? state.version : undefined;
}
else {
const args = argsOrState;
if ((!args || args.configJson === undefined) && !opts.urn) {
throw new Error("Missing required property 'configJson'");
}
resourceInputs["configJson"] = args ? args.configJson : undefined;
resourceInputs["folder"] = args ? args.folder : undefined;
resourceInputs["message"] = args ? args.message : undefined;
resourceInputs["orgId"] = args ? args.orgId : undefined;
resourceInputs["overwrite"] = args ? args.overwrite : undefined;
resourceInputs["dashboardId"] = undefined /*out*/;
resourceInputs["uid"] = undefined /*out*/;
resourceInputs["url"] = undefined /*out*/;
resourceInputs["version"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const aliasOpts = { aliases: [{ type: "grafana:index/dashboard:Dashboard" }] };
opts = pulumi.mergeOptions(opts, aliasOpts);
super(Dashboard.__pulumiType, name, resourceInputs, opts);
}
}
exports.Dashboard = Dashboard;
/** @internal */
Dashboard.__pulumiType = 'grafana:oss/dashboard:Dashboard';
//# sourceMappingURL=dashboard.js.map