@pulumiverse/grafana
Version:
A Pulumi package for creating and managing grafana.
151 lines • 6.02 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.AwsCloudwatchScrapeJob = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* This resource allows you to scrape AWS CloudWatch metrics in Grafana Cloud without needing to run your own infrastructure.
*
* See the Grafana Provider configuration docs
* for information on authentication and required access policy scopes.
*
* * [Official Grafana Cloud documentation](https://grafana.com/docs/grafana-cloud/monitor-infrastructure/monitor-cloud-provider/aws/)
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* import * as grafana from "@pulumiverse/grafana";
*
* const test = grafana.cloud.getStack({
* slug: "gcloudstacktest",
* });
* const testIamRole = aws.index.IamRole({
* name: "my-role",
* });
* const testAwsAccount = new grafana.cloudprovider.AwsAccount("test", {
* stackId: test.then(test => test.id),
* roleArn: testIamRole.arn,
* regions: [
* "us-east-1",
* "us-east-2",
* "us-west-1",
* ],
* });
* const testAwsCloudwatchScrapeJob = new grafana.cloudprovider.AwsCloudwatchScrapeJob("test", {
* stackId: test.then(test => test.id),
* name: "my-cloudwatch-scrape-job",
* awsAccountResourceId: testAwsAccount.resourceId,
* exportTags: true,
* services: [{
* name: "AWS/EC2",
* metrics: [
* {
* name: "CPUUtilization",
* statistics: ["Average"],
* },
* {
* name: "StatusCheckFailed",
* statistics: ["Maximum"],
* },
* ],
* scrapeIntervalSeconds: 300,
* resourceDiscoveryTagFilters: [{
* key: "k8s.io/cluster-autoscaler/enabled",
* value: "true",
* }],
* tagsToAddToMetrics: ["eks:cluster-name"],
* }],
* customNamespaces: [{
* name: "CoolApp",
* metrics: [{
* name: "CoolMetric",
* statistics: [
* "Maximum",
* "Sum",
* ],
* }],
* scrapeIntervalSeconds: 300,
* }],
* staticLabels: {
* label1: "value1",
* label2: "value2",
* },
* });
* ```
*
* ## Import
*
* ```sh
* terraform import grafana_cloud_provider_aws_cloudwatch_scrape_job.name "{{ stack_id }}:{{ name }}"
* ```
*/
class AwsCloudwatchScrapeJob extends pulumi.CustomResource {
/**
* Get an existing AwsCloudwatchScrapeJob 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 AwsCloudwatchScrapeJob(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of AwsCloudwatchScrapeJob. 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'] === AwsCloudwatchScrapeJob.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["awsAccountResourceId"] = state?.awsAccountResourceId;
resourceInputs["customNamespaces"] = state?.customNamespaces;
resourceInputs["disabledReason"] = state?.disabledReason;
resourceInputs["enabled"] = state?.enabled;
resourceInputs["exportTags"] = state?.exportTags;
resourceInputs["name"] = state?.name;
resourceInputs["regionsSubsetOverrides"] = state?.regionsSubsetOverrides;
resourceInputs["services"] = state?.services;
resourceInputs["stackId"] = state?.stackId;
resourceInputs["staticLabels"] = state?.staticLabels;
}
else {
const args = argsOrState;
if (args?.awsAccountResourceId === undefined && !opts.urn) {
throw new Error("Missing required property 'awsAccountResourceId'");
}
if (args?.stackId === undefined && !opts.urn) {
throw new Error("Missing required property 'stackId'");
}
resourceInputs["awsAccountResourceId"] = args?.awsAccountResourceId;
resourceInputs["customNamespaces"] = args?.customNamespaces;
resourceInputs["enabled"] = args?.enabled;
resourceInputs["exportTags"] = args?.exportTags;
resourceInputs["name"] = args?.name;
resourceInputs["regionsSubsetOverrides"] = args?.regionsSubsetOverrides;
resourceInputs["services"] = args?.services;
resourceInputs["stackId"] = args?.stackId;
resourceInputs["staticLabels"] = args?.staticLabels;
resourceInputs["disabledReason"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(AwsCloudwatchScrapeJob.__pulumiType, name, resourceInputs, opts);
}
}
exports.AwsCloudwatchScrapeJob = AwsCloudwatchScrapeJob;
/** @internal */
AwsCloudwatchScrapeJob.__pulumiType = 'grafana:cloudProvider/awsCloudwatchScrapeJob:AwsCloudwatchScrapeJob';
//# sourceMappingURL=awsCloudwatchScrapeJob.js.map