com.pulumi.gitlab.kotlin.UserCustomAttribute.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gitlab-kotlin Show documentation
Show all versions of pulumi-gitlab-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.gitlab.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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
/**
* Builder for [UserCustomAttribute].
*/
@PulumiTagMarker
public class UserCustomAttributeResourceBuilder internal constructor() {
public var name: String? = null
public var args: UserCustomAttributeArgs = UserCustomAttributeArgs()
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 UserCustomAttributeArgsBuilder.() -> Unit) {
val builder = UserCustomAttributeArgsBuilder()
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(): UserCustomAttribute {
val builtJavaResource = com.pulumi.gitlab.UserCustomAttribute(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return UserCustomAttribute(builtJavaResource)
}
}
/**
* The `gitlab.UserCustomAttribute` resource allows to manage custom attributes for a user.
* **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/ee/api/custom_attributes.html)
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gitlab from "@pulumi/gitlab";
* const attr = new gitlab.UserCustomAttribute("attr", {
* user: 42,
* key: "location",
* value: "Greenland",
* });
* ```
* ```python
* import pulumi
* import pulumi_gitlab as gitlab
* attr = gitlab.UserCustomAttribute("attr",
* user=42,
* key="location",
* value="Greenland")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using GitLab = Pulumi.GitLab;
* return await Deployment.RunAsync(() =>
* {
* var attr = new GitLab.UserCustomAttribute("attr", new()
* {
* User = 42,
* Key = "location",
* Value = "Greenland",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gitlab/sdk/v8/go/gitlab"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := gitlab.NewUserCustomAttribute(ctx, "attr", &gitlab.UserCustomAttributeArgs{
* User: pulumi.Int(42),
* Key: pulumi.String("location"),
* Value: pulumi.String("Greenland"),
* })
* 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.gitlab.UserCustomAttribute;
* import com.pulumi.gitlab.UserCustomAttributeArgs;
* 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 attr = new UserCustomAttribute("attr", UserCustomAttributeArgs.builder()
* .user("42")
* .key("location")
* .value("Greenland")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* attr:
* type: gitlab:UserCustomAttribute
* properties:
* user: '42'
* key: location
* value: Greenland
* ```
*
* ## Import
* You can import a user custom attribute using an id made up of `{user-id}:{key}`, e.g.
* ```sh
* $ pulumi import gitlab:index/userCustomAttribute:UserCustomAttribute attr 42:location
* ```
*/
public class UserCustomAttribute internal constructor(
override val javaResource: com.pulumi.gitlab.UserCustomAttribute,
) : KotlinCustomResource(javaResource, UserCustomAttributeMapper) {
/**
* Key for the Custom Attribute.
*/
public val key: Output
get() = javaResource.key().applyValue({ args0 -> args0 })
/**
* The id of the user.
*/
public val user: Output
get() = javaResource.user().applyValue({ args0 -> args0 })
/**
* Value for the Custom Attribute.
*/
public val `value`: Output
get() = javaResource.`value`().applyValue({ args0 -> args0 })
}
public object UserCustomAttributeMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gitlab.UserCustomAttribute::class == javaResource::class
override fun map(javaResource: Resource): UserCustomAttribute = UserCustomAttribute(
javaResource
as com.pulumi.gitlab.UserCustomAttribute,
)
}
/**
* @see [UserCustomAttribute].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [UserCustomAttribute].
*/
public suspend fun userCustomAttribute(
name: String,
block: suspend UserCustomAttributeResourceBuilder.() -> Unit,
): UserCustomAttribute {
val builder = UserCustomAttributeResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [UserCustomAttribute].
* @param name The _unique_ name of the resulting resource.
*/
public fun userCustomAttribute(name: String): UserCustomAttribute {
val builder = UserCustomAttributeResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy