@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
171 lines • 5.46 kB
JavaScript
"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");
/**
* A Google Stackdriver dashboard. Dashboards define the content and layout of pages in the Stackdriver web application.
*
* To get more information about Dashboards, see:
*
* * [API documentation](https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/monitoring/dashboards)
*
* ## Example Usage
*
* ### Monitoring Dashboard Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const dashboard = new gcp.monitoring.Dashboard("dashboard", {dashboardJson: `{
* "displayName": "Demo Dashboard",
* "gridLayout": {
* "widgets": [
* {
* "blank": {}
* }
* ]
* }
* }
*
* `});
* ```
*
* ### Monitoring Dashboard GridLayout
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const dashboard = new gcp.monitoring.Dashboard("dashboard", {dashboardJson: `{
* "displayName": "Grid Layout Example",
* "gridLayout": {
* "columns": "2",
* "widgets": [
* {
* "title": "Widget 1",
* "xyChart": {
* "dataSets": [{
* "timeSeriesQuery": {
* "timeSeriesFilter": {
* "filter": "metric.type=\\"agent.googleapis.com/nginx/connections/accepted_count\\"",
* "aggregation": {
* "perSeriesAligner": "ALIGN_RATE"
* }
* },
* "unitOverride": "1"
* },
* "plotType": "LINE"
* }],
* "timeshiftDuration": "0s",
* "yAxis": {
* "label": "y1Axis",
* "scale": "LINEAR"
* }
* }
* },
* {
* "text": {
* "content": "Widget 2",
* "format": "MARKDOWN"
* }
* },
* {
* "title": "Widget 3",
* "xyChart": {
* "dataSets": [{
* "timeSeriesQuery": {
* "timeSeriesFilter": {
* "filter": "metric.type=\\"agent.googleapis.com/nginx/connections/accepted_count\\"",
* "aggregation": {
* "perSeriesAligner": "ALIGN_RATE"
* }
* },
* "unitOverride": "1"
* },
* "plotType": "STACKED_BAR"
* }],
* "timeshiftDuration": "0s",
* "yAxis": {
* "label": "y1Axis",
* "scale": "LINEAR"
* }
* }
* }
* ]
* }
* }
*
* `});
* ```
*
* ## Import
*
* Dashboard can be imported using any of these accepted formats:
*
* * `projects/{{project}}/dashboards/{{dashboard_id}}`
*
* * `{{dashboard_id}}`
*
* When using the `pulumi import` command, Dashboard can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:monitoring/dashboard:Dashboard default projects/{{project}}/dashboards/{{dashboard_id}}
* ```
*
* ```sh
* $ pulumi import gcp:monitoring/dashboard:Dashboard default {{dashboard_id}}
* ```
*/
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["dashboardJson"] = state?.dashboardJson;
resourceInputs["project"] = state?.project;
}
else {
const args = argsOrState;
if (args?.dashboardJson === undefined && !opts.urn) {
throw new Error("Missing required property 'dashboardJson'");
}
resourceInputs["dashboardJson"] = args?.dashboardJson;
resourceInputs["project"] = args?.project;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Dashboard.__pulumiType, name, resourceInputs, opts);
}
}
exports.Dashboard = Dashboard;
/** @internal */
Dashboard.__pulumiType = 'gcp:monitoring/dashboard:Dashboard';
//# sourceMappingURL=dashboard.js.map