UNPKG

@pulumiverse/grafana

Version:

A Pulumi package for creating and managing grafana.

181 lines 6.32 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.LogConfig = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages Knowledge Graph Log Configuration through Grafana API. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as grafana from "@pulumiverse/grafana"; * * const production = new grafana.assert.LogConfig("production", { * name: "production", * priority: 1000, * defaultConfig: false, * dataSourceUid: "grafanacloud-logs", * errorLabel: "error", * matches: [ * { * property: "asserts_entity_type", * op: "=", * values: ["Service"], * }, * { * property: "environment", * op: "=", * values: [ * "production", * "staging", * ], * }, * { * property: "site", * op: "=", * values: [ * "us-east-1", * "us-west-2", * ], * }, * ], * entityPropertyToLogLabelMapping: { * otel_namespace: "service_namespace", * otel_service: "service_name", * environment: "env", * site: "region", * }, * filterBySpanId: true, * filterByTraceId: true, * }); * const development = new grafana.assert.LogConfig("development", { * name: "development", * priority: 2000, * defaultConfig: true, * dataSourceUid: "elasticsearch-dev", * errorLabel: "error", * matches: [ * { * property: "asserts_entity_type", * op: "=", * values: ["Service"], * }, * { * property: "environment", * op: "=", * values: [ * "development", * "testing", * ], * }, * { * property: "site", * op: "=", * values: ["us-east-1"], * }, * { * property: "service", * op: "=", * values: ["api"], * }, * ], * entityPropertyToLogLabelMapping: { * otel_namespace: "service_namespace", * otel_service: "service_name", * environment: "env", * site: "region", * service: "app", * }, * filterBySpanId: true, * filterByTraceId: true, * }); * const minimal = new grafana.assert.LogConfig("minimal", { * name: "minimal", * priority: 3000, * defaultConfig: false, * dataSourceUid: "loki-minimal", * matches: [{ * property: "asserts_entity_type", * op: "IS NOT NULL", * values: [], * }], * }); * ``` * * ## Import * * ```sh * terraform import grafana_asserts_log_config.name "{{ name }}" * ``` */ class LogConfig extends pulumi.CustomResource { /** * Get an existing LogConfig 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 LogConfig(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of LogConfig. 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'] === LogConfig.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["dataSourceUid"] = state?.dataSourceUid; resourceInputs["defaultConfig"] = state?.defaultConfig; resourceInputs["entityPropertyToLogLabelMapping"] = state?.entityPropertyToLogLabelMapping; resourceInputs["errorLabel"] = state?.errorLabel; resourceInputs["filterBySpanId"] = state?.filterBySpanId; resourceInputs["filterByTraceId"] = state?.filterByTraceId; resourceInputs["matches"] = state?.matches; resourceInputs["name"] = state?.name; resourceInputs["priority"] = state?.priority; } else { const args = argsOrState; if (args?.dataSourceUid === undefined && !opts.urn) { throw new Error("Missing required property 'dataSourceUid'"); } if (args?.defaultConfig === undefined && !opts.urn) { throw new Error("Missing required property 'defaultConfig'"); } if (args?.priority === undefined && !opts.urn) { throw new Error("Missing required property 'priority'"); } resourceInputs["dataSourceUid"] = args?.dataSourceUid; resourceInputs["defaultConfig"] = args?.defaultConfig; resourceInputs["entityPropertyToLogLabelMapping"] = args?.entityPropertyToLogLabelMapping; resourceInputs["errorLabel"] = args?.errorLabel; resourceInputs["filterBySpanId"] = args?.filterBySpanId; resourceInputs["filterByTraceId"] = args?.filterByTraceId; resourceInputs["matches"] = args?.matches; resourceInputs["name"] = args?.name; resourceInputs["priority"] = args?.priority; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(LogConfig.__pulumiType, name, resourceInputs, opts); } } exports.LogConfig = LogConfig; /** @internal */ LogConfig.__pulumiType = 'grafana:assert/logConfig:LogConfig'; //# sourceMappingURL=logConfig.js.map