com.pulumi.gcp.logging.kotlin.Metric.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.logging.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.logging.kotlin.outputs.MetricBucketOptions
import com.pulumi.gcp.logging.kotlin.outputs.MetricMetricDescriptor
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
import kotlin.collections.Map
import com.pulumi.gcp.logging.kotlin.outputs.MetricBucketOptions.Companion.toKotlin as metricBucketOptionsToKotlin
import com.pulumi.gcp.logging.kotlin.outputs.MetricMetricDescriptor.Companion.toKotlin as metricMetricDescriptorToKotlin
/**
* Builder for [Metric].
*/
@PulumiTagMarker
public class MetricResourceBuilder internal constructor() {
public var name: String? = null
public var args: MetricArgs = MetricArgs()
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 MetricArgsBuilder.() -> Unit) {
val builder = MetricArgsBuilder()
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(): Metric {
val builtJavaResource = com.pulumi.gcp.logging.Metric(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Metric(builtJavaResource)
}
}
/**
* Logs-based metric can also be used to extract values from logs and create a a distribution
* of the values. The distribution records the statistics of the extracted values along with
* an optional histogram of the values as specified by the bucket options.
* To get more information about Metric, see:
* * [API documentation](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/create)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/logging/docs/apis)
* ## Example Usage
* ### Logging Metric Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const loggingMetric = new gcp.logging.Metric("logging_metric", {
* name: "my-(custom)/metric",
* filter: "resource.type=gae_app AND severity>=ERROR",
* metricDescriptor: {
* metricKind: "DELTA",
* valueType: "DISTRIBUTION",
* unit: "1",
* labels: [
* {
* key: "mass",
* valueType: "STRING",
* description: "amount of matter",
* },
* {
* key: "sku",
* valueType: "INT64",
* description: "Identifying number for item",
* },
* ],
* displayName: "My metric",
* },
* valueExtractor: "EXTRACT(jsonPayload.request)",
* labelExtractors: {
* mass: "EXTRACT(jsonPayload.request)",
* sku: "EXTRACT(jsonPayload.id)",
* },
* bucketOptions: {
* linearBuckets: {
* numFiniteBuckets: 3,
* width: 1,
* offset: 1,
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* logging_metric = gcp.logging.Metric("logging_metric",
* name="my-(custom)/metric",
* filter="resource.type=gae_app AND severity>=ERROR",
* metric_descriptor=gcp.logging.MetricMetricDescriptorArgs(
* metric_kind="DELTA",
* value_type="DISTRIBUTION",
* unit="1",
* labels=[
* gcp.logging.MetricMetricDescriptorLabelArgs(
* key="mass",
* value_type="STRING",
* description="amount of matter",
* ),
* gcp.logging.MetricMetricDescriptorLabelArgs(
* key="sku",
* value_type="INT64",
* description="Identifying number for item",
* ),
* ],
* display_name="My metric",
* ),
* value_extractor="EXTRACT(jsonPayload.request)",
* label_extractors={
* "mass": "EXTRACT(jsonPayload.request)",
* "sku": "EXTRACT(jsonPayload.id)",
* },
* bucket_options=gcp.logging.MetricBucketOptionsArgs(
* linear_buckets=gcp.logging.MetricBucketOptionsLinearBucketsArgs(
* num_finite_buckets=3,
* width=1,
* offset=1,
* ),
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var loggingMetric = new Gcp.Logging.Metric("logging_metric", new()
* {
* Name = "my-(custom)/metric",
* Filter = "resource.type=gae_app AND severity>=ERROR",
* MetricDescriptor = new Gcp.Logging.Inputs.MetricMetricDescriptorArgs
* {
* MetricKind = "DELTA",
* ValueType = "DISTRIBUTION",
* Unit = "1",
* Labels = new[]
* {
* new Gcp.Logging.Inputs.MetricMetricDescriptorLabelArgs
* {
* Key = "mass",
* ValueType = "STRING",
* Description = "amount of matter",
* },
* new Gcp.Logging.Inputs.MetricMetricDescriptorLabelArgs
* {
* Key = "sku",
* ValueType = "INT64",
* Description = "Identifying number for item",
* },
* },
* DisplayName = "My metric",
* },
* ValueExtractor = "EXTRACT(jsonPayload.request)",
* LabelExtractors =
* {
* { "mass", "EXTRACT(jsonPayload.request)" },
* { "sku", "EXTRACT(jsonPayload.id)" },
* },
* BucketOptions = new Gcp.Logging.Inputs.MetricBucketOptionsArgs
* {
* LinearBuckets = new Gcp.Logging.Inputs.MetricBucketOptionsLinearBucketsArgs
* {
* NumFiniteBuckets = 3,
* Width = 1,
* Offset = 1,
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/logging"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := logging.NewMetric(ctx, "logging_metric", &logging.MetricArgs{
* Name: pulumi.String("my-(custom)/metric"),
* Filter: pulumi.String("resource.type=gae_app AND severity>=ERROR"),
* MetricDescriptor: &logging.MetricMetricDescriptorArgs{
* MetricKind: pulumi.String("DELTA"),
* ValueType: pulumi.String("DISTRIBUTION"),
* Unit: pulumi.String("1"),
* Labels: logging.MetricMetricDescriptorLabelArray{
* &logging.MetricMetricDescriptorLabelArgs{
* Key: pulumi.String("mass"),
* ValueType: pulumi.String("STRING"),
* Description: pulumi.String("amount of matter"),
* },
* &logging.MetricMetricDescriptorLabelArgs{
* Key: pulumi.String("sku"),
* ValueType: pulumi.String("INT64"),
* Description: pulumi.String("Identifying number for item"),
* },
* },
* DisplayName: pulumi.String("My metric"),
* },
* ValueExtractor: pulumi.String("EXTRACT(jsonPayload.request)"),
* LabelExtractors: pulumi.StringMap{
* "mass": pulumi.String("EXTRACT(jsonPayload.request)"),
* "sku": pulumi.String("EXTRACT(jsonPayload.id)"),
* },
* BucketOptions: &logging.MetricBucketOptionsArgs{
* LinearBuckets: &logging.MetricBucketOptionsLinearBucketsArgs{
* NumFiniteBuckets: pulumi.Int(3),
* Width: pulumi.Float64(1),
* Offset: pulumi.Float64(1),
* },
* },
* })
* 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.logging.Metric;
* import com.pulumi.gcp.logging.MetricArgs;
* import com.pulumi.gcp.logging.inputs.MetricMetricDescriptorArgs;
* import com.pulumi.gcp.logging.inputs.MetricBucketOptionsArgs;
* import com.pulumi.gcp.logging.inputs.MetricBucketOptionsLinearBucketsArgs;
* 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 loggingMetric = new Metric("loggingMetric", MetricArgs.builder()
* .name("my-(custom)/metric")
* .filter("resource.type=gae_app AND severity>=ERROR")
* .metricDescriptor(MetricMetricDescriptorArgs.builder()
* .metricKind("DELTA")
* .valueType("DISTRIBUTION")
* .unit("1")
* .labels(
* MetricMetricDescriptorLabelArgs.builder()
* .key("mass")
* .valueType("STRING")
* .description("amount of matter")
* .build(),
* MetricMetricDescriptorLabelArgs.builder()
* .key("sku")
* .valueType("INT64")
* .description("Identifying number for item")
* .build())
* .displayName("My metric")
* .build())
* .valueExtractor("EXTRACT(jsonPayload.request)")
* .labelExtractors(Map.ofEntries(
* Map.entry("mass", "EXTRACT(jsonPayload.request)"),
* Map.entry("sku", "EXTRACT(jsonPayload.id)")
* ))
* .bucketOptions(MetricBucketOptionsArgs.builder()
* .linearBuckets(MetricBucketOptionsLinearBucketsArgs.builder()
* .numFiniteBuckets(3)
* .width(1)
* .offset(1)
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* loggingMetric:
* type: gcp:logging:Metric
* name: logging_metric
* properties:
* name: my-(custom)/metric
* filter: resource.type=gae_app AND severity>=ERROR
* metricDescriptor:
* metricKind: DELTA
* valueType: DISTRIBUTION
* unit: '1'
* labels:
* - key: mass
* valueType: STRING
* description: amount of matter
* - key: sku
* valueType: INT64
* description: Identifying number for item
* displayName: My metric
* valueExtractor: EXTRACT(jsonPayload.request)
* labelExtractors:
* mass: EXTRACT(jsonPayload.request)
* sku: EXTRACT(jsonPayload.id)
* bucketOptions:
* linearBuckets:
* numFiniteBuckets: 3
* width: 1
* offset: 1
* ```
*
* ### Logging Metric Counter Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const loggingMetric = new gcp.logging.Metric("logging_metric", {
* name: "my-(custom)/metric",
* filter: "resource.type=gae_app AND severity>=ERROR",
* metricDescriptor: {
* metricKind: "DELTA",
* valueType: "INT64",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* logging_metric = gcp.logging.Metric("logging_metric",
* name="my-(custom)/metric",
* filter="resource.type=gae_app AND severity>=ERROR",
* metric_descriptor=gcp.logging.MetricMetricDescriptorArgs(
* metric_kind="DELTA",
* value_type="INT64",
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var loggingMetric = new Gcp.Logging.Metric("logging_metric", new()
* {
* Name = "my-(custom)/metric",
* Filter = "resource.type=gae_app AND severity>=ERROR",
* MetricDescriptor = new Gcp.Logging.Inputs.MetricMetricDescriptorArgs
* {
* MetricKind = "DELTA",
* ValueType = "INT64",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/logging"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := logging.NewMetric(ctx, "logging_metric", &logging.MetricArgs{
* Name: pulumi.String("my-(custom)/metric"),
* Filter: pulumi.String("resource.type=gae_app AND severity>=ERROR"),
* MetricDescriptor: &logging.MetricMetricDescriptorArgs{
* MetricKind: pulumi.String("DELTA"),
* ValueType: pulumi.String("INT64"),
* },
* })
* 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.logging.Metric;
* import com.pulumi.gcp.logging.MetricArgs;
* import com.pulumi.gcp.logging.inputs.MetricMetricDescriptorArgs;
* 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 loggingMetric = new Metric("loggingMetric", MetricArgs.builder()
* .name("my-(custom)/metric")
* .filter("resource.type=gae_app AND severity>=ERROR")
* .metricDescriptor(MetricMetricDescriptorArgs.builder()
* .metricKind("DELTA")
* .valueType("INT64")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* loggingMetric:
* type: gcp:logging:Metric
* name: logging_metric
* properties:
* name: my-(custom)/metric
* filter: resource.type=gae_app AND severity>=ERROR
* metricDescriptor:
* metricKind: DELTA
* valueType: INT64
* ```
*
* ### Logging Metric Counter Labels
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const loggingMetric = new gcp.logging.Metric("logging_metric", {
* name: "my-(custom)/metric",
* filter: "resource.type=gae_app AND severity>=ERROR",
* metricDescriptor: {
* metricKind: "DELTA",
* valueType: "INT64",
* labels: [{
* key: "mass",
* valueType: "STRING",
* description: "amount of matter",
* }],
* },
* labelExtractors: {
* mass: "EXTRACT(jsonPayload.request)",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* logging_metric = gcp.logging.Metric("logging_metric",
* name="my-(custom)/metric",
* filter="resource.type=gae_app AND severity>=ERROR",
* metric_descriptor=gcp.logging.MetricMetricDescriptorArgs(
* metric_kind="DELTA",
* value_type="INT64",
* labels=[gcp.logging.MetricMetricDescriptorLabelArgs(
* key="mass",
* value_type="STRING",
* description="amount of matter",
* )],
* ),
* label_extractors={
* "mass": "EXTRACT(jsonPayload.request)",
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var loggingMetric = new Gcp.Logging.Metric("logging_metric", new()
* {
* Name = "my-(custom)/metric",
* Filter = "resource.type=gae_app AND severity>=ERROR",
* MetricDescriptor = new Gcp.Logging.Inputs.MetricMetricDescriptorArgs
* {
* MetricKind = "DELTA",
* ValueType = "INT64",
* Labels = new[]
* {
* new Gcp.Logging.Inputs.MetricMetricDescriptorLabelArgs
* {
* Key = "mass",
* ValueType = "STRING",
* Description = "amount of matter",
* },
* },
* },
* LabelExtractors =
* {
* { "mass", "EXTRACT(jsonPayload.request)" },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/logging"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := logging.NewMetric(ctx, "logging_metric", &logging.MetricArgs{
* Name: pulumi.String("my-(custom)/metric"),
* Filter: pulumi.String("resource.type=gae_app AND severity>=ERROR"),
* MetricDescriptor: &logging.MetricMetricDescriptorArgs{
* MetricKind: pulumi.String("DELTA"),
* ValueType: pulumi.String("INT64"),
* Labels: logging.MetricMetricDescriptorLabelArray{
* &logging.MetricMetricDescriptorLabelArgs{
* Key: pulumi.String("mass"),
* ValueType: pulumi.String("STRING"),
* Description: pulumi.String("amount of matter"),
* },
* },
* },
* LabelExtractors: pulumi.StringMap{
* "mass": pulumi.String("EXTRACT(jsonPayload.request)"),
* },
* })
* 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.logging.Metric;
* import com.pulumi.gcp.logging.MetricArgs;
* import com.pulumi.gcp.logging.inputs.MetricMetricDescriptorArgs;
* 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 loggingMetric = new Metric("loggingMetric", MetricArgs.builder()
* .name("my-(custom)/metric")
* .filter("resource.type=gae_app AND severity>=ERROR")
* .metricDescriptor(MetricMetricDescriptorArgs.builder()
* .metricKind("DELTA")
* .valueType("INT64")
* .labels(MetricMetricDescriptorLabelArgs.builder()
* .key("mass")
* .valueType("STRING")
* .description("amount of matter")
* .build())
* .build())
* .labelExtractors(Map.of("mass", "EXTRACT(jsonPayload.request)"))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* loggingMetric:
* type: gcp:logging:Metric
* name: logging_metric
* properties:
* name: my-(custom)/metric
* filter: resource.type=gae_app AND severity>=ERROR
* metricDescriptor:
* metricKind: DELTA
* valueType: INT64
* labels:
* - key: mass
* valueType: STRING
* description: amount of matter
* labelExtractors:
* mass: EXTRACT(jsonPayload.request)
* ```
*
* ### Logging Metric Logging Bucket
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const loggingMetric = new gcp.logging.ProjectBucketConfig("logging_metric", {
* location: "global",
* project: "my-project-name",
* bucketId: "_Default",
* });
* const loggingMetricMetric = new gcp.logging.Metric("logging_metric", {
* name: "my-(custom)/metric",
* filter: "resource.type=gae_app AND severity>=ERROR",
* bucketName: loggingMetric.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* logging_metric = gcp.logging.ProjectBucketConfig("logging_metric",
* location="global",
* project="my-project-name",
* bucket_id="_Default")
* logging_metric_metric = gcp.logging.Metric("logging_metric",
* name="my-(custom)/metric",
* filter="resource.type=gae_app AND severity>=ERROR",
* bucket_name=logging_metric.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var loggingMetric = new Gcp.Logging.ProjectBucketConfig("logging_metric", new()
* {
* Location = "global",
* Project = "my-project-name",
* BucketId = "_Default",
* });
* var loggingMetricMetric = new Gcp.Logging.Metric("logging_metric", new()
* {
* Name = "my-(custom)/metric",
* Filter = "resource.type=gae_app AND severity>=ERROR",
* BucketName = loggingMetric.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/logging"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* loggingMetric, err := logging.NewProjectBucketConfig(ctx, "logging_metric", &logging.ProjectBucketConfigArgs{
* Location: pulumi.String("global"),
* Project: pulumi.String("my-project-name"),
* BucketId: pulumi.String("_Default"),
* })
* if err != nil {
* return err
* }
* _, err = logging.NewMetric(ctx, "logging_metric", &logging.MetricArgs{
* Name: pulumi.String("my-(custom)/metric"),
* Filter: pulumi.String("resource.type=gae_app AND severity>=ERROR"),
* BucketName: loggingMetric.ID(),
* })
* 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.logging.ProjectBucketConfig;
* import com.pulumi.gcp.logging.ProjectBucketConfigArgs;
* import com.pulumi.gcp.logging.Metric;
* import com.pulumi.gcp.logging.MetricArgs;
* 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 loggingMetric = new ProjectBucketConfig("loggingMetric", ProjectBucketConfigArgs.builder()
* .location("global")
* .project("my-project-name")
* .bucketId("_Default")
* .build());
* var loggingMetricMetric = new Metric("loggingMetricMetric", MetricArgs.builder()
* .name("my-(custom)/metric")
* .filter("resource.type=gae_app AND severity>=ERROR")
* .bucketName(loggingMetric.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* loggingMetric:
* type: gcp:logging:ProjectBucketConfig
* name: logging_metric
* properties:
* location: global
* project: my-project-name
* bucketId: _Default
* loggingMetricMetric:
* type: gcp:logging:Metric
* name: logging_metric
* properties:
* name: my-(custom)/metric
* filter: resource.type=gae_app AND severity>=ERROR
* bucketName: ${loggingMetric.id}
* ```
*
* ### Logging Metric Disabled
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const loggingMetric = new gcp.logging.Metric("logging_metric", {
* name: "my-(custom)/metric",
* filter: "resource.type=gae_app AND severity>=ERROR",
* metricDescriptor: {
* metricKind: "DELTA",
* valueType: "INT64",
* },
* disabled: true,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* logging_metric = gcp.logging.Metric("logging_metric",
* name="my-(custom)/metric",
* filter="resource.type=gae_app AND severity>=ERROR",
* metric_descriptor=gcp.logging.MetricMetricDescriptorArgs(
* metric_kind="DELTA",
* value_type="INT64",
* ),
* disabled=True)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var loggingMetric = new Gcp.Logging.Metric("logging_metric", new()
* {
* Name = "my-(custom)/metric",
* Filter = "resource.type=gae_app AND severity>=ERROR",
* MetricDescriptor = new Gcp.Logging.Inputs.MetricMetricDescriptorArgs
* {
* MetricKind = "DELTA",
* ValueType = "INT64",
* },
* Disabled = true,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/logging"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := logging.NewMetric(ctx, "logging_metric", &logging.MetricArgs{
* Name: pulumi.String("my-(custom)/metric"),
* Filter: pulumi.String("resource.type=gae_app AND severity>=ERROR"),
* MetricDescriptor: &logging.MetricMetricDescriptorArgs{
* MetricKind: pulumi.String("DELTA"),
* ValueType: pulumi.String("INT64"),
* },
* Disabled: pulumi.Bool(true),
* })
* 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.logging.Metric;
* import com.pulumi.gcp.logging.MetricArgs;
* import com.pulumi.gcp.logging.inputs.MetricMetricDescriptorArgs;
* 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 loggingMetric = new Metric("loggingMetric", MetricArgs.builder()
* .name("my-(custom)/metric")
* .filter("resource.type=gae_app AND severity>=ERROR")
* .metricDescriptor(MetricMetricDescriptorArgs.builder()
* .metricKind("DELTA")
* .valueType("INT64")
* .build())
* .disabled(true)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* loggingMetric:
* type: gcp:logging:Metric
* name: logging_metric
* properties:
* name: my-(custom)/metric
* filter: resource.type=gae_app AND severity>=ERROR
* metricDescriptor:
* metricKind: DELTA
* valueType: INT64
* disabled: true
* ```
*
* ## Import
* Metric can be imported using any of these accepted formats:
* * `{{project}} {{name}}`
* * `{{name}}`
* When using the `pulumi import` command, Metric can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:logging/metric:Metric default {{project}} {{name}}
* ```
* ```sh
* $ pulumi import gcp:logging/metric:Metric default {{name}}
* ```
*/
public class Metric internal constructor(
override val javaResource: com.pulumi.gcp.logging.Metric,
) : KotlinCustomResource(javaResource, MetricMapper) {
/**
* The resource name of the Log Bucket that owns the Log Metric. Only Log Buckets in projects
* are supported. The bucket has to be in the same project as the metric.
*/
public val bucketName: Output?
get() = javaResource.bucketName().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The bucketOptions are required when the logs-based metric is using a DISTRIBUTION value type and it
* describes the bucket boundaries used to create a histogram of the extracted values.
* Structure is documented below.
*/
public val bucketOptions: Output?
get() = javaResource.bucketOptions().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> metricBucketOptionsToKotlin(args0) })
}).orElse(null)
})
/**
* A description of this metric, which is used in documentation. The maximum length of the
* description is 8000 characters.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* If set to True, then this metric is disabled and it does not generate any points.
*/
public val disabled: Output?
get() = javaResource.disabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced-filters) which
* is used to match log entries.
* - - -
*/
public val filter: Output
get() = javaResource.filter().applyValue({ args0 -> args0 })
/**
* A map from a label key string to an extractor expression which is used to extract data from a log
* entry field and assign as the label value. Each label key specified in the LabelDescriptor must
* have an associated extractor expression in this map. The syntax of the extractor expression is
* the same as for the valueExtractor field.
*/
public val labelExtractors: Output
© 2015 - 2025 Weber Informatics LLC | Privacy Policy