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

com.pulumi.gcp.appengine.kotlin.Application.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.appengine.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.appengine.kotlin.outputs.ApplicationFeatureSettings
import com.pulumi.gcp.appengine.kotlin.outputs.ApplicationIap
import com.pulumi.gcp.appengine.kotlin.outputs.ApplicationUrlDispatchRule
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
import com.pulumi.gcp.appengine.kotlin.outputs.ApplicationFeatureSettings.Companion.toKotlin as applicationFeatureSettingsToKotlin
import com.pulumi.gcp.appengine.kotlin.outputs.ApplicationIap.Companion.toKotlin as applicationIapToKotlin
import com.pulumi.gcp.appengine.kotlin.outputs.ApplicationUrlDispatchRule.Companion.toKotlin as applicationUrlDispatchRuleToKotlin

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

    public var args: ApplicationArgs = ApplicationArgs()

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

/**
 * Allows creation and management of an App Engine application.
 * > App Engine applications cannot be deleted once they're created; you have to delete the
 *    entire project to delete the application. This provider will report the application has been
 *    successfully deleted; this is a limitation of the provider, and will go away in the future.
 *    This provider is not able to delete App Engine applications.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const myProject = new gcp.organizations.Project("my_project", {
 *     name: "My Project",
 *     projectId: "your-project-id",
 *     orgId: "1234567",
 * });
 * const app = new gcp.appengine.Application("app", {
 *     project: myProject.projectId,
 *     locationId: "us-central",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * my_project = gcp.organizations.Project("my_project",
 *     name="My Project",
 *     project_id="your-project-id",
 *     org_id="1234567")
 * app = gcp.appengine.Application("app",
 *     project=my_project.project_id,
 *     location_id="us-central")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var myProject = new Gcp.Organizations.Project("my_project", new()
 *     {
 *         Name = "My Project",
 *         ProjectId = "your-project-id",
 *         OrgId = "1234567",
 *     });
 *     var app = new Gcp.AppEngine.Application("app", new()
 *     {
 *         Project = myProject.ProjectId,
 *         LocationId = "us-central",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/appengine"
 * 	"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 {
 * 		myProject, err := organizations.NewProject(ctx, "my_project", &organizations.ProjectArgs{
 * 			Name:      pulumi.String("My Project"),
 * 			ProjectId: pulumi.String("your-project-id"),
 * 			OrgId:     pulumi.String("1234567"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = appengine.NewApplication(ctx, "app", &appengine.ApplicationArgs{
 * 			Project:    myProject.ProjectId,
 * 			LocationId: pulumi.String("us-central"),
 * 		})
 * 		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.appengine.Application;
 * import com.pulumi.gcp.appengine.ApplicationArgs;
 * 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 myProject = new Project("myProject", ProjectArgs.builder()
 *             .name("My Project")
 *             .projectId("your-project-id")
 *             .orgId("1234567")
 *             .build());
 *         var app = new Application("app", ApplicationArgs.builder()
 *             .project(myProject.projectId())
 *             .locationId("us-central")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   myProject:
 *     type: gcp:organizations:Project
 *     name: my_project
 *     properties:
 *       name: My Project
 *       projectId: your-project-id
 *       orgId: '1234567'
 *   app:
 *     type: gcp:appengine:Application
 *     properties:
 *       project: ${myProject.projectId}
 *       locationId: us-central
 * ```
 * 
 * ## Import
 * Applications can be imported using the ID of the project the application belongs to, e.g.
 * * `{{project-id}}`
 * When using the `pulumi import` command, Applications can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:appengine/application:Application default {{project-id}}
 * ```
 */
public class Application internal constructor(
    override val javaResource: com.pulumi.gcp.appengine.Application,
) : KotlinCustomResource(javaResource, ApplicationMapper) {
    /**
     * Identifier of the app, usually `{PROJECT_ID}`
     */
    public val appId: Output
        get() = javaResource.appId().applyValue({ args0 -> args0 })

    /**
     * The domain to authenticate users with when using App Engine's User API.
     */
    public val authDomain: Output
        get() = javaResource.authDomain().applyValue({ args0 -> args0 })

    /**
     * The GCS bucket code is being stored in for this app.
     */
    public val codeBucket: Output
        get() = javaResource.codeBucket().applyValue({ args0 -> args0 })

    /**
     * The type of the Cloud Firestore or Cloud Datastore database associated with this application.
     * Can be `CLOUD_FIRESTORE` or `CLOUD_DATASTORE_COMPATIBILITY` for new
     * instances.  To support old instances, the value `CLOUD_DATASTORE` is accepted by the provider, but will be rejected by the API.
     * To create a Cloud Firestore database without creating an App Engine application, use the
     * `gcp.firestore.Database`
     * resource instead.
     */
    public val databaseType: Output
        get() = javaResource.databaseType().applyValue({ args0 -> args0 })

    /**
     * The GCS bucket content is being stored in for this app.
     */
    public val defaultBucket: Output
        get() = javaResource.defaultBucket().applyValue({ args0 -> args0 })

    /**
     * The default hostname for this app.
     */
    public val defaultHostname: Output
        get() = javaResource.defaultHostname().applyValue({ args0 -> args0 })

    /**
     * A block of optional settings to configure specific App Engine features:
     */
    public val featureSettings: Output
        get() = javaResource.featureSettings().applyValue({ args0 ->
            args0.let({ args0 ->
                applicationFeatureSettingsToKotlin(args0)
            })
        })

    /**
     * The GCR domain used for storing managed Docker images for this app.
     */
    public val gcrDomain: Output
        get() = javaResource.gcrDomain().applyValue({ args0 -> args0 })

    /**
     * Settings for enabling Cloud Identity Aware Proxy
     */
    public val iap: Output
        get() = javaResource.iap().applyValue({ args0 ->
            args0.let({ args0 ->
                applicationIapToKotlin(args0)
            })
        })

    /**
     * The [location](https://cloud.google.com/appengine/docs/locations)
     * to serve the app from.
     */
    public val locationId: Output
        get() = javaResource.locationId().applyValue({ args0 -> args0 })

    /**
     * Unique name of the app, usually `apps/{PROJECT_ID}`
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The project ID to create the application under.
     * ~>**NOTE:** GCP only accepts project ID, not project number. If you are using number,
     * you may get a "Permission denied" error.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * The serving status of the app.
     */
    public val servingStatus: Output
        get() = javaResource.servingStatus().applyValue({ args0 -> args0 })

    /**
     * A list of dispatch rule blocks. Each block has a `domain`, `path`, and `service` field.
     */
    public val urlDispatchRules: Output>
        get() = javaResource.urlDispatchRules().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> applicationUrlDispatchRuleToKotlin(args0) })
            })
        })
}

public object ApplicationMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.appengine.Application::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy