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

com.pulumi.gcp.firebase.kotlin.WebApp.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: 8.12.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

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

    public var args: WebAppArgs = WebAppArgs()

    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 WebAppArgsBuilder.() -> Unit) {
        val builder = WebAppArgsBuilder()
        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(): WebApp {
        val builtJavaResource = com.pulumi.gcp.firebase.WebApp(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return WebApp(builtJavaResource)
    }
}

/**
 * A Google Cloud Firebase web application instance
 * To get more information about WebApp, see:
 * * [API documentation](https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects.webApps)
 * * How-to Guides
 *     * [Official Documentation](https://firebase.google.com/)
 * ## Example Usage
 * ### Firebase Web App Custom Api Key
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const web = new gcp.projects.ApiKey("web", {
 *     project: "my-project-name",
 *     name: "api-key",
 *     displayName: "Display Name",
 *     restrictions: {
 *         browserKeyRestrictions: {
 *             allowedReferrers: ["*"],
 *         },
 *     },
 * });
 * const _default = new gcp.firebase.WebApp("default", {
 *     project: "my-project-name",
 *     displayName: "Display Name",
 *     apiKeyId: web.uid,
 *     deletionPolicy: "DELETE",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * web = gcp.projects.ApiKey("web",
 *     project="my-project-name",
 *     name="api-key",
 *     display_name="Display Name",
 *     restrictions=gcp.projects.ApiKeyRestrictionsArgs(
 *         browser_key_restrictions=gcp.projects.ApiKeyRestrictionsBrowserKeyRestrictionsArgs(
 *             allowed_referrers=["*"],
 *         ),
 *     ))
 * default = gcp.firebase.WebApp("default",
 *     project="my-project-name",
 *     display_name="Display Name",
 *     api_key_id=web.uid,
 *     deletion_policy="DELETE")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var web = new Gcp.Projects.ApiKey("web", new()
 *     {
 *         Project = "my-project-name",
 *         Name = "api-key",
 *         DisplayName = "Display Name",
 *         Restrictions = new Gcp.Projects.Inputs.ApiKeyRestrictionsArgs
 *         {
 *             BrowserKeyRestrictions = new Gcp.Projects.Inputs.ApiKeyRestrictionsBrowserKeyRestrictionsArgs
 *             {
 *                 AllowedReferrers = new[]
 *                 {
 *                     "*",
 *                 },
 *             },
 *         },
 *     });
 *     var @default = new Gcp.Firebase.WebApp("default", new()
 *     {
 *         Project = "my-project-name",
 *         DisplayName = "Display Name",
 *         ApiKeyId = web.Uid,
 *         DeletionPolicy = "DELETE",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/firebase"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		web, err := projects.NewApiKey(ctx, "web", &projects.ApiKeyArgs{
 * 			Project:     pulumi.String("my-project-name"),
 * 			Name:        pulumi.String("api-key"),
 * 			DisplayName: pulumi.String("Display Name"),
 * 			Restrictions: &projects.ApiKeyRestrictionsArgs{
 * 				BrowserKeyRestrictions: &projects.ApiKeyRestrictionsBrowserKeyRestrictionsArgs{
 * 					AllowedReferrers: pulumi.StringArray{
 * 						pulumi.String("*"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = firebase.NewWebApp(ctx, "default", &firebase.WebAppArgs{
 * 			Project:        pulumi.String("my-project-name"),
 * 			DisplayName:    pulumi.String("Display Name"),
 * 			ApiKeyId:       web.Uid,
 * 			DeletionPolicy: pulumi.String("DELETE"),
 * 		})
 * 		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.gcp.projects.ApiKey;
 * import com.pulumi.gcp.projects.ApiKeyArgs;
 * import com.pulumi.gcp.projects.inputs.ApiKeyRestrictionsArgs;
 * import com.pulumi.gcp.projects.inputs.ApiKeyRestrictionsBrowserKeyRestrictionsArgs;
 * import com.pulumi.gcp.firebase.WebApp;
 * import com.pulumi.gcp.firebase.WebAppArgs;
 * 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 web = new ApiKey("web", ApiKeyArgs.builder()
 *             .project("my-project-name")
 *             .name("api-key")
 *             .displayName("Display Name")
 *             .restrictions(ApiKeyRestrictionsArgs.builder()
 *                 .browserKeyRestrictions(ApiKeyRestrictionsBrowserKeyRestrictionsArgs.builder()
 *                     .allowedReferrers("*")
 *                     .build())
 *                 .build())
 *             .build());
 *         var default_ = new WebApp("default", WebAppArgs.builder()
 *             .project("my-project-name")
 *             .displayName("Display Name")
 *             .apiKeyId(web.uid())
 *             .deletionPolicy("DELETE")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:firebase:WebApp
 *     properties:
 *       project: my-project-name
 *       displayName: Display Name
 *       apiKeyId: ${web.uid}
 *       deletionPolicy: DELETE
 *   web:
 *     type: gcp:projects:ApiKey
 *     properties:
 *       project: my-project-name
 *       name: api-key
 *       displayName: Display Name
 *       restrictions:
 *         browserKeyRestrictions:
 *           allowedReferrers:
 *             - '*'
 * ```
 * 
 * ## Import
 * WebApp can be imported using any of these accepted formats:
 * * `{{project}} projects/{{project}}/webApps/{{app_id}}`
 * * `projects/{{project}}/webApps/{{app_id}}`
 * * `{{project}}/{{project}}/{{app_id}}`
 * * `webApps/{{app_id}}`
 * * `{{app_id}}`
 * When using the `pulumi import` command, WebApp can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:firebase/webApp:WebApp default {{project}} projects/{{project}}/webApps/{{app_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:firebase/webApp:WebApp default projects/{{project}}/webApps/{{app_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:firebase/webApp:WebApp default {{project}}/{{project}}/{{app_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:firebase/webApp:WebApp default webApps/{{app_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:firebase/webApp:WebApp default {{app_id}}
 * ```
 */
public class WebApp internal constructor(
    override val javaResource: com.pulumi.gcp.firebase.WebApp,
) : KotlinCustomResource(javaResource, WebAppMapper) {
    /**
     * The globally unique, Google-assigned identifier (UID) for the Firebase API key associated with the WebApp.
     * If apiKeyId is not set during creation, then Firebase automatically associates an apiKeyId with the WebApp.
     * This auto-associated key may be an existing valid key or, if no valid key exists, a new one will be provisioned.
     */
    public val apiKeyId: Output
        get() = javaResource.apiKeyId().applyValue({ args0 -> args0 })

    /**
     * The globally unique, Firebase-assigned identifier of the App.
     * This identifier should be treated as an opaque token, as the data format is not specified.
     */
    public val appId: Output
        get() = javaResource.appId().applyValue({ args0 -> args0 })

    /**
     * The URLs where the `WebApp` is hosted.
     */
    public val appUrls: Output>
        get() = javaResource.appUrls().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    public val deletionPolicy: Output?
        get() = javaResource.deletionPolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The user-assigned display name of the App.
     * - - -
     */
    public val displayName: Output
        get() = javaResource.displayName().applyValue({ args0 -> args0 })

    /**
     * The fully qualified resource name of the App, for example:
     * projects/projectId/webApps/appId
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })
}

public object WebAppMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.firebase.WebApp::class == javaResource::class

    override fun map(javaResource: Resource): WebApp = WebApp(
        javaResource as
            com.pulumi.gcp.firebase.WebApp,
    )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy