@lbrlabs/pulumi-grafana
Version:
A Pulumi package for creating and managing grafana.
110 lines • 5.23 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.Report = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* **Note:** This resource is available only with Grafana Enterprise 7.+.
*
* * [Official documentation](https://grafana.com/docs/grafana/latest/dashboards/create-reports/)
* * [HTTP API](https://grafana.com/docs/grafana/latest/developers/http_api/reporting/)
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@lbrlabs/pulumi-grafana";
*
* const testDashboard = new grafana.Dashboard("testDashboard", {
* configJson: `{
* "title": "Dashboard for report",
* "uid": "report"
* }
* `,
* message: "inital commit.",
* });
* const testReport = new grafana.Report("testReport", {
* dashboardUid: testDashboard.uid,
* recipients: ["some@email.com"],
* schedule: {
* frequency: "hourly",
* },
* });
* ```
*/
class Report extends pulumi.CustomResource {
/**
* Get an existing Report 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 Report(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Report. 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'] === Report.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["dashboardId"] = state ? state.dashboardId : undefined;
resourceInputs["dashboardUid"] = state ? state.dashboardUid : undefined;
resourceInputs["formats"] = state ? state.formats : undefined;
resourceInputs["includeDashboardLink"] = state ? state.includeDashboardLink : undefined;
resourceInputs["includeTableCsv"] = state ? state.includeTableCsv : undefined;
resourceInputs["layout"] = state ? state.layout : undefined;
resourceInputs["message"] = state ? state.message : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["orgId"] = state ? state.orgId : undefined;
resourceInputs["orientation"] = state ? state.orientation : undefined;
resourceInputs["recipients"] = state ? state.recipients : undefined;
resourceInputs["replyTo"] = state ? state.replyTo : undefined;
resourceInputs["schedule"] = state ? state.schedule : undefined;
resourceInputs["timeRange"] = state ? state.timeRange : undefined;
}
else {
const args = argsOrState;
if ((!args || args.recipients === undefined) && !opts.urn) {
throw new Error("Missing required property 'recipients'");
}
if ((!args || args.schedule === undefined) && !opts.urn) {
throw new Error("Missing required property 'schedule'");
}
resourceInputs["dashboardId"] = args ? args.dashboardId : undefined;
resourceInputs["dashboardUid"] = args ? args.dashboardUid : undefined;
resourceInputs["formats"] = args ? args.formats : undefined;
resourceInputs["includeDashboardLink"] = args ? args.includeDashboardLink : undefined;
resourceInputs["includeTableCsv"] = args ? args.includeTableCsv : undefined;
resourceInputs["layout"] = args ? args.layout : undefined;
resourceInputs["message"] = args ? args.message : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["orgId"] = args ? args.orgId : undefined;
resourceInputs["orientation"] = args ? args.orientation : undefined;
resourceInputs["recipients"] = args ? args.recipients : undefined;
resourceInputs["replyTo"] = args ? args.replyTo : undefined;
resourceInputs["schedule"] = args ? args.schedule : undefined;
resourceInputs["timeRange"] = args ? args.timeRange : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Report.__pulumiType, name, resourceInputs, opts);
}
}
exports.Report = Report;
/** @internal */
Report.__pulumiType = 'grafana:index/report:Report';
//# sourceMappingURL=report.js.map