UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

116 lines 4.19 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.Dashboard = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a CloudWatch Dashboard resource. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const main = new aws.cloudwatch.Dashboard("main", { * dashboardName: "my-dashboard", * dashboardBody: JSON.stringify({ * widgets: [ * { * type: "metric", * x: 0, * y: 0, * width: 12, * height: 6, * properties: { * metrics: [[ * "AWS/EC2", * "CPUUtilization", * "InstanceId", * "i-012345", * ]], * period: 300, * stat: "Average", * region: "us-east-1", * title: "EC2 Instance CPU", * }, * }, * { * type: "text", * x: 0, * y: 7, * width: 3, * height: 3, * properties: { * markdown: "Hello world", * }, * }, * ], * }), * }); * ``` * * ## Import * * Using `pulumi import`, import CloudWatch dashboards using the `dashboard_name`. For example: * * ```sh * $ pulumi import aws:cloudwatch/dashboard:Dashboard sample dashboard_name * ``` */ class Dashboard extends pulumi.CustomResource { /** * Get an existing Dashboard 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 Dashboard(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Dashboard. 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'] === Dashboard.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["dashboardArn"] = state?.dashboardArn; resourceInputs["dashboardBody"] = state?.dashboardBody; resourceInputs["dashboardName"] = state?.dashboardName; resourceInputs["region"] = state?.region; } else { const args = argsOrState; if (args?.dashboardBody === undefined && !opts.urn) { throw new Error("Missing required property 'dashboardBody'"); } if (args?.dashboardName === undefined && !opts.urn) { throw new Error("Missing required property 'dashboardName'"); } resourceInputs["dashboardBody"] = args?.dashboardBody; resourceInputs["dashboardName"] = args?.dashboardName; resourceInputs["region"] = args?.region; resourceInputs["dashboardArn"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Dashboard.__pulumiType, name, resourceInputs, opts); } } exports.Dashboard = Dashboard; /** @internal */ Dashboard.__pulumiType = 'aws:cloudwatch/dashboard:Dashboard'; //# sourceMappingURL=dashboard.js.map