UNPKG

@lbrlabs/pulumi-grafana

Version:

A Pulumi package for creating and managing grafana.

95 lines 4.98 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.SyntheticMonitoringInstallation = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Sets up Synthetic Monitoring on a Grafana cloud stack and generates a token. * Once a Grafana Cloud stack is created, a user can either use this resource or go into the UI to install synthetic monitoring. * This resource cannot be imported but it can be used on an existing Synthetic Monitoring installation without issues. * * **Note that this resource must be used on a provider configured with Grafana Cloud credentials.** * * * [Official documentation](https://grafana.com/docs/grafana-cloud/monitor-public-endpoints/installation/) * * [API documentation](https://github.com/grafana/synthetic-monitoring-api-go-client/blob/main/docs/API.md#apiv1registerinstall) * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as grafana from "@lbrlabs/pulumi-grafana"; * * const smStackCloudStack = new grafana.CloudStack("smStackCloudStack", { * slug: "<stack-slug>", * regionSlug: "us", * }); * const metricsPublish = new grafana.CloudApiKey("metricsPublish", { * role: "MetricsPublisher", * cloudOrgSlug: "<org-slug>", * }); * const smStackSyntheticMonitoringInstallation = new grafana.SyntheticMonitoringInstallation("smStackSyntheticMonitoringInstallation", {stackId: smStackCloudStack.id}); * // Create a new provider instance to interact with Synthetic Monitoring * const sm = new grafana.Provider("sm", { * smAccessToken: smStackSyntheticMonitoringInstallation.smAccessToken, * smUrl: smStackSyntheticMonitoringInstallation.stackSmApiUrl, * }); * ``` */ class SyntheticMonitoringInstallation extends pulumi.CustomResource { /** * Get an existing SyntheticMonitoringInstallation 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 SyntheticMonitoringInstallation(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of SyntheticMonitoringInstallation. 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'] === SyntheticMonitoringInstallation.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["metricsPublisherKey"] = state ? state.metricsPublisherKey : undefined; resourceInputs["smAccessToken"] = state ? state.smAccessToken : undefined; resourceInputs["stackId"] = state ? state.stackId : undefined; resourceInputs["stackSmApiUrl"] = state ? state.stackSmApiUrl : undefined; } else { const args = argsOrState; if ((!args || args.metricsPublisherKey === undefined) && !opts.urn) { throw new Error("Missing required property 'metricsPublisherKey'"); } if ((!args || args.stackId === undefined) && !opts.urn) { throw new Error("Missing required property 'stackId'"); } resourceInputs["metricsPublisherKey"] = (args === null || args === void 0 ? void 0 : args.metricsPublisherKey) ? pulumi.secret(args.metricsPublisherKey) : undefined; resourceInputs["stackId"] = args ? args.stackId : undefined; resourceInputs["stackSmApiUrl"] = args ? args.stackSmApiUrl : undefined; resourceInputs["smAccessToken"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["metricsPublisherKey"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(SyntheticMonitoringInstallation.__pulumiType, name, resourceInputs, opts); } } exports.SyntheticMonitoringInstallation = SyntheticMonitoringInstallation; /** @internal */ SyntheticMonitoringInstallation.__pulumiType = 'grafana:index/syntheticMonitoringInstallation:SyntheticMonitoringInstallation'; //# sourceMappingURL=syntheticMonitoringInstallation.js.map