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

com.pulumi.gcp.firebase.kotlin.HostingSite.kt Maven / Gradle / Ivy

@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

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

    public var args: HostingSiteArgs = HostingSiteArgs()

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

/**
 * ## Example Usage
 * ### Firebasehosting Site Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const _default = new gcp.firebase.HostingSite("default", {
 *     project: "my-project-name",
 *     siteId: "site-no-app",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.firebase.HostingSite("default",
 *     project="my-project-name",
 *     site_id="site-no-app")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.Firebase.HostingSite("default", new()
 *     {
 *         Project = "my-project-name",
 *         SiteId = "site-no-app",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/firebase"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := firebase.NewHostingSite(ctx, "default", &firebase.HostingSiteArgs{
 * 			Project: pulumi.String("my-project-name"),
 * 			SiteId:  pulumi.String("site-no-app"),
 * 		})
 * 		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.firebase.HostingSite;
 * import com.pulumi.gcp.firebase.HostingSiteArgs;
 * 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 default_ = new HostingSite("default", HostingSiteArgs.builder()
 *             .project("my-project-name")
 *             .siteId("site-no-app")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:firebase:HostingSite
 *     properties:
 *       project: my-project-name
 *       siteId: site-no-app
 * ```
 * 
 * ### Firebasehosting Site Full
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const _default = new gcp.firebase.WebApp("default", {
 *     project: "my-project-name",
 *     displayName: "Test web app for Firebase Hosting",
 * });
 * const full = new gcp.firebase.HostingSite("full", {
 *     project: "my-project-name",
 *     siteId: "site-with-app",
 *     appId: _default.appId,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.firebase.WebApp("default",
 *     project="my-project-name",
 *     display_name="Test web app for Firebase Hosting")
 * full = gcp.firebase.HostingSite("full",
 *     project="my-project-name",
 *     site_id="site-with-app",
 *     app_id=default.app_id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.Firebase.WebApp("default", new()
 *     {
 *         Project = "my-project-name",
 *         DisplayName = "Test web app for Firebase Hosting",
 *     });
 *     var full = new Gcp.Firebase.HostingSite("full", new()
 *     {
 *         Project = "my-project-name",
 *         SiteId = "site-with-app",
 *         AppId = @default.AppId,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/firebase"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := firebase.NewWebApp(ctx, "default", &firebase.WebAppArgs{
 * 			Project:     pulumi.String("my-project-name"),
 * 			DisplayName: pulumi.String("Test web app for Firebase Hosting"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = firebase.NewHostingSite(ctx, "full", &firebase.HostingSiteArgs{
 * 			Project: pulumi.String("my-project-name"),
 * 			SiteId:  pulumi.String("site-with-app"),
 * 			AppId:   _default.AppId,
 * 		})
 * 		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.firebase.WebApp;
 * import com.pulumi.gcp.firebase.WebAppArgs;
 * import com.pulumi.gcp.firebase.HostingSite;
 * import com.pulumi.gcp.firebase.HostingSiteArgs;
 * 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 default_ = new WebApp("default", WebAppArgs.builder()
 *             .project("my-project-name")
 *             .displayName("Test web app for Firebase Hosting")
 *             .build());
 *         var full = new HostingSite("full", HostingSiteArgs.builder()
 *             .project("my-project-name")
 *             .siteId("site-with-app")
 *             .appId(default_.appId())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:firebase:WebApp
 *     properties:
 *       project: my-project-name
 *       displayName: Test web app for Firebase Hosting
 *   full:
 *     type: gcp:firebase:HostingSite
 *     properties:
 *       project: my-project-name
 *       siteId: site-with-app
 *       appId: ${default.appId}
 * ```
 * 
 * ## Import
 * Site can be imported using any of these accepted formats:
 * * `projects/{{project}}/sites/{{site_id}}`
 * * `{{project}}/{{site_id}}`
 * * `sites/{{site_id}}`
 * * `{{site_id}}`
 * When using the `pulumi import` command, Site can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:firebase/hostingSite:HostingSite default projects/{{project}}/sites/{{site_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:firebase/hostingSite:HostingSite default {{project}}/{{site_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:firebase/hostingSite:HostingSite default sites/{{site_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:firebase/hostingSite:HostingSite default {{site_id}}
 * ```
 */
public class HostingSite internal constructor(
    override val javaResource: com.pulumi.gcp.firebase.HostingSite,
) : KotlinCustomResource(javaResource, HostingSiteMapper) {
    /**
     * Optional. The [ID of a Web App](https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects.webApps#WebApp.FIELDS.app_id)
     * associated with the Hosting site.
     */
    public val appId: Output?
        get() = javaResource.appId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The default URL for the site in the form of https://{name}.web.app
     */
    public val defaultUrl: Output
        get() = javaResource.defaultUrl().applyValue({ args0 -> args0 })

    /**
     * Output only. The fully-qualified resource name of the Hosting site, in
     * the format: projects/PROJECT_IDENTIFIER/sites/SITE_ID PROJECT_IDENTIFIER: the
     * Firebase project's
     * [`ProjectNumber`](https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects#FirebaseProject.FIELDS.project_number) ***(recommended)*** or its
     * [`ProjectId`](https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects#FirebaseProject.FIELDS.project_id).
     * Learn more about using project identifiers in Google's
     * [AIP 2510 standard](https://google.aip.dev/cloud/2510).
     */
    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 })

    /**
     * Required. Immutable. A globally unique identifier for the Hosting site. This identifier is
     * used to construct the Firebase-provisioned subdomains for the site, so it must also be a valid
     * domain name label.
     */
    public val siteId: Output?
        get() = javaResource.siteId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy