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

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

import com.pulumi.core.Output
import com.pulumi.gcp.apphub.kotlin.outputs.ApplicationAttributes
import com.pulumi.gcp.apphub.kotlin.outputs.ApplicationScope
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 com.pulumi.gcp.apphub.kotlin.outputs.ApplicationAttributes.Companion.toKotlin as applicationAttributesToKotlin
import com.pulumi.gcp.apphub.kotlin.outputs.ApplicationScope.Companion.toKotlin as applicationScopeToKotlin

/**
 * 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.apphub.Application(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Application(builtJavaResource)
    }
}

/**
 * Application is a functional grouping of Services and Workloads that helps achieve a desired end-to-end business functionality. Services and Workloads are owned by the Application.
 * ## Example Usage
 * ### Application Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const example = new gcp.apphub.Application("example", {
 *     location: "us-east1",
 *     applicationId: "example-application",
 *     scope: {
 *         type: "REGIONAL",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * example = gcp.apphub.Application("example",
 *     location="us-east1",
 *     application_id="example-application",
 *     scope=gcp.apphub.ApplicationScopeArgs(
 *         type="REGIONAL",
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Gcp.Apphub.Application("example", new()
 *     {
 *         Location = "us-east1",
 *         ApplicationId = "example-application",
 *         Scope = new Gcp.Apphub.Inputs.ApplicationScopeArgs
 *         {
 *             Type = "REGIONAL",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/apphub"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := apphub.NewApplication(ctx, "example", &apphub.ApplicationArgs{
 * 			Location:      pulumi.String("us-east1"),
 * 			ApplicationId: pulumi.String("example-application"),
 * 			Scope: &apphub.ApplicationScopeArgs{
 * 				Type: pulumi.String("REGIONAL"),
 * 			},
 * 		})
 * 		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.apphub.Application;
 * import com.pulumi.gcp.apphub.ApplicationArgs;
 * import com.pulumi.gcp.apphub.inputs.ApplicationScopeArgs;
 * 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 Application("example", ApplicationArgs.builder()
 *             .location("us-east1")
 *             .applicationId("example-application")
 *             .scope(ApplicationScopeArgs.builder()
 *                 .type("REGIONAL")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: gcp:apphub:Application
 *     properties:
 *       location: us-east1
 *       applicationId: example-application
 *       scope:
 *         type: REGIONAL
 * ```
 * 
 * ### Application Full
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const example2 = new gcp.apphub.Application("example2", {
 *     location: "us-east1",
 *     applicationId: "example-application",
 *     displayName: "Application Full",
 *     scope: {
 *         type: "REGIONAL",
 *     },
 *     description: "Application for testing",
 *     attributes: {
 *         environment: {
 *             type: "STAGING",
 *         },
 *         criticality: {
 *             type: "MISSION_CRITICAL",
 *         },
 *         businessOwners: [{
 *             displayName: "Alice",
 *             email: "[email protected]",
 *         }],
 *         developerOwners: [{
 *             displayName: "Bob",
 *             email: "[email protected]",
 *         }],
 *         operatorOwners: [{
 *             displayName: "Charlie",
 *             email: "[email protected]",
 *         }],
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * example2 = gcp.apphub.Application("example2",
 *     location="us-east1",
 *     application_id="example-application",
 *     display_name="Application Full",
 *     scope=gcp.apphub.ApplicationScopeArgs(
 *         type="REGIONAL",
 *     ),
 *     description="Application for testing",
 *     attributes=gcp.apphub.ApplicationAttributesArgs(
 *         environment=gcp.apphub.ApplicationAttributesEnvironmentArgs(
 *             type="STAGING",
 *         ),
 *         criticality=gcp.apphub.ApplicationAttributesCriticalityArgs(
 *             type="MISSION_CRITICAL",
 *         ),
 *         business_owners=[gcp.apphub.ApplicationAttributesBusinessOwnerArgs(
 *             display_name="Alice",
 *             email="[email protected]",
 *         )],
 *         developer_owners=[gcp.apphub.ApplicationAttributesDeveloperOwnerArgs(
 *             display_name="Bob",
 *             email="[email protected]",
 *         )],
 *         operator_owners=[gcp.apphub.ApplicationAttributesOperatorOwnerArgs(
 *             display_name="Charlie",
 *             email="[email protected]",
 *         )],
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example2 = new Gcp.Apphub.Application("example2", new()
 *     {
 *         Location = "us-east1",
 *         ApplicationId = "example-application",
 *         DisplayName = "Application Full",
 *         Scope = new Gcp.Apphub.Inputs.ApplicationScopeArgs
 *         {
 *             Type = "REGIONAL",
 *         },
 *         Description = "Application for testing",
 *         Attributes = new Gcp.Apphub.Inputs.ApplicationAttributesArgs
 *         {
 *             Environment = new Gcp.Apphub.Inputs.ApplicationAttributesEnvironmentArgs
 *             {
 *                 Type = "STAGING",
 *             },
 *             Criticality = new Gcp.Apphub.Inputs.ApplicationAttributesCriticalityArgs
 *             {
 *                 Type = "MISSION_CRITICAL",
 *             },
 *             BusinessOwners = new[]
 *             {
 *                 new Gcp.Apphub.Inputs.ApplicationAttributesBusinessOwnerArgs
 *                 {
 *                     DisplayName = "Alice",
 *                     Email = "[email protected]",
 *                 },
 *             },
 *             DeveloperOwners = new[]
 *             {
 *                 new Gcp.Apphub.Inputs.ApplicationAttributesDeveloperOwnerArgs
 *                 {
 *                     DisplayName = "Bob",
 *                     Email = "[email protected]",
 *                 },
 *             },
 *             OperatorOwners = new[]
 *             {
 *                 new Gcp.Apphub.Inputs.ApplicationAttributesOperatorOwnerArgs
 *                 {
 *                     DisplayName = "Charlie",
 *                     Email = "[email protected]",
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/apphub"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := apphub.NewApplication(ctx, "example2", &apphub.ApplicationArgs{
 * 			Location:      pulumi.String("us-east1"),
 * 			ApplicationId: pulumi.String("example-application"),
 * 			DisplayName:   pulumi.String("Application Full"),
 * 			Scope: &apphub.ApplicationScopeArgs{
 * 				Type: pulumi.String("REGIONAL"),
 * 			},
 * 			Description: pulumi.String("Application for testing"),
 * 			Attributes: &apphub.ApplicationAttributesArgs{
 * 				Environment: &apphub.ApplicationAttributesEnvironmentArgs{
 * 					Type: pulumi.String("STAGING"),
 * 				},
 * 				Criticality: &apphub.ApplicationAttributesCriticalityArgs{
 * 					Type: pulumi.String("MISSION_CRITICAL"),
 * 				},
 * 				BusinessOwners: apphub.ApplicationAttributesBusinessOwnerArray{
 * 					&apphub.ApplicationAttributesBusinessOwnerArgs{
 * 						DisplayName: pulumi.String("Alice"),
 * 						Email:       pulumi.String("[email protected]"),
 * 					},
 * 				},
 * 				DeveloperOwners: apphub.ApplicationAttributesDeveloperOwnerArray{
 * 					&apphub.ApplicationAttributesDeveloperOwnerArgs{
 * 						DisplayName: pulumi.String("Bob"),
 * 						Email:       pulumi.String("[email protected]"),
 * 					},
 * 				},
 * 				OperatorOwners: apphub.ApplicationAttributesOperatorOwnerArray{
 * 					&apphub.ApplicationAttributesOperatorOwnerArgs{
 * 						DisplayName: pulumi.String("Charlie"),
 * 						Email:       pulumi.String("[email protected]"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.apphub.Application;
 * import com.pulumi.gcp.apphub.ApplicationArgs;
 * import com.pulumi.gcp.apphub.inputs.ApplicationScopeArgs;
 * import com.pulumi.gcp.apphub.inputs.ApplicationAttributesArgs;
 * import com.pulumi.gcp.apphub.inputs.ApplicationAttributesEnvironmentArgs;
 * import com.pulumi.gcp.apphub.inputs.ApplicationAttributesCriticalityArgs;
 * 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 example2 = new Application("example2", ApplicationArgs.builder()
 *             .location("us-east1")
 *             .applicationId("example-application")
 *             .displayName("Application Full")
 *             .scope(ApplicationScopeArgs.builder()
 *                 .type("REGIONAL")
 *                 .build())
 *             .description("Application for testing")
 *             .attributes(ApplicationAttributesArgs.builder()
 *                 .environment(ApplicationAttributesEnvironmentArgs.builder()
 *                     .type("STAGING")
 *                     .build())
 *                 .criticality(ApplicationAttributesCriticalityArgs.builder()
 *                     .type("MISSION_CRITICAL")
 *                     .build())
 *                 .businessOwners(ApplicationAttributesBusinessOwnerArgs.builder()
 *                     .displayName("Alice")
 *                     .email("[email protected]")
 *                     .build())
 *                 .developerOwners(ApplicationAttributesDeveloperOwnerArgs.builder()
 *                     .displayName("Bob")
 *                     .email("[email protected]")
 *                     .build())
 *                 .operatorOwners(ApplicationAttributesOperatorOwnerArgs.builder()
 *                     .displayName("Charlie")
 *                     .email("[email protected]")
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example2:
 *     type: gcp:apphub:Application
 *     properties:
 *       location: us-east1
 *       applicationId: example-application
 *       displayName: Application Full
 *       scope:
 *         type: REGIONAL
 *       description: Application for testing
 *       attributes:
 *         environment:
 *           type: STAGING
 *         criticality:
 *           type: MISSION_CRITICAL
 *         businessOwners:
 *           - displayName: Alice
 *             email: [email protected]
 *         developerOwners:
 *           - displayName: Bob
 *             email: [email protected]
 *         operatorOwners:
 *           - displayName: Charlie
 *             email: [email protected]
 * ```
 * 
 * ## Import
 * Application can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/applications/{{application_id}}`
 * * `{{project}}/{{location}}/{{application_id}}`
 * * `{{location}}/{{application_id}}`
 * When using the `pulumi import` command, Application can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:apphub/application:Application default projects/{{project}}/locations/{{location}}/applications/{{application_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:apphub/application:Application default {{project}}/{{location}}/{{application_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:apphub/application:Application default {{location}}/{{application_id}}
 * ```
 */
public class Application internal constructor(
    override val javaResource: com.pulumi.gcp.apphub.Application,
) : KotlinCustomResource(javaResource, ApplicationMapper) {
    /**
     * Required. The Application identifier.
     */
    public val applicationId: Output
        get() = javaResource.applicationId().applyValue({ args0 -> args0 })

    /**
     * Consumer provided attributes.
     */
    public val attributes: Output?
        get() = javaResource.attributes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    applicationAttributesToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Output only. Create time.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * Optional. User-defined description of an Application.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Optional. User-defined name for the Application.
     */
    public val displayName: Output?
        get() = javaResource.displayName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Part of `parent`. See documentation of `projectsId`.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Identifier. The resource name of an Application. Format:
     * "projects/{host-project-id}/locations/{location}/applications/{application-id}"
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * Scope of an application.
     * Structure is documented below.
     */
    public val scope: Output
        get() = javaResource.scope().applyValue({ args0 ->
            args0.let({ args0 ->
                applicationScopeToKotlin(args0)
            })
        })

    /**
     * Output only. Application state.
     * Possible values:
     * STATE_UNSPECIFIED
     * CREATING
     * ACTIVE
     * DELETING
     */
    public val state: Output
        get() = javaResource.state().applyValue({ args0 -> args0 })

    /**
     * Output only. A universally unique identifier (in UUID4 format) for the `Application`.
     */
    public val uid: Output
        get() = javaResource.uid().applyValue({ args0 -> args0 })

    /**
     * Output only. Update time.
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })
}

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

    override fun map(javaResource: Resource): Application = Application(
        javaResource as
            com.pulumi.gcp.apphub.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