com.pulumi.gcp.resourcemanager.kotlin.Lien.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.resourcemanager.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
import kotlin.collections.List
/**
* Builder for [Lien].
*/
@PulumiTagMarker
public class LienResourceBuilder internal constructor() {
public var name: String? = null
public var args: LienArgs = LienArgs()
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 LienArgsBuilder.() -> Unit) {
val builder = LienArgsBuilder()
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(): Lien {
val builtJavaResource = com.pulumi.gcp.resourcemanager.Lien(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Lien(builtJavaResource)
}
}
/**
* A Lien represents an encumbrance on the actions that can be performed on a resource.
* ## Example Usage
* ### Resource Manager Lien
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const project = new gcp.organizations.Project("project", {
* projectId: "staging-project",
* name: "A very important project!",
* });
* const lien = new gcp.resourcemanager.Lien("lien", {
* parent: pulumi.interpolate`projects/${project.number}`,
* restrictions: ["resourcemanager.projects.delete"],
* origin: "machine-readable-explanation",
* reason: "This project is an important environment",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* project = gcp.organizations.Project("project",
* project_id="staging-project",
* name="A very important project!")
* lien = gcp.resourcemanager.Lien("lien",
* parent=project.number.apply(lambda number: f"projects/{number}"),
* restrictions=["resourcemanager.projects.delete"],
* origin="machine-readable-explanation",
* reason="This project is an important environment")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var project = new Gcp.Organizations.Project("project", new()
* {
* ProjectId = "staging-project",
* Name = "A very important project!",
* });
* var lien = new Gcp.ResourceManager.Lien("lien", new()
* {
* Parent = project.Number.Apply(number => $"projects/{number}"),
* Restrictions = new[]
* {
* "resourcemanager.projects.delete",
* },
* Origin = "machine-readable-explanation",
* Reason = "This project is an important environment",
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/resourcemanager"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* project, err := organizations.NewProject(ctx, "project", &organizations.ProjectArgs{
* ProjectId: pulumi.String("staging-project"),
* Name: pulumi.String("A very important project!"),
* })
* if err != nil {
* return err
* }
* _, err = resourcemanager.NewLien(ctx, "lien", &resourcemanager.LienArgs{
* Parent: project.Number.ApplyT(func(number string) (string, error) {
* return fmt.Sprintf("projects/%v", number), nil
* }).(pulumi.StringOutput),
* Restrictions: pulumi.StringArray{
* pulumi.String("resourcemanager.projects.delete"),
* },
* Origin: pulumi.String("machine-readable-explanation"),
* Reason: pulumi.String("This project is an important environment"),
* })
* 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.resourcemanager.Lien;
* import com.pulumi.gcp.resourcemanager.LienArgs;
* 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 project = new Project("project", ProjectArgs.builder()
* .projectId("staging-project")
* .name("A very important project!")
* .build());
* var lien = new Lien("lien", LienArgs.builder()
* .parent(project.number().applyValue(number -> String.format("projects/%s", number)))
* .restrictions("resourcemanager.projects.delete")
* .origin("machine-readable-explanation")
* .reason("This project is an important environment")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* lien:
* type: gcp:resourcemanager:Lien
* properties:
* parent: projects/${project.number}
* restrictions:
* - resourcemanager.projects.delete
* origin: machine-readable-explanation
* reason: This project is an important environment
* project:
* type: gcp:organizations:Project
* properties:
* projectId: staging-project
* name: A very important project!
* ```
*
* ## Import
* Lien can be imported using any of these accepted formats:
* * `{{parent}}/{{name}}`
* When using the `pulumi import` command, Lien can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:resourcemanager/lien:Lien default {{parent}}/{{name}}
* ```
*/
public class Lien internal constructor(
override val javaResource: com.pulumi.gcp.resourcemanager.Lien,
) : KotlinCustomResource(javaResource, LienMapper) {
/**
* Time of creation
*/
public val createTime: Output
get() = javaResource.createTime().applyValue({ args0 -> args0 })
/**
* A system-generated unique identifier for this Lien.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* A stable, user-visible/meaningful string identifying the origin
* of the Lien, intended to be inspected programmatically. Maximum length of
* 200 characters.
*/
public val origin: Output
get() = javaResource.origin().applyValue({ args0 -> args0 })
/**
* A reference to the resource this Lien is attached to.
* The server will validate the parent against those for which Liens are supported.
* Since a variety of objects can have Liens against them, you must provide the type
* prefix (e.g. "projects/my-project-name").
*/
public val parent: Output
get() = javaResource.parent().applyValue({ args0 -> args0 })
/**
* Concise user-visible strings indicating why an action cannot be performed
* on a resource. Maximum length of 200 characters.
*/
public val reason: Output
get() = javaResource.reason().applyValue({ args0 -> args0 })
/**
* The types of operations which should be blocked as a result of this Lien.
* Each value should correspond to an IAM permission. The server will validate
* the permissions against those for which Liens are supported. An empty
* list is meaningless and will be rejected.
* e.g. ['resourcemanager.projects.delete']
* - - -
*/
public val restrictions: Output>
get() = javaResource.restrictions().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
}
public object LienMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.resourcemanager.Lien::class == javaResource::class
override fun map(javaResource: Resource): Lien = Lien(
javaResource as
com.pulumi.gcp.resourcemanager.Lien,
)
}
/**
* @see [Lien].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Lien].
*/
public suspend fun lien(name: String, block: suspend LienResourceBuilder.() -> Unit): Lien {
val builder = LienResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Lien].
* @param name The _unique_ name of the resulting resource.
*/
public fun lien(name: String): Lien {
val builder = LienResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy