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

com.pulumi.gcp.firebase.kotlin.Project.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.10.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

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

    public var args: ProjectArgs = ProjectArgs()

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

/**
 * A Google Cloud Firebase instance. This enables Firebase resources on a given google project.
 * Since a FirebaseProject is actually also a GCP Project, a FirebaseProject uses underlying GCP
 * identifiers (most importantly, the projectId) as its own for easy interop with GCP APIs.
 * Once Firebase has been added to a Google Project it cannot be removed.
 * To get more information about Project, see:
 * * [API documentation](https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects)
 * * How-to Guides
 *     * [Official Documentation](https://firebase.google.com/)
 * ## Example Usage
 * ### Firebase Project Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const _default = new gcp.organizations.Project("default", {
 *     projectId: "my-project",
 *     name: "my-project",
 *     orgId: "123456789",
 *     labels: {
 *         firebase: "enabled",
 *     },
 * });
 * const defaultProject = new gcp.firebase.Project("default", {project: _default.projectId});
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.organizations.Project("default",
 *     project_id="my-project",
 *     name="my-project",
 *     org_id="123456789",
 *     labels={
 *         "firebase": "enabled",
 *     })
 * default_project = gcp.firebase.Project("default", project=default.project_id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.Organizations.Project("default", new()
 *     {
 *         ProjectId = "my-project",
 *         Name = "my-project",
 *         OrgId = "123456789",
 *         Labels =
 *         {
 *             { "firebase", "enabled" },
 *         },
 *     });
 *     var defaultProject = new Gcp.Firebase.Project("default", new()
 *     {
 *         ProjectID = @default.ProjectId,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/firebase"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := organizations.NewProject(ctx, "default", &organizations.ProjectArgs{
 * 			ProjectId: pulumi.String("my-project"),
 * 			Name:      pulumi.String("my-project"),
 * 			OrgId:     pulumi.String("123456789"),
 * 			Labels: pulumi.StringMap{
 * 				"firebase": pulumi.String("enabled"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = firebase.NewProject(ctx, "default", &firebase.ProjectArgs{
 * 			Project: _default.ProjectId,
 * 		})
 * 		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.organizations.Project;
 * import com.pulumi.gcp.organizations.ProjectArgs;
 * import com.pulumi.gcp.firebase.Project;
 * import com.pulumi.gcp.firebase.ProjectArgs;
 * 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 Project("default", ProjectArgs.builder()
 *             .projectId("my-project")
 *             .name("my-project")
 *             .orgId("123456789")
 *             .labels(Map.of("firebase", "enabled"))
 *             .build());
 *         var defaultProject = new Project("defaultProject", ProjectArgs.builder()
 *             .project(default_.projectId())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:organizations:Project
 *     properties:
 *       projectId: my-project
 *       name: my-project
 *       orgId: '123456789'
 *       labels:
 *         firebase: enabled
 *   defaultProject:
 *     type: gcp:firebase:Project
 *     name: default
 *     properties:
 *       project: ${default.projectId}
 * ```
 * 
 * ## Import
 * Project can be imported using any of these accepted formats:
 * * `projects/{{project}}`
 * * `{{project}}`
 * When using the `pulumi import` command, Project can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:firebase/project:Project default projects/{{project}}
 * ```
 * ```sh
 * $ pulumi import gcp:firebase/project:Project default {{project}}
 * ```
 */
public class Project internal constructor(
    override val javaResource: com.pulumi.gcp.firebase.Project,
) : KotlinCustomResource(javaResource, ProjectMapper) {
    /**
     * The GCP project display name
     */
    public val displayName: Output
        get() = javaResource.displayName().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 })

    /**
     * The number of the google project that firebase is enabled on.
     */
    public val projectNumber: Output
        get() = javaResource.projectNumber().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy