@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
192 lines • 6.89 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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Dashboard = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(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}}
* $ 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 });
}
/** @internal */
static __pulumiType = 'gcp:monitoring/dashboard:Dashboard';
/**
* 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["deletionPolicy"] = state?.deletionPolicy;
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["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["project"] = args?.project;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Dashboard.__pulumiType, name, resourceInputs, opts);
}
}
exports.Dashboard = Dashboard;
//# sourceMappingURL=dashboard.js.map