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

com.pulumi.azure.appplatform.kotlin.SpringCloudJavaDeployment.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: 6.14.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.appplatform.kotlin

import com.pulumi.azure.appplatform.kotlin.outputs.SpringCloudJavaDeploymentQuota
import com.pulumi.azure.appplatform.kotlin.outputs.SpringCloudJavaDeploymentQuota.Companion.toKotlin
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map

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

    public var args: SpringCloudJavaDeploymentArgs = SpringCloudJavaDeploymentArgs()

    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 SpringCloudJavaDeploymentArgsBuilder.() -> Unit) {
        val builder = SpringCloudJavaDeploymentArgsBuilder()
        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(): SpringCloudJavaDeployment {
        val builtJavaResource =
            com.pulumi.azure.appplatform.SpringCloudJavaDeployment(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return SpringCloudJavaDeployment(builtJavaResource)
    }
}

/**
 * Manages an Azure Spring Cloud Deployment with a Java runtime.
 * > **NOTE:** This resource is applicable only for Spring Cloud Service with basic and standard tier.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleSpringCloudService = new azure.appplatform.SpringCloudService("example", {
 *     name: "example-springcloud",
 *     resourceGroupName: example.name,
 *     location: example.location,
 * });
 * const exampleSpringCloudApp = new azure.appplatform.SpringCloudApp("example", {
 *     name: "example-springcloudapp",
 *     resourceGroupName: example.name,
 *     serviceName: exampleSpringCloudService.name,
 *     identity: {
 *         type: "SystemAssigned",
 *     },
 * });
 * const exampleSpringCloudJavaDeployment = new azure.appplatform.SpringCloudJavaDeployment("example", {
 *     name: "deploy1",
 *     springCloudAppId: exampleSpringCloudApp.id,
 *     instanceCount: 2,
 *     jvmOptions: "-XX:+PrintGC",
 *     quota: {
 *         cpu: "2",
 *         memory: "4Gi",
 *     },
 *     runtimeVersion: "Java_11",
 *     environmentVariables: {
 *         Foo: "Bar",
 *         Env: "Staging",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_spring_cloud_service = azure.appplatform.SpringCloudService("example",
 *     name="example-springcloud",
 *     resource_group_name=example.name,
 *     location=example.location)
 * example_spring_cloud_app = azure.appplatform.SpringCloudApp("example",
 *     name="example-springcloudapp",
 *     resource_group_name=example.name,
 *     service_name=example_spring_cloud_service.name,
 *     identity=azure.appplatform.SpringCloudAppIdentityArgs(
 *         type="SystemAssigned",
 *     ))
 * example_spring_cloud_java_deployment = azure.appplatform.SpringCloudJavaDeployment("example",
 *     name="deploy1",
 *     spring_cloud_app_id=example_spring_cloud_app.id,
 *     instance_count=2,
 *     jvm_options="-XX:+PrintGC",
 *     quota=azure.appplatform.SpringCloudJavaDeploymentQuotaArgs(
 *         cpu="2",
 *         memory="4Gi",
 *     ),
 *     runtime_version="Java_11",
 *     environment_variables={
 *         "Foo": "Bar",
 *         "Env": "Staging",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleSpringCloudService = new Azure.AppPlatform.SpringCloudService("example", new()
 *     {
 *         Name = "example-springcloud",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *     });
 *     var exampleSpringCloudApp = new Azure.AppPlatform.SpringCloudApp("example", new()
 *     {
 *         Name = "example-springcloudapp",
 *         ResourceGroupName = example.Name,
 *         ServiceName = exampleSpringCloudService.Name,
 *         Identity = new Azure.AppPlatform.Inputs.SpringCloudAppIdentityArgs
 *         {
 *             Type = "SystemAssigned",
 *         },
 *     });
 *     var exampleSpringCloudJavaDeployment = new Azure.AppPlatform.SpringCloudJavaDeployment("example", new()
 *     {
 *         Name = "deploy1",
 *         SpringCloudAppId = exampleSpringCloudApp.Id,
 *         InstanceCount = 2,
 *         JvmOptions = "-XX:+PrintGC",
 *         Quota = new Azure.AppPlatform.Inputs.SpringCloudJavaDeploymentQuotaArgs
 *         {
 *             Cpu = "2",
 *             Memory = "4Gi",
 *         },
 *         RuntimeVersion = "Java_11",
 *         EnvironmentVariables =
 *         {
 *             { "Foo", "Bar" },
 *             { "Env", "Staging" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appplatform"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleSpringCloudService, err := appplatform.NewSpringCloudService(ctx, "example", &appplatform.SpringCloudServiceArgs{
 * 			Name:              pulumi.String("example-springcloud"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleSpringCloudApp, err := appplatform.NewSpringCloudApp(ctx, "example", &appplatform.SpringCloudAppArgs{
 * 			Name:              pulumi.String("example-springcloudapp"),
 * 			ResourceGroupName: example.Name,
 * 			ServiceName:       exampleSpringCloudService.Name,
 * 			Identity: &appplatform.SpringCloudAppIdentityArgs{
 * 				Type: pulumi.String("SystemAssigned"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = appplatform.NewSpringCloudJavaDeployment(ctx, "example", &appplatform.SpringCloudJavaDeploymentArgs{
 * 			Name:             pulumi.String("deploy1"),
 * 			SpringCloudAppId: exampleSpringCloudApp.ID(),
 * 			InstanceCount:    pulumi.Int(2),
 * 			JvmOptions:       pulumi.String("-XX:+PrintGC"),
 * 			Quota: &appplatform.SpringCloudJavaDeploymentQuotaArgs{
 * 				Cpu:    pulumi.String("2"),
 * 				Memory: pulumi.String("4Gi"),
 * 			},
 * 			RuntimeVersion: pulumi.String("Java_11"),
 * 			EnvironmentVariables: pulumi.StringMap{
 * 				"Foo": pulumi.String("Bar"),
 * 				"Env": pulumi.String("Staging"),
 * 			},
 * 		})
 * 		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.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.appplatform.SpringCloudService;
 * import com.pulumi.azure.appplatform.SpringCloudServiceArgs;
 * import com.pulumi.azure.appplatform.SpringCloudApp;
 * import com.pulumi.azure.appplatform.SpringCloudAppArgs;
 * import com.pulumi.azure.appplatform.inputs.SpringCloudAppIdentityArgs;
 * import com.pulumi.azure.appplatform.SpringCloudJavaDeployment;
 * import com.pulumi.azure.appplatform.SpringCloudJavaDeploymentArgs;
 * import com.pulumi.azure.appplatform.inputs.SpringCloudJavaDeploymentQuotaArgs;
 * 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 ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleSpringCloudService = new SpringCloudService("exampleSpringCloudService", SpringCloudServiceArgs.builder()
 *             .name("example-springcloud")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .build());
 *         var exampleSpringCloudApp = new SpringCloudApp("exampleSpringCloudApp", SpringCloudAppArgs.builder()
 *             .name("example-springcloudapp")
 *             .resourceGroupName(example.name())
 *             .serviceName(exampleSpringCloudService.name())
 *             .identity(SpringCloudAppIdentityArgs.builder()
 *                 .type("SystemAssigned")
 *                 .build())
 *             .build());
 *         var exampleSpringCloudJavaDeployment = new SpringCloudJavaDeployment("exampleSpringCloudJavaDeployment", SpringCloudJavaDeploymentArgs.builder()
 *             .name("deploy1")
 *             .springCloudAppId(exampleSpringCloudApp.id())
 *             .instanceCount(2)
 *             .jvmOptions("-XX:+PrintGC")
 *             .quota(SpringCloudJavaDeploymentQuotaArgs.builder()
 *                 .cpu("2")
 *                 .memory("4Gi")
 *                 .build())
 *             .runtimeVersion("Java_11")
 *             .environmentVariables(Map.ofEntries(
 *                 Map.entry("Foo", "Bar"),
 *                 Map.entry("Env", "Staging")
 *             ))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleSpringCloudService:
 *     type: azure:appplatform:SpringCloudService
 *     name: example
 *     properties:
 *       name: example-springcloud
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *   exampleSpringCloudApp:
 *     type: azure:appplatform:SpringCloudApp
 *     name: example
 *     properties:
 *       name: example-springcloudapp
 *       resourceGroupName: ${example.name}
 *       serviceName: ${exampleSpringCloudService.name}
 *       identity:
 *         type: SystemAssigned
 *   exampleSpringCloudJavaDeployment:
 *     type: azure:appplatform:SpringCloudJavaDeployment
 *     name: example
 *     properties:
 *       name: deploy1
 *       springCloudAppId: ${exampleSpringCloudApp.id}
 *       instanceCount: 2
 *       jvmOptions: -XX:+PrintGC
 *       quota:
 *         cpu: '2'
 *         memory: 4Gi
 *       runtimeVersion: Java_11
 *       environmentVariables:
 *         Foo: Bar
 *         Env: Staging
 * ```
 * 
 * ## Import
 * Spring Cloud Deployment can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:appplatform/springCloudJavaDeployment:SpringCloudJavaDeployment example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup1/providers/Microsoft.AppPlatform/spring/service1/apps/app1/deployments/deploy1
 * ```
 */
public class SpringCloudJavaDeployment internal constructor(
    override val javaResource: com.pulumi.azure.appplatform.SpringCloudJavaDeployment,
) : KotlinCustomResource(javaResource, SpringCloudJavaDeploymentMapper) {
    /**
     * Specifies the environment variables of the Spring Cloud Deployment as a map of key-value pairs.
     */
    public val environmentVariables: Output>?
        get() = javaResource.environmentVariables().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0.key.to(args0.value) }).toMap()
            }).orElse(null)
        })

    /**
     * Specifies the required instance count of the Spring Cloud Deployment. Possible Values are between `1` and `500`. Defaults to `1` if not specified.
     */
    public val instanceCount: Output?
        get() = javaResource.instanceCount().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the jvm option of the Spring Cloud Deployment.
     */
    public val jvmOptions: Output?
        get() = javaResource.jvmOptions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the name of the Spring Cloud Deployment. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * A `quota` block as defined below.
     */
    public val quota: Output
        get() = javaResource.quota().applyValue({ args0 -> args0.let({ args0 -> toKotlin(args0) }) })

    /**
     * Specifies the runtime version of the Spring Cloud Deployment. Possible Values are `Java_8`, `Java_11` and `Java_17`. Defaults to `Java_8`.
     */
    public val runtimeVersion: Output?
        get() = javaResource.runtimeVersion().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the id of the Spring Cloud Application in which to create the Deployment. Changing this forces a new resource to be created.
     */
    public val springCloudAppId: Output
        get() = javaResource.springCloudAppId().applyValue({ args0 -> args0 })
}

public object SpringCloudJavaDeploymentMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.appplatform.SpringCloudJavaDeployment::class == javaResource::class

    override fun map(javaResource: Resource): SpringCloudJavaDeployment =
        SpringCloudJavaDeployment(
            javaResource as
                com.pulumi.azure.appplatform.SpringCloudJavaDeployment,
        )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy