com.pulumi.gcp.monitoring.kotlin.Dashboard.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.monitoring.kotlin
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
/**
* Builder for [Dashboard].
*/
@PulumiTagMarker
public class DashboardResourceBuilder internal constructor() {
public var name: String? = null
public var args: DashboardArgs = DashboardArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend DashboardArgsBuilder.() -> Unit) {
val builder = DashboardArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): Dashboard {
val builtJavaResource = com.pulumi.gcp.monitoring.Dashboard(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Dashboard(builtJavaResource)
}
}
/**
* 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": {}
* }
* ]
* }
* }
* `});
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* dashboard = gcp.monitoring.Dashboard("dashboard", dashboard_json="""{
* "displayName": "Demo Dashboard",
* "gridLayout": {
* "widgets": [
* {
* "blank": {}
* }
* ]
* }
* }
* """)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var dashboard = new Gcp.Monitoring.Dashboard("dashboard", new()
* {
* DashboardJson = @"{
* ""displayName"": ""Demo Dashboard"",
* ""gridLayout"": {
* ""widgets"": [
* {
* ""blank"": {}
* }
* ]
* }
* }
* ",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/monitoring"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := monitoring.NewDashboard(ctx, "dashboard", &monitoring.DashboardArgs{
* DashboardJson: pulumi.String(`{
* "displayName": "Demo Dashboard",
* "gridLayout": {
* "widgets": [
* {
* "blank": {}
* }
* ]
* }
* }
* `),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.monitoring.Dashboard;
* import com.pulumi.gcp.monitoring.DashboardArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var dashboard = new Dashboard("dashboard", DashboardArgs.builder()
* .dashboardJson("""
* {
* "displayName": "Demo Dashboard",
* "gridLayout": {
* "widgets": [
* {
* "blank": {}
* }
* ]
* }
* }
* """)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* dashboard:
* type: gcp:monitoring:Dashboard
* properties:
* 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"
* }
* }
* }
* ]
* }
* }
* `});
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* dashboard = gcp.monitoring.Dashboard("dashboard", dashboard_json="""{
* "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"
* }
* }
* }
* ]
* }
* }
* """)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var dashboard = new Gcp.Monitoring.Dashboard("dashboard", new()
* {
* 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""
* }
* }
* }
* ]
* }
* }
* ",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/monitoring"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := monitoring.NewDashboard(ctx, "dashboard", &monitoring.DashboardArgs{
* DashboardJson: pulumi.String(`{
* "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"
* }
* }
* }
* ]
* }
* }
* `),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.monitoring.Dashboard;
* import com.pulumi.gcp.monitoring.DashboardArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var dashboard = new Dashboard("dashboard", DashboardArgs.builder()
* .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"
* }
* }
* }
* ]
* }
* }
* """)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* dashboard:
* type: gcp:monitoring:Dashboard
* properties:
* 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}}
* ```
*/
public class Dashboard internal constructor(
override val javaResource: com.pulumi.gcp.monitoring.Dashboard,
) : KotlinCustomResource(javaResource, DashboardMapper) {
/**
* The JSON representation of a dashboard, following the format at
* https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
*/
public val dashboardJson: Output
get() = javaResource.dashboardJson().applyValue({ args0 -> args0 })
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
}
public object DashboardMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.monitoring.Dashboard::class == javaResource::class
override fun map(javaResource: Resource): Dashboard = Dashboard(
javaResource as
com.pulumi.gcp.monitoring.Dashboard,
)
}
/**
* @see [Dashboard].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Dashboard].
*/
public suspend fun dashboard(name: String, block: suspend DashboardResourceBuilder.() -> Unit): Dashboard {
val builder = DashboardResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Dashboard].
* @param name The _unique_ name of the resulting resource.
*/
public fun dashboard(name: String): Dashboard {
val builder = DashboardResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy