@pulumiverse/grafana
Version:
A Pulumi package for creating and managing grafana.
174 lines • 6.22 kB
JavaScript
;
// *** 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.TraceConfig = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages Knowledge Graph Trace Configuration through Grafana API.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@pulumiverse/grafana";
*
* const production = new grafana.assert.TraceConfig("production", {
* name: "production",
* priority: 1000,
* defaultConfig: false,
* dataSourceUid: "grafanacloud-traces",
* matches: [
* {
* property: "asserts_entity_type",
* op: "=",
* values: ["Service"],
* },
* {
* property: "deployment_environment",
* op: "=",
* values: [
* "production",
* "staging",
* ],
* },
* {
* property: "asserts_site",
* op: "=",
* values: [
* "us-east-1",
* "us-west-2",
* ],
* },
* ],
* entityPropertyToTraceLabelMapping: {
* cluster: "resource.k8s.cluster.name",
* namespace: "resource.k8s.namespace",
* container: "resource.container.name",
* otel_service: "resource.service.name",
* otel_namespace: "resource.service.namespace",
* },
* });
* const development = new grafana.assert.TraceConfig("development", {
* name: "development",
* priority: 2000,
* defaultConfig: false,
* dataSourceUid: "grafanacloud-traces",
* matches: [
* {
* property: "asserts_entity_type",
* op: "=",
* values: ["Service"],
* },
* {
* property: "deployment_environment",
* op: "=",
* values: [
* "development",
* "testing",
* ],
* },
* {
* property: "asserts_site",
* op: "=",
* values: ["us-east-1"],
* },
* {
* property: "service",
* op: "=",
* values: ["my sample api"],
* },
* ],
* entityPropertyToTraceLabelMapping: {
* cluster: "resource.k8s.cluster.name",
* namespace: "resource.k8s.namespace",
* container: "resource.container.name",
* otel_service: "resource.service.name",
* otel_namespace: "resource.service.namespace",
* pod: "span.k8s.pod.name",
* },
* });
* const minimal = new grafana.assert.TraceConfig("minimal", {
* name: "minimal",
* priority: 3000,
* dataSourceUid: "tempo-minimal",
* matches: [{
* property: "asserts_entity_type",
* op: "IS NOT NULL",
* }],
* entityPropertyToTraceLabelMapping: {
* cluster: "resource.k8s.cluster.name",
* otel_service: "resource.service.name",
* otel_namespace: "resource.service.namespace",
* },
* });
* ```
*
* ## Import
*
* ```sh
* terraform import grafana_asserts_trace_config.name "{{ name }}"
* ```
*/
class TraceConfig extends pulumi.CustomResource {
/**
* Get an existing TraceConfig 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 TraceConfig(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of TraceConfig. 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'] === TraceConfig.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["dataSourceUid"] = state?.dataSourceUid;
resourceInputs["defaultConfig"] = state?.defaultConfig;
resourceInputs["entityPropertyToTraceLabelMapping"] = state?.entityPropertyToTraceLabelMapping;
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["entityPropertyToTraceLabelMapping"] = args?.entityPropertyToTraceLabelMapping;
resourceInputs["matches"] = args?.matches;
resourceInputs["name"] = args?.name;
resourceInputs["priority"] = args?.priority;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(TraceConfig.__pulumiType, name, resourceInputs, opts);
}
}
exports.TraceConfig = TraceConfig;
/** @internal */
TraceConfig.__pulumiType = 'grafana:assert/traceConfig:TraceConfig';
//# sourceMappingURL=traceConfig.js.map