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

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

@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 [SourceCodeToken].
 */
@PulumiTagMarker
public class SourceCodeTokenResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: SourceCodeTokenArgs = SourceCodeTokenArgs()

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

/**
 * Manages an App Service source control token.
 * !> **NOTE:** This resource has been deprecated in version 5.0 of the provider and will be removed in version 6.0. Please use `azure.appservice.ServicePlan` resource instead.
 * > **NOTE:** Source Control Tokens are configured at the subscription level, not on each App Service - as such this can only be configured Subscription-wide
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.appservice.SourceCodeToken("example", {
 *     type: "GitHub",
 *     token: "7e57735e77e577e57",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.appservice.SourceCodeToken("example",
 *     type="GitHub",
 *     token="7e57735e77e577e57")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.AppService.SourceCodeToken("example", new()
 *     {
 *         Type = "GitHub",
 *         Token = "7e57735e77e577e57",
 *     });
 * });
 * ```
 * ```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.NewSourceCodeToken(ctx, "example", &appservice.SourceCodeTokenArgs{
 * 			Type:  pulumi.String("GitHub"),
 * 			Token: pulumi.String("7e57735e77e577e57"),
 * 		})
 * 		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.SourceCodeToken;
 * import com.pulumi.azure.appservice.SourceCodeTokenArgs;
 * 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 SourceCodeToken("example", SourceCodeTokenArgs.builder()
 *             .type("GitHub")
 *             .token("7e57735e77e577e57")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:appservice:SourceCodeToken
 *     properties:
 *       type: GitHub
 *       token: 7e57735e77e577e57
 * ```
 * 
 * ## Import
 * App Service Source Control Token's can be imported using the `type`, e.g.
 * ```sh
 * $ pulumi import azure:appservice/sourceCodeToken:SourceCodeToken example {type}
 * ```
 */
public class SourceCodeToken internal constructor(
    override val javaResource: com.pulumi.azure.appservice.SourceCodeToken,
) : KotlinCustomResource(javaResource, SourceCodeTokenMapper) {
    /**
     * The OAuth access token.
     */
    public val token: Output
        get() = javaResource.token().applyValue({ args0 -> args0 })

    /**
     * The OAuth access token secret.
     */
    public val tokenSecret: Output?
        get() = javaResource.tokenSecret().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The source control type. Possible values are `BitBucket`, `Dropbox`, `GitHub` and `OneDrive`.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy