com.pulumi.gcp.compute.kotlin.ProjectMetadataItem.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.compute.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 [ProjectMetadataItem].
*/
@PulumiTagMarker
public class ProjectMetadataItemResourceBuilder internal constructor() {
public var name: String? = null
public var args: ProjectMetadataItemArgs = ProjectMetadataItemArgs()
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 ProjectMetadataItemArgsBuilder.() -> Unit) {
val builder = ProjectMetadataItemArgsBuilder()
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(): ProjectMetadataItem {
val builtJavaResource = com.pulumi.gcp.compute.ProjectMetadataItem(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return ProjectMetadataItem(builtJavaResource)
}
}
/**
* Manages a single key/value pair on metadata common to all instances for
* a project in GCE. Using `gcp.compute.ProjectMetadataItem` lets you
* manage a single key/value setting in the provider rather than the entire
* project metadata map.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const _default = new gcp.compute.ProjectMetadataItem("default", {
* key: "my_metadata",
* value: "my_value",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.compute.ProjectMetadataItem("default",
* key="my_metadata",
* value="my_value")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.Compute.ProjectMetadataItem("default", new()
* {
* Key = "my_metadata",
* Value = "my_value",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewProjectMetadataItem(ctx, "default", &compute.ProjectMetadataItemArgs{
* Key: pulumi.String("my_metadata"),
* Value: pulumi.String("my_value"),
* })
* 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.compute.ProjectMetadataItem;
* import com.pulumi.gcp.compute.ProjectMetadataItemArgs;
* 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 default_ = new ProjectMetadataItem("default", ProjectMetadataItemArgs.builder()
* .key("my_metadata")
* .value("my_value")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:compute:ProjectMetadataItem
* properties:
* key: my_metadata
* value: my_value
* ```
*
* ## Import
* Project metadata items can be imported using the `key`, e.g.
* * `{{key}}`
* When using the `pulumi import` command, project metadata items can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:compute/projectMetadataItem:ProjectMetadataItem default {{key}}
* ```
*/
public class ProjectMetadataItem internal constructor(
override val javaResource: com.pulumi.gcp.compute.ProjectMetadataItem,
) : KotlinCustomResource(javaResource, ProjectMetadataItemMapper) {
/**
* The metadata key to set.
*/
public val key: Output
get() = javaResource.key().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 })
/**
* The value to set for the given metadata key.
* - - -
*/
public val `value`: Output
get() = javaResource.`value`().applyValue({ args0 -> args0 })
}
public object ProjectMetadataItemMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.compute.ProjectMetadataItem::class == javaResource::class
override fun map(javaResource: Resource): ProjectMetadataItem = ProjectMetadataItem(
javaResource
as com.pulumi.gcp.compute.ProjectMetadataItem,
)
}
/**
* @see [ProjectMetadataItem].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [ProjectMetadataItem].
*/
public suspend fun projectMetadataItem(
name: String,
block: suspend ProjectMetadataItemResourceBuilder.() -> Unit,
): ProjectMetadataItem {
val builder = ProjectMetadataItemResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [ProjectMetadataItem].
* @param name The _unique_ name of the resulting resource.
*/
public fun projectMetadataItem(name: String): ProjectMetadataItem {
val builder = ProjectMetadataItemResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy