com.pulumi.gcp.monitoring.kotlin.MonitoredProject.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 [MonitoredProject].
*/
@PulumiTagMarker
public class MonitoredProjectResourceBuilder internal constructor() {
public var name: String? = null
public var args: MonitoredProjectArgs = MonitoredProjectArgs()
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 MonitoredProjectArgsBuilder.() -> Unit) {
val builder = MonitoredProjectArgsBuilder()
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(): MonitoredProject {
val builtJavaResource = com.pulumi.gcp.monitoring.MonitoredProject(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return MonitoredProject(builtJavaResource)
}
}
/**
* A [project being monitored](https://cloud.google.com/monitoring/settings/multiple-projects#create-multi) by a Metrics Scope.
* To get more information about MonitoredProject, see:
* * [API documentation](https://cloud.google.com/monitoring/api/ref_v3/rest/v1/locations.global.metricsScopes.projects)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/monitoring/settings/manage-api)
* ## Example Usage
* ### Monitoring Monitored Project Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const basic = new gcp.organizations.Project("basic", {
* projectId: "m-id",
* name: "m-id-display",
* orgId: "123456789",
* });
* const primary = new gcp.monitoring.MonitoredProject("primary", {
* metricsScope: "my-project-name",
* name: basic.projectId,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* basic = gcp.organizations.Project("basic",
* project_id="m-id",
* name="m-id-display",
* org_id="123456789")
* primary = gcp.monitoring.MonitoredProject("primary",
* metrics_scope="my-project-name",
* name=basic.project_id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var basic = new Gcp.Organizations.Project("basic", new()
* {
* ProjectId = "m-id",
* Name = "m-id-display",
* OrgId = "123456789",
* });
* var primary = new Gcp.Monitoring.MonitoredProject("primary", new()
* {
* MetricsScope = "my-project-name",
* Name = basic.ProjectId,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/monitoring"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* basic, err := organizations.NewProject(ctx, "basic", &organizations.ProjectArgs{
* ProjectId: pulumi.String("m-id"),
* Name: pulumi.String("m-id-display"),
* OrgId: pulumi.String("123456789"),
* })
* if err != nil {
* return err
* }
* _, err = monitoring.NewMonitoredProject(ctx, "primary", &monitoring.MonitoredProjectArgs{
* MetricsScope: pulumi.String("my-project-name"),
* Name: basic.ProjectId,
* })
* 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.organizations.Project;
* import com.pulumi.gcp.organizations.ProjectArgs;
* import com.pulumi.gcp.monitoring.MonitoredProject;
* import com.pulumi.gcp.monitoring.MonitoredProjectArgs;
* 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 Project("basic", ProjectArgs.builder()
* .projectId("m-id")
* .name("m-id-display")
* .orgId("123456789")
* .build());
* var primary = new MonitoredProject("primary", MonitoredProjectArgs.builder()
* .metricsScope("my-project-name")
* .name(basic.projectId())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* primary:
* type: gcp:monitoring:MonitoredProject
* properties:
* metricsScope: my-project-name
* name: ${basic.projectId}
* basic:
* type: gcp:organizations:Project
* properties:
* projectId: m-id
* name: m-id-display
* orgId: '123456789'
* ```
*
* ## Import
* MonitoredProject can be imported using any of these accepted formats:
* * `v1/locations/global/metricsScopes/{{name}}`
* * `{{name}}`
* When using the `pulumi import` command, MonitoredProject can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:monitoring/monitoredProject:MonitoredProject default v1/locations/global/metricsScopes/{{name}}
* ```
* ```sh
* $ pulumi import gcp:monitoring/monitoredProject:MonitoredProject default {{name}}
* ```
*/
public class MonitoredProject internal constructor(
override val javaResource: com.pulumi.gcp.monitoring.MonitoredProject,
) : KotlinCustomResource(javaResource, MonitoredProjectMapper) {
/**
* Output only. The time when this `MonitoredProject` was created.
*/
public val createTime: Output
get() = javaResource.createTime().applyValue({ args0 -> args0 })
/**
* Required. The resource name of the existing Metrics Scope that will monitor this project. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}
* - - -
*/
public val metricsScope: Output
get() = javaResource.metricsScope().applyValue({ args0 -> args0 })
/**
* Immutable. The resource name of the `MonitoredProject`. On input, the resource name includes the scoping project ID and monitored project ID. On output, it contains the equivalent project numbers. Example: `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
}
public object MonitoredProjectMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.monitoring.MonitoredProject::class == javaResource::class
override fun map(javaResource: Resource): MonitoredProject = MonitoredProject(
javaResource as
com.pulumi.gcp.monitoring.MonitoredProject,
)
}
/**
* @see [MonitoredProject].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [MonitoredProject].
*/
public suspend fun monitoredProject(
name: String,
block: suspend MonitoredProjectResourceBuilder.() -> Unit,
): MonitoredProject {
val builder = MonitoredProjectResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [MonitoredProject].
* @param name The _unique_ name of the resulting resource.
*/
public fun monitoredProject(name: String): MonitoredProject {
val builder = MonitoredProjectResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy