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

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

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

package com.pulumi.azure.appservice.kotlin

import com.pulumi.azure.appservice.kotlin.outputs.StaticWebAppBasicAuth
import com.pulumi.azure.appservice.kotlin.outputs.StaticWebAppIdentity
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.Map
import com.pulumi.azure.appservice.kotlin.outputs.StaticWebAppBasicAuth.Companion.toKotlin as staticWebAppBasicAuthToKotlin
import com.pulumi.azure.appservice.kotlin.outputs.StaticWebAppIdentity.Companion.toKotlin as staticWebAppIdentityToKotlin

/**
 * Builder for [StaticWebApp].
 */
@PulumiTagMarker
public class StaticWebAppResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: StaticWebAppArgs = StaticWebAppArgs()

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

/**
 * Manages an App Service Static Web App.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleStaticWebApp = new azure.appservice.StaticWebApp("example", {
 *     name: "example",
 *     resourceGroupName: example.name,
 *     location: example.location,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_static_web_app = azure.appservice.StaticWebApp("example",
 *     name="example",
 *     resource_group_name=example.name,
 *     location=example.location)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleStaticWebApp = new Azure.AppService.StaticWebApp("example", new()
 *     {
 *         Name = "example",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appservice"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = appservice.NewStaticWebApp(ctx, "example", &appservice.StaticWebAppArgs{
 * 			Name:              pulumi.String("example"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 		})
 * 		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.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.appservice.StaticWebApp;
 * import com.pulumi.azure.appservice.StaticWebAppArgs;
 * 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 ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleStaticWebApp = new StaticWebApp("exampleStaticWebApp", StaticWebAppArgs.builder()
 *             .name("example")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleStaticWebApp:
 *     type: azure:appservice:StaticWebApp
 *     name: example
 *     properties:
 *       name: example
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 * ```
 * 
 * ## Import
 * Static Web Apps can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:appservice/staticWebApp:StaticWebApp example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Web/staticSites/my-static-site1
 * ```
 */
public class StaticWebApp internal constructor(
    override val javaResource: com.pulumi.azure.appservice.StaticWebApp,
) : KotlinCustomResource(javaResource, StaticWebAppMapper) {
    /**
     * The API key of this Static Web App, which is used for later interacting with this Static Web App from other clients, e.g. GitHub Action.
     */
    public val apiKey: Output
        get() = javaResource.apiKey().applyValue({ args0 -> args0 })

    /**
     * A key-value pair of App Settings.
     */
    public val appSettings: Output>?
        get() = javaResource.appSettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * A `basic_auth` block as defined below.
     */
    public val basicAuth: Output?
        get() = javaResource.basicAuth().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    staticWebAppBasicAuthToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Should changes to the configuration file be permitted. Defaults to `true`.
     */
    public val configurationFileChangesEnabled: Output?
        get() = javaResource.configurationFileChangesEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The default host name of the Static Web App.
     */
    public val defaultHostName: Output
        get() = javaResource.defaultHostName().applyValue({ args0 -> args0 })

    /**
     * An `identity` block as defined below.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    staticWebAppIdentityToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The Azure Region where the Static Web App should exist. Changing this forces a new Static Web App to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The name which should be used for this Static Web App. Changing this forces a new Static Web App to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Are Preview (Staging) environments enabled. Defaults to `true`.
     */
    public val previewEnvironmentsEnabled: Output?
        get() = javaResource.previewEnvironmentsEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the Resource Group where the Static Web App should exist. Changing this forces a new Static Web App to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * Specifies the SKU size of the Static Web App. Possible values are `Free` or `Standard`. Defaults to `Free`.
     */
    public val skuSize: Output?
        get() = javaResource.skuSize().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Specifies the SKU tier of the Static Web App. Possible values are `Free` or `Standard`. Defaults to `Free`.
     */
    public val skuTier: Output?
        get() = javaResource.skuTier().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * A mapping of tags to assign to the resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy