@lbrlabs/pulumi-grafana
Version:
A Pulumi package for creating and managing grafana.
164 lines • 7.4 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.DataSource = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* * [Official documentation](https://grafana.com/docs/grafana/latest/datasources/)
* * [HTTP API](https://grafana.com/docs/grafana/latest/developers/http_api/data_source/)
*
* The required arguments for this resource vary depending on the type of data
* source selected (via the 'type' argument).
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@lbrlabs/pulumi-grafana";
*
* const arbitrary_data = new grafana.DataSource("arbitrary-data", {
* type: "stackdriver",
* jsonDataEncoded: JSON.stringify({
* tokenUri: "https://oauth2.googleapis.com/token",
* authenticationType: "jwt",
* defaultProject: "default-project",
* clientEmail: "client-email@default-project.iam.gserviceaccount.com",
* }),
* secureJsonDataEncoded: JSON.stringify({
* privateKey: `-----BEGIN PRIVATE KEY-----
* private-key
* -----END PRIVATE KEY-----
* `,
* }),
* });
* const influxdb = new grafana.DataSource("influxdb", {
* type: "influxdb",
* url: "http://influxdb.example.net:8086/",
* basicAuthEnabled: true,
* basicAuthUsername: "username",
* databaseName: influxdb_database.metrics.name,
* jsonDataEncoded: JSON.stringify({
* authType: "default",
* basicAuthPassword: "mypassword",
* }),
* });
* const cloudwatch = new grafana.DataSource("cloudwatch", {
* type: "cloudwatch",
* jsonDataEncoded: JSON.stringify({
* defaultRegion: "us-east-1",
* authType: "keys",
* }),
* secureJsonDataEncoded: JSON.stringify({
* accessKey: "123",
* secretKey: "456",
* }),
* });
* const prometheus = new grafana.DataSource("prometheus", {
* type: "prometheus",
* url: "https://my-instances.com",
* basicAuthEnabled: true,
* basicAuthUsername: "username",
* jsonDataEncoded: JSON.stringify({
* httpMethod: "POST",
* prometheusType: "Mimir",
* prometheusVersion: "2.4.0",
* }),
* secureJsonDataEncoded: JSON.stringify({
* basicAuthPassword: "password",
* }),
* });
* ```
*
* ## Import
*
* ```sh
* $ pulumi import grafana:index/dataSource:DataSource by_integer_id {{datasource_id}} # To use the default provider org
* ```
*
* ```sh
* $ pulumi import grafana:index/dataSource:DataSource by_uid {{datasource_uid}} # To use the default provider org
* ```
*
* ```sh
* $ pulumi import grafana:index/dataSource:DataSource by_integer_id {{org_id}}:{{datasource_id}} # When "org_id" is set on the resource
* ```
*
* ```sh
* $ pulumi import grafana:index/dataSource:DataSource by_uid {{org_id}}:{{datasource_uid}} # When "org_id" is set on the resource
* ```
*/
class DataSource extends pulumi.CustomResource {
/**
* Get an existing DataSource 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 DataSource(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of DataSource. 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'] === DataSource.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accessMode"] = state ? state.accessMode : undefined;
resourceInputs["basicAuthEnabled"] = state ? state.basicAuthEnabled : undefined;
resourceInputs["basicAuthUsername"] = state ? state.basicAuthUsername : undefined;
resourceInputs["databaseName"] = state ? state.databaseName : undefined;
resourceInputs["httpHeaders"] = state ? state.httpHeaders : undefined;
resourceInputs["isDefault"] = state ? state.isDefault : undefined;
resourceInputs["jsonDataEncoded"] = state ? state.jsonDataEncoded : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["orgId"] = state ? state.orgId : undefined;
resourceInputs["secureJsonDataEncoded"] = state ? state.secureJsonDataEncoded : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["uid"] = state ? state.uid : undefined;
resourceInputs["url"] = state ? state.url : undefined;
resourceInputs["username"] = state ? state.username : undefined;
}
else {
const args = argsOrState;
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["accessMode"] = args ? args.accessMode : undefined;
resourceInputs["basicAuthEnabled"] = args ? args.basicAuthEnabled : undefined;
resourceInputs["basicAuthUsername"] = args ? args.basicAuthUsername : undefined;
resourceInputs["databaseName"] = args ? args.databaseName : undefined;
resourceInputs["httpHeaders"] = (args === null || args === void 0 ? void 0 : args.httpHeaders) ? pulumi.secret(args.httpHeaders) : undefined;
resourceInputs["isDefault"] = args ? args.isDefault : undefined;
resourceInputs["jsonDataEncoded"] = args ? args.jsonDataEncoded : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["orgId"] = args ? args.orgId : undefined;
resourceInputs["secureJsonDataEncoded"] = (args === null || args === void 0 ? void 0 : args.secureJsonDataEncoded) ? pulumi.secret(args.secureJsonDataEncoded) : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["uid"] = args ? args.uid : undefined;
resourceInputs["url"] = args ? args.url : undefined;
resourceInputs["username"] = args ? args.username : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["httpHeaders", "secureJsonDataEncoded"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(DataSource.__pulumiType, name, resourceInputs, opts);
}
}
exports.DataSource = DataSource;
/** @internal */
DataSource.__pulumiType = 'grafana:index/dataSource:DataSource';
//# sourceMappingURL=dataSource.js.map