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

com.pulumi.azurenative.app.kotlin.ContainerApp.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azurenative.app.kotlin

import com.pulumi.azurenative.app.kotlin.outputs.ConfigurationResponse
import com.pulumi.azurenative.app.kotlin.outputs.ExtendedLocationResponse
import com.pulumi.azurenative.app.kotlin.outputs.ManagedServiceIdentityResponse
import com.pulumi.azurenative.app.kotlin.outputs.SystemDataResponse
import com.pulumi.azurenative.app.kotlin.outputs.TemplateResponse
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
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azurenative.app.kotlin.outputs.ConfigurationResponse.Companion.toKotlin as configurationResponseToKotlin
import com.pulumi.azurenative.app.kotlin.outputs.ExtendedLocationResponse.Companion.toKotlin as extendedLocationResponseToKotlin
import com.pulumi.azurenative.app.kotlin.outputs.ManagedServiceIdentityResponse.Companion.toKotlin as managedServiceIdentityResponseToKotlin
import com.pulumi.azurenative.app.kotlin.outputs.SystemDataResponse.Companion.toKotlin as systemDataResponseToKotlin
import com.pulumi.azurenative.app.kotlin.outputs.TemplateResponse.Companion.toKotlin as templateResponseToKotlin

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

    public var args: ContainerAppArgs = ContainerAppArgs()

    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 ContainerAppArgsBuilder.() -> Unit) {
        val builder = ContainerAppArgsBuilder()
        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(): ContainerApp {
        val builtJavaResource = com.pulumi.azurenative.app.ContainerApp(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return ContainerApp(builtJavaResource)
    }
}

/**
 * Container App.
 * Azure REST API version: 2022-10-01. Prior API version in Azure Native 1.x: 2022-03-01.
 * Other available API versions: 2022-01-01-preview, 2023-04-01-preview, 2023-05-01, 2023-05-02-preview, 2023-08-01-preview, 2023-11-02-preview, 2024-02-02-preview, 2024-03-01.
 * **Note**: the current default Azure API version for this resource, 2022-10-01, has an issue with referencing Key Vault secrets via the `KeyVaultUrl` property. If you encounter the error _"invalid: value or keyVaultUrl and identity should be provided"_ with such a configuration, you can use API version 2023-05-1 instead. In v3 of this provider, we will update the default API version.
 * ## Example Usage
 * ### Create or Update Container App
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var containerApp = new AzureNative.App.ContainerApp("containerApp", new()
 *     {
 *         Configuration = new AzureNative.App.Inputs.ConfigurationArgs
 *         {
 *             Dapr = new AzureNative.App.Inputs.DaprArgs
 *             {
 *                 AppPort = 3000,
 *                 AppProtocol = AzureNative.App.AppProtocol.Http,
 *                 EnableApiLogging = true,
 *                 Enabled = true,
 *                 HttpMaxRequestSize = 10,
 *                 HttpReadBufferSize = 30,
 *                 LogLevel = AzureNative.App.LogLevel.Debug,
 *             },
 *             Ingress = new AzureNative.App.Inputs.IngressArgs
 *             {
 *                 ClientCertificateMode = AzureNative.App.IngressClientCertificateMode.Accept,
 *                 CorsPolicy = new AzureNative.App.Inputs.CorsPolicyArgs
 *                 {
 *                     AllowCredentials = true,
 *                     AllowedHeaders = new[]
 *                     {
 *                         "HEADER1",
 *                         "HEADER2",
 *                     },
 *                     AllowedMethods = new[]
 *                     {
 *                         "GET",
 *                         "POST",
 *                     },
 *                     AllowedOrigins = new[]
 *                     {
 *                         "https://a.test.com",
 *                         "https://b.test.com",
 *                     },
 *                     ExposeHeaders = new[]
 *                     {
 *                         "HEADER3",
 *                         "HEADER4",
 *                     },
 *                     MaxAge = 1234,
 *                 },
 *                 CustomDomains = new[]
 *                 {
 *                     new AzureNative.App.Inputs.CustomDomainArgs
 *                     {
 *                         BindingType = AzureNative.App.BindingType.SniEnabled,
 *                         CertificateId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com",
 *                         Name = "www.my-name.com",
 *                     },
 *                     new AzureNative.App.Inputs.CustomDomainArgs
 *                     {
 *                         BindingType = AzureNative.App.BindingType.SniEnabled,
 *                         CertificateId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com",
 *                         Name = "www.my-other-name.com",
 *                     },
 *                 },
 *                 External = true,
 *                 IpSecurityRestrictions = new[]
 *                 {
 *                     new AzureNative.App.Inputs.IpSecurityRestrictionRuleArgs
 *                     {
 *                         Action = AzureNative.App.Action.Allow,
 *                         Description = "Allowing all IP's within the subnet below to access containerapp",
 *                         IpAddressRange = "192.168.1.1/32",
 *                         Name = "Allow work IP A subnet",
 *                     },
 *                     new AzureNative.App.Inputs.IpSecurityRestrictionRuleArgs
 *                     {
 *                         Action = AzureNative.App.Action.Allow,
 *                         Description = "Allowing all IP's within the subnet below to access containerapp",
 *                         IpAddressRange = "192.168.1.1/8",
 *                         Name = "Allow work IP B subnet",
 *                     },
 *                 },
 *                 TargetPort = 3000,
 *                 Traffic = new[]
 *                 {
 *                     new AzureNative.App.Inputs.TrafficWeightArgs
 *                     {
 *                         Label = "production",
 *                         RevisionName = "testcontainerapp0-ab1234",
 *                         Weight = 100,
 *                     },
 *                 },
 *             },
 *             MaxInactiveRevisions = 10,
 *         },
 *         ContainerAppName = "testcontainerapp0",
 *         EnvironmentId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
 *         Location = "East US",
 *         ResourceGroupName = "rg",
 *         Template = new AzureNative.App.Inputs.TemplateArgs
 *         {
 *             Containers = new[]
 *             {
 *                 new AzureNative.App.Inputs.ContainerArgs
 *                 {
 *                     Image = "repo/testcontainerapp0:v1",
 *                     Name = "testcontainerapp0",
 *                     Probes = new[]
 *                     {
 *                         new AzureNative.App.Inputs.ContainerAppProbeArgs
 *                         {
 *                             HttpGet = new AzureNative.App.Inputs.ContainerAppProbeHttpGetArgs
 *                             {
 *                                 HttpHeaders = new[]
 *                                 {
 *                                     new AzureNative.App.Inputs.ContainerAppProbeHttpHeadersArgs
 *                                     {
 *                                         Name = "Custom-Header",
 *                                         Value = "Awesome",
 *                                     },
 *                                 },
 *                                 Path = "/health",
 *                                 Port = 8080,
 *                             },
 *                             InitialDelaySeconds = 3,
 *                             PeriodSeconds = 3,
 *                             Type = AzureNative.App.Type.Liveness,
 *                         },
 *                     },
 *                 },
 *             },
 *             InitContainers = new[]
 *             {
 *                 new AzureNative.App.Inputs.InitContainerArgs
 *                 {
 *                     Args = new[]
 *                     {
 *                         "-c",
 *                         "while true; do echo hello; sleep 10;done",
 *                     },
 *                     Command = new[]
 *                     {
 *                         "/bin/sh",
 *                     },
 *                     Image = "repo/testcontainerapp0:v4",
 *                     Name = "testinitcontainerApp0",
 *                     Resources = new AzureNative.App.Inputs.ContainerResourcesArgs
 *                     {
 *                         Cpu = 0.5,
 *                         Memory = "1Gi",
 *                     },
 *                 },
 *             },
 *             Scale = new AzureNative.App.Inputs.ScaleArgs
 *             {
 *                 MaxReplicas = 5,
 *                 MinReplicas = 1,
 *                 Rules = new[]
 *                 {
 *                     new AzureNative.App.Inputs.ScaleRuleArgs
 *                     {
 *                         Custom = new AzureNative.App.Inputs.CustomScaleRuleArgs
 *                         {
 *                             Metadata =
 *                             {
 *                                 { "concurrentRequests", "50" },
 *                             },
 *                             Type = "http",
 *                         },
 *                         Name = "httpscalingrule",
 *                     },
 *                 },
 *             },
 *         },
 *         WorkloadProfileType = "GeneralPurpose",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	app "github.com/pulumi/pulumi-azure-native-sdk/app/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := app.NewContainerApp(ctx, "containerApp", &app.ContainerAppArgs{
 * 			Configuration: &app.ConfigurationArgs{
 * 				Dapr: &app.DaprArgs{
 * 					AppPort:            pulumi.Int(3000),
 * 					AppProtocol:        pulumi.String(app.AppProtocolHttp),
 * 					EnableApiLogging:   pulumi.Bool(true),
 * 					Enabled:            pulumi.Bool(true),
 * 					HttpMaxRequestSize: pulumi.Int(10),
 * 					HttpReadBufferSize: pulumi.Int(30),
 * 					LogLevel:           pulumi.String(app.LogLevelDebug),
 * 				},
 * 				Ingress: &app.IngressArgs{
 * 					ClientCertificateMode: pulumi.String(app.IngressClientCertificateModeAccept),
 * 					CorsPolicy: &app.CorsPolicyArgs{
 * 						AllowCredentials: pulumi.Bool(true),
 * 						AllowedHeaders: pulumi.StringArray{
 * 							pulumi.String("HEADER1"),
 * 							pulumi.String("HEADER2"),
 * 						},
 * 						AllowedMethods: pulumi.StringArray{
 * 							pulumi.String("GET"),
 * 							pulumi.String("POST"),
 * 						},
 * 						AllowedOrigins: pulumi.StringArray{
 * 							pulumi.String("https://a.test.com"),
 * 							pulumi.String("https://b.test.com"),
 * 						},
 * 						ExposeHeaders: pulumi.StringArray{
 * 							pulumi.String("HEADER3"),
 * 							pulumi.String("HEADER4"),
 * 						},
 * 						MaxAge: pulumi.Int(1234),
 * 					},
 * 					CustomDomains: app.CustomDomainArray{
 * 						&app.CustomDomainArgs{
 * 							BindingType:   pulumi.String(app.BindingTypeSniEnabled),
 * 							CertificateId: pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com"),
 * 							Name:          pulumi.String("www.my-name.com"),
 * 						},
 * 						&app.CustomDomainArgs{
 * 							BindingType:   pulumi.String(app.BindingTypeSniEnabled),
 * 							CertificateId: pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com"),
 * 							Name:          pulumi.String("www.my-other-name.com"),
 * 						},
 * 					},
 * 					External: pulumi.Bool(true),
 * 					IpSecurityRestrictions: app.IpSecurityRestrictionRuleArray{
 * 						&app.IpSecurityRestrictionRuleArgs{
 * 							Action:         pulumi.String(app.ActionAllow),
 * 							Description:    pulumi.String("Allowing all IP's within the subnet below to access containerapp"),
 * 							IpAddressRange: pulumi.String("192.168.1.1/32"),
 * 							Name:           pulumi.String("Allow work IP A subnet"),
 * 						},
 * 						&app.IpSecurityRestrictionRuleArgs{
 * 							Action:         pulumi.String(app.ActionAllow),
 * 							Description:    pulumi.String("Allowing all IP's within the subnet below to access containerapp"),
 * 							IpAddressRange: pulumi.String("192.168.1.1/8"),
 * 							Name:           pulumi.String("Allow work IP B subnet"),
 * 						},
 * 					},
 * 					TargetPort: pulumi.Int(3000),
 * 					Traffic: app.TrafficWeightArray{
 * 						&app.TrafficWeightArgs{
 * 							Label:        pulumi.String("production"),
 * 							RevisionName: pulumi.String("testcontainerapp0-ab1234"),
 * 							Weight:       pulumi.Int(100),
 * 						},
 * 					},
 * 				},
 * 				MaxInactiveRevisions: pulumi.Int(10),
 * 			},
 * 			ContainerAppName:  pulumi.String("testcontainerapp0"),
 * 			EnvironmentId:     pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"),
 * 			Location:          pulumi.String("East US"),
 * 			ResourceGroupName: pulumi.String("rg"),
 * 			Template: &app.TemplateArgs{
 * 				Containers: app.ContainerArray{
 * 					&app.ContainerArgs{
 * 						Image: pulumi.String("repo/testcontainerapp0:v1"),
 * 						Name:  pulumi.String("testcontainerapp0"),
 * 						Probes: app.ContainerAppProbeArray{
 * 							&app.ContainerAppProbeArgs{
 * 								HttpGet: &app.ContainerAppProbeHttpGetArgs{
 * 									HttpHeaders: app.ContainerAppProbeHttpHeadersArray{
 * 										&app.ContainerAppProbeHttpHeadersArgs{
 * 											Name:  pulumi.String("Custom-Header"),
 * 											Value: pulumi.String("Awesome"),
 * 										},
 * 									},
 * 									Path: pulumi.String("/health"),
 * 									Port: pulumi.Int(8080),
 * 								},
 * 								InitialDelaySeconds: pulumi.Int(3),
 * 								PeriodSeconds:       pulumi.Int(3),
 * 								Type:                pulumi.String(app.TypeLiveness),
 * 							},
 * 						},
 * 					},
 * 				},
 * 				InitContainers: app.InitContainerArray{
 * 					&app.InitContainerArgs{
 * 						Args: pulumi.StringArray{
 * 							pulumi.String("-c"),
 * 							pulumi.String("while true; do echo hello; sleep 10;done"),
 * 						},
 * 						Command: pulumi.StringArray{
 * 							pulumi.String("/bin/sh"),
 * 						},
 * 						Image: pulumi.String("repo/testcontainerapp0:v4"),
 * 						Name:  pulumi.String("testinitcontainerApp0"),
 * 						Resources: &app.ContainerResourcesArgs{
 * 							Cpu:    pulumi.Float64(0.5),
 * 							Memory: pulumi.String("1Gi"),
 * 						},
 * 					},
 * 				},
 * 				Scale: &app.ScaleArgs{
 * 					MaxReplicas: pulumi.Int(5),
 * 					MinReplicas: pulumi.Int(1),
 * 					Rules: app.ScaleRuleArray{
 * 						&app.ScaleRuleArgs{
 * 							Custom: &app.CustomScaleRuleArgs{
 * 								Metadata: pulumi.StringMap{
 * 									"concurrentRequests": pulumi.String("50"),
 * 								},
 * 								Type: pulumi.String("http"),
 * 							},
 * 							Name: pulumi.String("httpscalingrule"),
 * 						},
 * 					},
 * 				},
 * 			},
 * 			WorkloadProfileType: pulumi.String("GeneralPurpose"),
 * 		})
 * 		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.azurenative.app.ContainerApp;
 * import com.pulumi.azurenative.app.ContainerAppArgs;
 * import com.pulumi.azurenative.app.inputs.ConfigurationArgs;
 * import com.pulumi.azurenative.app.inputs.DaprArgs;
 * import com.pulumi.azurenative.app.inputs.IngressArgs;
 * import com.pulumi.azurenative.app.inputs.CorsPolicyArgs;
 * import com.pulumi.azurenative.app.inputs.TemplateArgs;
 * import com.pulumi.azurenative.app.inputs.ScaleArgs;
 * 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 containerApp = new ContainerApp("containerApp", ContainerAppArgs.builder()
 *             .configuration(ConfigurationArgs.builder()
 *                 .dapr(DaprArgs.builder()
 *                     .appPort(3000)
 *                     .appProtocol("http")
 *                     .enableApiLogging(true)
 *                     .enabled(true)
 *                     .httpMaxRequestSize(10)
 *                     .httpReadBufferSize(30)
 *                     .logLevel("debug")
 *                     .build())
 *                 .ingress(IngressArgs.builder()
 *                     .clientCertificateMode("accept")
 *                     .corsPolicy(CorsPolicyArgs.builder()
 *                         .allowCredentials(true)
 *                         .allowedHeaders(
 *                             "HEADER1",
 *                             "HEADER2")
 *                         .allowedMethods(
 *                             "GET",
 *                             "POST")
 *                         .allowedOrigins(
 *                             "https://a.test.com",
 *                             "https://b.test.com")
 *                         .exposeHeaders(
 *                             "HEADER3",
 *                             "HEADER4")
 *                         .maxAge(1234)
 *                         .build())
 *                     .customDomains(
 *                         CustomDomainArgs.builder()
 *                             .bindingType("SniEnabled")
 *                             .certificateId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com")
 *                             .name("www.my-name.com")
 *                             .build(),
 *                         CustomDomainArgs.builder()
 *                             .bindingType("SniEnabled")
 *                             .certificateId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com")
 *                             .name("www.my-other-name.com")
 *                             .build())
 *                     .external(true)
 *                     .ipSecurityRestrictions(
 *                         IpSecurityRestrictionRuleArgs.builder()
 *                             .action("Allow")
 *                             .description("Allowing all IP's within the subnet below to access containerapp")
 *                             .ipAddressRange("192.168.1.1/32")
 *                             .name("Allow work IP A subnet")
 *                             .build(),
 *                         IpSecurityRestrictionRuleArgs.builder()
 *                             .action("Allow")
 *                             .description("Allowing all IP's within the subnet below to access containerapp")
 *                             .ipAddressRange("192.168.1.1/8")
 *                             .name("Allow work IP B subnet")
 *                             .build())
 *                     .targetPort(3000)
 *                     .traffic(TrafficWeightArgs.builder()
 *                         .label("production")
 *                         .revisionName("testcontainerapp0-ab1234")
 *                         .weight(100)
 *                         .build())
 *                     .build())
 *                 .maxInactiveRevisions(10)
 *                 .build())
 *             .containerAppName("testcontainerapp0")
 *             .environmentId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube")
 *             .location("East US")
 *             .resourceGroupName("rg")
 *             .template(TemplateArgs.builder()
 *                 .containers(ContainerArgs.builder()
 *                     .image("repo/testcontainerapp0:v1")
 *                     .name("testcontainerapp0")
 *                     .probes(ContainerAppProbeArgs.builder()
 *                         .httpGet(ContainerAppProbeHttpGetArgs.builder()
 *                             .httpHeaders(ContainerAppProbeHttpHeadersArgs.builder()
 *                                 .name("Custom-Header")
 *                                 .value("Awesome")
 *                                 .build())
 *                             .path("/health")
 *                             .port(8080)
 *                             .build())
 *                         .initialDelaySeconds(3)
 *                         .periodSeconds(3)
 *                         .type("Liveness")
 *                         .build())
 *                     .build())
 *                 .initContainers(InitContainerArgs.builder()
 *                     .args(
 *                         "-c",
 *                         "while true; do echo hello; sleep 10;done")
 *                     .command("/bin/sh")
 *                     .image("repo/testcontainerapp0:v4")
 *                     .name("testinitcontainerApp0")
 *                     .resources(ContainerResourcesArgs.builder()
 *                         .cpu(0.5)
 *                         .memory("1Gi")
 *                         .build())
 *                     .build())
 *                 .scale(ScaleArgs.builder()
 *                     .maxReplicas(5)
 *                     .minReplicas(1)
 *                     .rules(ScaleRuleArgs.builder()
 *                         .custom(CustomScaleRuleArgs.builder()
 *                             .metadata(Map.of("concurrentRequests", "50"))
 *                             .type("http")
 *                             .build())
 *                         .name("httpscalingrule")
 *                         .build())
 *                     .build())
 *                 .build())
 *             .workloadProfileType("GeneralPurpose")
 *             .build());
 *     }
 * }
 * ```
 * ### Create or Update Tcp App
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var containerApp = new AzureNative.App.ContainerApp("containerApp", new()
 *     {
 *         Configuration = new AzureNative.App.Inputs.ConfigurationArgs
 *         {
 *             Ingress = new AzureNative.App.Inputs.IngressArgs
 *             {
 *                 ExposedPort = 4000,
 *                 External = true,
 *                 TargetPort = 3000,
 *                 Traffic = new[]
 *                 {
 *                     new AzureNative.App.Inputs.TrafficWeightArgs
 *                     {
 *                         RevisionName = "testcontainerapptcp-ab1234",
 *                         Weight = 100,
 *                     },
 *                 },
 *                 Transport = AzureNative.App.IngressTransportMethod.Tcp,
 *             },
 *         },
 *         ContainerAppName = "testcontainerapptcp",
 *         EnvironmentId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
 *         Location = "East US",
 *         ResourceGroupName = "rg",
 *         Template = new AzureNative.App.Inputs.TemplateArgs
 *         {
 *             Containers = new[]
 *             {
 *                 new AzureNative.App.Inputs.ContainerArgs
 *                 {
 *                     Image = "repo/testcontainerapptcp:v1",
 *                     Name = "testcontainerapptcp",
 *                     Probes = new[]
 *                     {
 *                         new AzureNative.App.Inputs.ContainerAppProbeArgs
 *                         {
 *                             InitialDelaySeconds = 3,
 *                             PeriodSeconds = 3,
 *                             TcpSocket = new AzureNative.App.Inputs.ContainerAppProbeTcpSocketArgs
 *                             {
 *                                 Port = 8080,
 *                             },
 *                             Type = AzureNative.App.Type.Liveness,
 *                         },
 *                     },
 *                 },
 *             },
 *             Scale = new AzureNative.App.Inputs.ScaleArgs
 *             {
 *                 MaxReplicas = 5,
 *                 MinReplicas = 1,
 *                 Rules = new[]
 *                 {
 *                     new AzureNative.App.Inputs.ScaleRuleArgs
 *                     {
 *                         Name = "tcpscalingrule",
 *                         Tcp = new AzureNative.App.Inputs.TcpScaleRuleArgs
 *                         {
 *                             Metadata =
 *                             {
 *                                 { "concurrentConnections", "50" },
 *                             },
 *                         },
 *                     },
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	app "github.com/pulumi/pulumi-azure-native-sdk/app/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := app.NewContainerApp(ctx, "containerApp", &app.ContainerAppArgs{
 * 			Configuration: &app.ConfigurationArgs{
 * 				Ingress: &app.IngressArgs{
 * 					ExposedPort: pulumi.Int(4000),
 * 					External:    pulumi.Bool(true),
 * 					TargetPort:  pulumi.Int(3000),
 * 					Traffic: app.TrafficWeightArray{
 * 						&app.TrafficWeightArgs{
 * 							RevisionName: pulumi.String("testcontainerapptcp-ab1234"),
 * 							Weight:       pulumi.Int(100),
 * 						},
 * 					},
 * 					Transport: pulumi.String(app.IngressTransportMethodTcp),
 * 				},
 * 			},
 * 			ContainerAppName:  pulumi.String("testcontainerapptcp"),
 * 			EnvironmentId:     pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"),
 * 			Location:          pulumi.String("East US"),
 * 			ResourceGroupName: pulumi.String("rg"),
 * 			Template: &app.TemplateArgs{
 * 				Containers: app.ContainerArray{
 * 					&app.ContainerArgs{
 * 						Image: pulumi.String("repo/testcontainerapptcp:v1"),
 * 						Name:  pulumi.String("testcontainerapptcp"),
 * 						Probes: app.ContainerAppProbeArray{
 * 							&app.ContainerAppProbeArgs{
 * 								InitialDelaySeconds: pulumi.Int(3),
 * 								PeriodSeconds:       pulumi.Int(3),
 * 								TcpSocket: &app.ContainerAppProbeTcpSocketArgs{
 * 									Port: pulumi.Int(8080),
 * 								},
 * 								Type: pulumi.String(app.TypeLiveness),
 * 							},
 * 						},
 * 					},
 * 				},
 * 				Scale: &app.ScaleArgs{
 * 					MaxReplicas: pulumi.Int(5),
 * 					MinReplicas: pulumi.Int(1),
 * 					Rules: app.ScaleRuleArray{
 * 						&app.ScaleRuleArgs{
 * 							Name: pulumi.String("tcpscalingrule"),
 * 							Tcp: &app.TcpScaleRuleArgs{
 * 								Metadata: pulumi.StringMap{
 * 									"concurrentConnections": pulumi.String("50"),
 * 								},
 * 							},
 * 						},
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.azurenative.app.ContainerApp;
 * import com.pulumi.azurenative.app.ContainerAppArgs;
 * import com.pulumi.azurenative.app.inputs.ConfigurationArgs;
 * import com.pulumi.azurenative.app.inputs.IngressArgs;
 * import com.pulumi.azurenative.app.inputs.TemplateArgs;
 * import com.pulumi.azurenative.app.inputs.ScaleArgs;
 * 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 containerApp = new ContainerApp("containerApp", ContainerAppArgs.builder()
 *             .configuration(ConfigurationArgs.builder()
 *                 .ingress(IngressArgs.builder()
 *                     .exposedPort(4000)
 *                     .external(true)
 *                     .targetPort(3000)
 *                     .traffic(TrafficWeightArgs.builder()
 *                         .revisionName("testcontainerapptcp-ab1234")
 *                         .weight(100)
 *                         .build())
 *                     .transport("tcp")
 *                     .build())
 *                 .build())
 *             .containerAppName("testcontainerapptcp")
 *             .environmentId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube")
 *             .location("East US")
 *             .resourceGroupName("rg")
 *             .template(TemplateArgs.builder()
 *                 .containers(ContainerArgs.builder()
 *                     .image("repo/testcontainerapptcp:v1")
 *                     .name("testcontainerapptcp")
 *                     .probes(ContainerAppProbeArgs.builder()
 *                         .initialDelaySeconds(3)
 *                         .periodSeconds(3)
 *                         .tcpSocket(ContainerAppProbeTcpSocketArgs.builder()
 *                             .port(8080)
 *                             .build())
 *                         .type("Liveness")
 *                         .build())
 *                     .build())
 *                 .scale(ScaleArgs.builder()
 *                     .maxReplicas(5)
 *                     .minReplicas(1)
 *                     .rules(ScaleRuleArgs.builder()
 *                         .name("tcpscalingrule")
 *                         .tcp(TcpScaleRuleArgs.builder()
 *                             .metadata(Map.of("concurrentConnections", "50"))
 *                             .build())
 *                         .build())
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:app:ContainerApp testcontainerapptcp /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}
 * ```
 */
public class ContainerApp internal constructor(
    override val javaResource: com.pulumi.azurenative.app.ContainerApp,
) : KotlinCustomResource(javaResource, ContainerAppMapper) {
    /**
     * Non versioned Container App configuration properties.
     */
    public val configuration: Output?
        get() = javaResource.configuration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> configurationResponseToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Id used to verify domain name ownership
     */
    public val customDomainVerificationId: Output
        get() = javaResource.customDomainVerificationId().applyValue({ args0 -> args0 })

    /**
     * Resource ID of environment.
     */
    public val environmentId: Output?
        get() = javaResource.environmentId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The endpoint of the eventstream of the container app.
     */
    public val eventStreamEndpoint: Output
        get() = javaResource.eventStreamEndpoint().applyValue({ args0 -> args0 })

    /**
     * The complex type of the extended location.
     */
    public val extendedLocation: Output?
        get() = javaResource.extendedLocation().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> extendedLocationResponseToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * managed identities for the Container App to interact with other Azure services without maintaining any secrets or credentials in code.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    managedServiceIdentityResponseToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Name of the latest ready revision of the Container App.
     */
    public val latestReadyRevisionName: Output
        get() = javaResource.latestReadyRevisionName().applyValue({ args0 -> args0 })

    /**
     * Fully Qualified Domain Name of the latest revision of the Container App.
     */
    public val latestRevisionFqdn: Output
        get() = javaResource.latestRevisionFqdn().applyValue({ args0 -> args0 })

    /**
     * Name of the latest revision of the Container App.
     */
    public val latestRevisionName: Output
        get() = javaResource.latestRevisionName().applyValue({ args0 -> args0 })

    /**
     * The geo-location where the resource lives
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Deprecated. Resource ID of the Container App's environment.
     */
    public val managedEnvironmentId: Output?
        get() = javaResource.managedEnvironmentId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the resource
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Outbound IP Addresses for container app.
     */
    public val outboundIpAddresses: Output>
        get() = javaResource.outboundIpAddresses().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * Provisioning state of the Container App.
     */
    public val provisioningState: Output
        get() = javaResource.provisioningState().applyValue({ args0 -> args0 })

    /**
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    public val systemData: Output
        get() = javaResource.systemData().applyValue({ args0 ->
            args0.let({ args0 ->
                systemDataResponseToKotlin(args0)
            })
        })

    /**
     * Resource tags.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * Container App versioned application definition.
     */
    public val template: Output?
        get() = javaResource.template().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    templateResponseToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })

    /**
     * Workload profile type to pin for container app execution.
     */
    public val workloadProfileType: Output?
        get() = javaResource.workloadProfileType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object ContainerAppMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azurenative.app.ContainerApp::class == javaResource::class

    override fun map(javaResource: Resource): ContainerApp = ContainerApp(
        javaResource as
            com.pulumi.azurenative.app.ContainerApp,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy