UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

294 lines • 11.2 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! *** 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.DashboardChart = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * A chart resource used within a NativeDashboard. Its lifecycle (Create, Update, Delete) is managed via custom methods on the NativeDashboard resource. * * To get more information about DashboardChart, see: * * * [API documentation](https://cloud.google.com/chronicle/docs/reference/rest/v1/projects.locations.instances.dashboardCharts) * * How-to Guides * * [Google SecOps Guides](https://cloud.google.com/chronicle/docs/secops/secops-overview) * * ## Example Usage * * ### Chronicle Dashboardchart Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * // A Native Dashboard is required to create a Dashboard Chart. * const myDashboard = new gcp.chronicle.NativeDashboard("my_dashboard", { * location: "us", * instance: "00000000-0000-0000-0000-000000000000", * displayName: "dashboard_1", * description: "dashboard_description", * access: "DASHBOARD_PRIVATE", * type: "CUSTOM", * filters: [{ * id: "GlobalTimeFilter", * displayName: "Global Time Filter", * dataSource: "GLOBAL", * isStandardTimeRangeFilter: true, * isStandardTimeRangeFilterEnabled: true, * filterOperatorAndFieldValues: [{ * filterOperator: "PAST", * fieldValues: [ * "1", * "DAY", * ], * }], * }], * }); * const myChart = new gcp.chronicle.DashboardChart("my_chart", { * location: myDashboard.location, * instance: myDashboard.instance, * nativeDashboard: myDashboard.name, * chartLayout: { * startX: 0, * spanX: 50, * startY: 12, * spanY: 18, * }, * dashboardChart: { * displayName: "Data Source Health Overview", * description: "Health of data sources over time", * tileType: "TILE_TYPE_VISUALIZATION", * chartDatasource: { * dataSources: ["IOC_MATCHES"], * }, * visualization: { * series: [{ * seriesType: "LINE", * encode: { * x: "timestamp", * y: "total_count", * }, * dataLabel: { * show: true, * }, * }], * xAxes: [{ * axisType: "CATEGORY", * displayName: "Date", * }], * yAxes: [{ * axisType: "CATEGORY", * displayName: "Sources", * }], * legends: [{ * top: 12, * legendOrient: "HORIZONTAL", * show: true, * id: "test_map_legend_01", * bottom: 10, * left: 10, * right: 5, * legendAlign: "LEFT", * paddings: [10], * z: 2, * zLevel: 1, * }], * seriesColumns: ["health_status"], * groupingType: "Grouped", * }, * drillDownConfig: { * leftDrillDowns: [{ * id: "D89B834D-977A-4E0C-83B0-12AB1D05E76B", * displayName: "Link to the google", * customSettings: { * newTab: true, * externalLink: { * description: "This is an external link", * link: "www.google.com", * }, * }, * }], * }, * }, * dashboardQuery: { * query: `IOC_Type = ioc.ioc_type * * match: * IOC_Type * * outcome: * IOC_Count = count(ioc.ioc_value) * * order: * IOC_Count desc * `, * input: { * relativeTime: { * timeUnit: "DAY", * startTimeVal: "1", * }, * }, * }, * }); * const buttonTile = new gcp.chronicle.DashboardChart("button_tile", { * location: myDashboard.location, * instance: myDashboard.instance, * nativeDashboard: myDashboard.name, * chartLayout: { * startX: 0, * spanX: 12, * startY: 66, * spanY: 4, * }, * dashboardChart: { * displayName: "Navigation Button", * tileType: "TILE_TYPE_BUTTON", * visualization: { * button: { * description: "This is a button tile", * label: "View Custom Detection Rules", * hyperlink: "/rulesDashboard", * newTab: true, * properties: { * color: "#1a73e8", * buttonStyle: "BUTTON_STYLE_TRANSPARENT", * }, * }, * }, * }, * }); * const markdownTile = new gcp.chronicle.DashboardChart("markdown_tile", { * location: myDashboard.location, * instance: myDashboard.instance, * nativeDashboard: myDashboard.name, * chartLayout: { * startX: 0, * spanX: 24, * startY: 48, * spanY: 4, * }, * dashboardChart: { * displayName: "markdown", * tileType: "TILE_TYPE_MARKDOWN", * visualization: { * markdown: { * content: `### Dashboard Header * This is a markdown block used for descriptions or section headers.`, * properties: { * backgroundColor: "#09326C", * }, * }, * }, * }, * }); * ``` * * ## Import * * DashboardChart can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/instances/{{instance}}/dashboardCharts/{{chart_id}}` * * `{{project}}/{{location}}/{{instance}}/{{chart_id}}` * * `{{location}}/{{instance}}/{{chart_id}}` * * When using the `pulumi import` command, DashboardChart can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:chronicle/dashboardChart:DashboardChart default projects/{{project}}/locations/{{location}}/instances/{{instance}}/dashboardCharts/{{chart_id}} * $ pulumi import gcp:chronicle/dashboardChart:DashboardChart default {{project}}/{{location}}/{{instance}}/{{chart_id}} * $ pulumi import gcp:chronicle/dashboardChart:DashboardChart default {{location}}/{{instance}}/{{chart_id}} * ``` */ class DashboardChart extends pulumi.CustomResource { /** * Get an existing DashboardChart 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 DashboardChart(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:chronicle/dashboardChart:DashboardChart'; /** * Returns true if the given object is an instance of DashboardChart. 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'] === DashboardChart.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["chartId"] = state?.chartId; resourceInputs["chartLayout"] = state?.chartLayout; resourceInputs["dashboardChart"] = state?.dashboardChart; resourceInputs["dashboardQuery"] = state?.dashboardQuery; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["instance"] = state?.instance; resourceInputs["location"] = state?.location; resourceInputs["name"] = state?.name; resourceInputs["nativeDashboard"] = state?.nativeDashboard; resourceInputs["project"] = state?.project; } else { const args = argsOrState; if (args?.dashboardChart === undefined && !opts.urn) { throw new Error("Missing required property 'dashboardChart'"); } if (args?.instance === undefined && !opts.urn) { throw new Error("Missing required property 'instance'"); } if (args?.location === undefined && !opts.urn) { throw new Error("Missing required property 'location'"); } resourceInputs["chartLayout"] = args?.chartLayout; resourceInputs["dashboardChart"] = args?.dashboardChart; resourceInputs["dashboardQuery"] = args?.dashboardQuery; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["instance"] = args?.instance; resourceInputs["location"] = args?.location; resourceInputs["nativeDashboard"] = args?.nativeDashboard; resourceInputs["project"] = args?.project; resourceInputs["chartId"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(DashboardChart.__pulumiType, name, resourceInputs, opts); } } exports.DashboardChart = DashboardChart; //# sourceMappingURL=dashboardChart.js.map