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

com.pulumi.vault.github.kotlin.Team.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.vault.github.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 [Team].
 */
@PulumiTagMarker
public class TeamResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: TeamArgs = TeamArgs()

    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 TeamArgsBuilder.() -> Unit) {
        val builder = TeamArgsBuilder()
        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(): Team {
        val builtJavaResource = com.pulumi.vault.github.Team(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Team(builtJavaResource)
    }
}

/**
 * Manages policy mappings for Github Teams authenticated via Github. See the [Vault
 * documentation](https://www.vaultproject.io/docs/auth/github/) for more
 * information.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const example = new vault.github.AuthBackend("example", {organization: "myorg"});
 * const tfDevs = new vault.github.Team("tf_devs", {
 *     backend: example.id,
 *     team: "terraform-developers",
 *     policies: [
 *         "developer",
 *         "read-only",
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * example = vault.github.AuthBackend("example", organization="myorg")
 * tf_devs = vault.github.Team("tf_devs",
 *     backend=example.id,
 *     team="terraform-developers",
 *     policies=[
 *         "developer",
 *         "read-only",
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Vault.GitHub.AuthBackend("example", new()
 *     {
 *         Organization = "myorg",
 *     });
 *     var tfDevs = new Vault.GitHub.Team("tf_devs", new()
 *     {
 *         Backend = example.Id,
 *         TeamCity = "terraform-developers",
 *         Policies = new[]
 *         {
 *             "developer",
 *             "read-only",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/github"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := github.NewAuthBackend(ctx, "example", &github.AuthBackendArgs{
 * 			Organization: pulumi.String("myorg"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = github.NewTeam(ctx, "tf_devs", &github.TeamArgs{
 * 			Backend: example.ID(),
 * 			Team:    pulumi.String("terraform-developers"),
 * 			Policies: pulumi.StringArray{
 * 				pulumi.String("developer"),
 * 				pulumi.String("read-only"),
 * 			},
 * 		})
 * 		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.vault.github.AuthBackend;
 * import com.pulumi.vault.github.AuthBackendArgs;
 * import com.pulumi.vault.github.Team;
 * import com.pulumi.vault.github.TeamArgs;
 * 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 example = new AuthBackend("example", AuthBackendArgs.builder()
 *             .organization("myorg")
 *             .build());
 *         var tfDevs = new Team("tfDevs", TeamArgs.builder()
 *             .backend(example.id())
 *             .team("terraform-developers")
 *             .policies(
 *                 "developer",
 *                 "read-only")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: vault:github:AuthBackend
 *     properties:
 *       organization: myorg
 *   tfDevs:
 *     type: vault:github:Team
 *     name: tf_devs
 *     properties:
 *       backend: ${example.id}
 *       team: terraform-developers
 *       policies:
 *         - developer
 *         - read-only
 * ```
 * 
 * ## Import
 * Github team mappings can be imported using the `path`, e.g.
 * ```sh
 * $ pulumi import vault:github/team:Team tf_devs auth/github/map/teams/terraform-developers
 * ```
 */
public class Team internal constructor(
    override val javaResource: com.pulumi.vault.github.Team,
) : KotlinCustomResource(javaResource, TeamMapper) {
    /**
     * Path where the github auth backend is mounted. Defaults to `github`
     * if not specified.
     */
    public val backend: Output?
        get() = javaResource.backend().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The namespace to provision the resource in.
     * The value should not contain leading or trailing forward slashes.
     * The `namespace` is always relative to the provider's configured [namespace](https://www.terraform.io/docs/providers/vault/index.html#namespace).
     * *Available only for Vault Enterprise*.
     */
    public val namespace: Output?
        get() = javaResource.namespace().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * An array of strings specifying the policies to be set on tokens
     * issued using this role.
     */
    public val policies: Output>?
        get() = javaResource.policies().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * GitHub team name in "slugified" format.
     */
    public val team: Output
        get() = javaResource.team().applyValue({ args0 -> args0 })
}

public object TeamMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.vault.github.Team::class == javaResource::class

    override fun map(javaResource: Resource): Team = Team(
        javaResource as
            com.pulumi.vault.github.Team,
    )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy