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

com.pulumi.azure.appservice.kotlin.SourceControlToken.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.14.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

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

    public var args: SourceControlTokenArgs = SourceControlTokenArgs()

    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 SourceControlTokenArgsBuilder.() -> Unit) {
        val builder = SourceControlTokenArgsBuilder()
        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(): SourceControlToken {
        val builtJavaResource = com.pulumi.azure.appservice.SourceControlToken(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return SourceControlToken(builtJavaResource)
    }
}

/**
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.appservice.SourceControlToken("example", {
 *     type: "GitHub",
 *     token: "ghp_sometokenvaluesecretsauce",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.appservice.SourceControlToken("example",
 *     type="GitHub",
 *     token="ghp_sometokenvaluesecretsauce")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.AppService.SourceControlToken("example", new()
 *     {
 *         Type = "GitHub",
 *         Token = "ghp_sometokenvaluesecretsauce",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appservice"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := appservice.NewSourceControlToken(ctx, "example", &appservice.SourceControlTokenArgs{
 * 			Type:  pulumi.String("GitHub"),
 * 			Token: pulumi.String("ghp_sometokenvaluesecretsauce"),
 * 		})
 * 		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.azure.appservice.SourceControlToken;
 * import com.pulumi.azure.appservice.SourceControlTokenArgs;
 * 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 SourceControlToken("example", SourceControlTokenArgs.builder()
 *             .type("GitHub")
 *             .token("ghp_sometokenvaluesecretsauce")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:appservice:SourceControlToken
 *     properties:
 *       type: GitHub
 *       token: ghp_sometokenvaluesecretsauce
 * ```
 * 
 * ## Import
 * App Service Source GitHub Tokens can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:appservice/sourceControlToken:SourceControlToken example /providers/Microsoft.Web/sourceControls/GitHub
 * ```
 */
public class SourceControlToken internal constructor(
    override val javaResource: com.pulumi.azure.appservice.SourceControlToken,
) : KotlinCustomResource(javaResource, SourceControlTokenMapper) {
    /**
     * The Access Token.
     */
    public val token: Output
        get() = javaResource.token().applyValue({ args0 -> args0 })

    /**
     * The Access Token Secret.
     * > **NOTE:** The token used for deploying App Service needs the following permissions: `repo` and `workflow`.
     */
    public val tokenSecret: Output?
        get() = javaResource.tokenSecret().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Token type. Possible values include `Bitbucket`, `Dropbox`, `Github`, and `OneDrive`.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object SourceControlTokenMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.appservice.SourceControlToken::class == javaResource::class

    override fun map(javaResource: Resource): SourceControlToken = SourceControlToken(
        javaResource as
            com.pulumi.azure.appservice.SourceControlToken,
    )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy