All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.gcp.monitoring.kotlin.Group.kt Maven / Gradle / Ivy

@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 [Group].
 */
@PulumiTagMarker
public class GroupResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: GroupArgs = GroupArgs()

    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 GroupArgsBuilder.() -> Unit) {
        val builder = GroupArgsBuilder()
        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(): Group {
        val builtJavaResource = com.pulumi.gcp.monitoring.Group(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Group(builtJavaResource)
    }
}

/**
 * The description of a dynamic collection of monitored resources. Each group
 * has a filter that is matched against monitored resources and their
 * associated metadata. If a group's filter matches an available monitored
 * resource, then that resource is a member of that group.
 * To get more information about Group, see:
 * * [API documentation](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.groups)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/monitoring/groups/)
 * ## Example Usage
 * ### Monitoring Group Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const basic = new gcp.monitoring.Group("basic", {
 *     displayName: "tf-test MonitoringGroup",
 *     filter: "resource.metadata.region=\"europe-west2\"",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * basic = gcp.monitoring.Group("basic",
 *     display_name="tf-test MonitoringGroup",
 *     filter="resource.metadata.region=\"europe-west2\"")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var basic = new Gcp.Monitoring.Group("basic", new()
 *     {
 *         DisplayName = "tf-test MonitoringGroup",
 *         Filter = "resource.metadata.region=\"europe-west2\"",
 *     });
 * });
 * ```
 * ```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.NewGroup(ctx, "basic", &monitoring.GroupArgs{
 * 			DisplayName: pulumi.String("tf-test MonitoringGroup"),
 * 			Filter:      pulumi.String("resource.metadata.region=\"europe-west2\""),
 * 		})
 * 		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.Group;
 * import com.pulumi.gcp.monitoring.GroupArgs;
 * 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 basic = new Group("basic", GroupArgs.builder()
 *             .displayName("tf-test MonitoringGroup")
 *             .filter("resource.metadata.region=\"europe-west2\"")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   basic:
 *     type: gcp:monitoring:Group
 *     properties:
 *       displayName: tf-test MonitoringGroup
 *       filter: resource.metadata.region="europe-west2"
 * ```
 * 
 * ### Monitoring Group Subgroup
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const parent = new gcp.monitoring.Group("parent", {
 *     displayName: "tf-test MonitoringParentGroup",
 *     filter: "resource.metadata.region=\"europe-west2\"",
 * });
 * const subgroup = new gcp.monitoring.Group("subgroup", {
 *     displayName: "tf-test MonitoringSubGroup",
 *     filter: "resource.metadata.region=\"europe-west2\"",
 *     parentName: parent.name,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * parent = gcp.monitoring.Group("parent",
 *     display_name="tf-test MonitoringParentGroup",
 *     filter="resource.metadata.region=\"europe-west2\"")
 * subgroup = gcp.monitoring.Group("subgroup",
 *     display_name="tf-test MonitoringSubGroup",
 *     filter="resource.metadata.region=\"europe-west2\"",
 *     parent_name=parent.name)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var parent = new Gcp.Monitoring.Group("parent", new()
 *     {
 *         DisplayName = "tf-test MonitoringParentGroup",
 *         Filter = "resource.metadata.region=\"europe-west2\"",
 *     });
 *     var subgroup = new Gcp.Monitoring.Group("subgroup", new()
 *     {
 *         DisplayName = "tf-test MonitoringSubGroup",
 *         Filter = "resource.metadata.region=\"europe-west2\"",
 *         ParentName = parent.Name,
 *     });
 * });
 * ```
 * ```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 {
 * 		parent, err := monitoring.NewGroup(ctx, "parent", &monitoring.GroupArgs{
 * 			DisplayName: pulumi.String("tf-test MonitoringParentGroup"),
 * 			Filter:      pulumi.String("resource.metadata.region=\"europe-west2\""),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = monitoring.NewGroup(ctx, "subgroup", &monitoring.GroupArgs{
 * 			DisplayName: pulumi.String("tf-test MonitoringSubGroup"),
 * 			Filter:      pulumi.String("resource.metadata.region=\"europe-west2\""),
 * 			ParentName:  parent.Name,
 * 		})
 * 		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.Group;
 * import com.pulumi.gcp.monitoring.GroupArgs;
 * 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 parent = new Group("parent", GroupArgs.builder()
 *             .displayName("tf-test MonitoringParentGroup")
 *             .filter("resource.metadata.region=\"europe-west2\"")
 *             .build());
 *         var subgroup = new Group("subgroup", GroupArgs.builder()
 *             .displayName("tf-test MonitoringSubGroup")
 *             .filter("resource.metadata.region=\"europe-west2\"")
 *             .parentName(parent.name())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   parent:
 *     type: gcp:monitoring:Group
 *     properties:
 *       displayName: tf-test MonitoringParentGroup
 *       filter: resource.metadata.region="europe-west2"
 *   subgroup:
 *     type: gcp:monitoring:Group
 *     properties:
 *       displayName: tf-test MonitoringSubGroup
 *       filter: resource.metadata.region="europe-west2"
 *       parentName: ${parent.name}
 * ```
 * 
 * ## Import
 * Group can be imported using any of these accepted formats:
 * * `{{name}}`
 * When using the `pulumi import` command, Group can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:monitoring/group:Group default {{name}}
 * ```
 */
public class Group internal constructor(
    override val javaResource: com.pulumi.gcp.monitoring.Group,
) : KotlinCustomResource(javaResource, GroupMapper) {
    /**
     * A user-assigned name for this group, used only for display
     * purposes.
     */
    public val displayName: Output
        get() = javaResource.displayName().applyValue({ args0 -> args0 })

    /**
     * The filter used to determine which monitored resources
     * belong to this group.
     * - - -
     */
    public val filter: Output
        get() = javaResource.filter().applyValue({ args0 -> args0 })

    /**
     * If true, the members of this group are considered to be a
     * cluster. The system can perform additional analysis on
     * groups that are clusters.
     */
    public val isCluster: Output?
        get() = javaResource.isCluster().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * A unique identifier for this group. The format is
     * "projects/{project_id_or_number}/groups/{group_id}".
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The name of the group's parent, if it has one. The format is
     * "projects/{project_id_or_number}/groups/{group_id}". For
     * groups with no parent, parentName is the empty string, "".
     */
    public val parentName: Output?
        get() = javaResource.parentName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * 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 GroupMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.monitoring.Group::class == javaResource::class

    override fun map(javaResource: Resource): Group = Group(
        javaResource as
            com.pulumi.gcp.monitoring.Group,
    )
}

/**
 * @see [Group].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [Group].
 */
public suspend fun group(name: String, block: suspend GroupResourceBuilder.() -> Unit): Group {
    val builder = GroupResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [Group].
 * @param name The _unique_ name of the resulting resource.
 */
public fun group(name: String): Group {
    val builder = GroupResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy