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

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

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

package com.pulumi.azurenative.app.kotlin

import com.pulumi.azurenative.app.kotlin.outputs.CustomContainerTemplateResponse
import com.pulumi.azurenative.app.kotlin.outputs.DynamicPoolConfigurationResponse
import com.pulumi.azurenative.app.kotlin.outputs.ScaleConfigurationResponse
import com.pulumi.azurenative.app.kotlin.outputs.SessionNetworkConfigurationResponse
import com.pulumi.azurenative.app.kotlin.outputs.SessionPoolSecretResponse
import com.pulumi.azurenative.app.kotlin.outputs.SystemDataResponse
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.List
import kotlin.collections.Map
import com.pulumi.azurenative.app.kotlin.outputs.CustomContainerTemplateResponse.Companion.toKotlin as customContainerTemplateResponseToKotlin
import com.pulumi.azurenative.app.kotlin.outputs.DynamicPoolConfigurationResponse.Companion.toKotlin as dynamicPoolConfigurationResponseToKotlin
import com.pulumi.azurenative.app.kotlin.outputs.ScaleConfigurationResponse.Companion.toKotlin as scaleConfigurationResponseToKotlin
import com.pulumi.azurenative.app.kotlin.outputs.SessionNetworkConfigurationResponse.Companion.toKotlin as sessionNetworkConfigurationResponseToKotlin
import com.pulumi.azurenative.app.kotlin.outputs.SessionPoolSecretResponse.Companion.toKotlin as sessionPoolSecretResponseToKotlin
import com.pulumi.azurenative.app.kotlin.outputs.SystemDataResponse.Companion.toKotlin as systemDataResponseToKotlin

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

    public var args: ContainerAppsSessionPoolArgs = ContainerAppsSessionPoolArgs()

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

/**
 * Container App session pool.
 * Azure REST API version: 2024-02-02-preview.
 * ## Example Usage
 * ### Create or Update Session Pool
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var containerAppsSessionPool = new AzureNative.App.ContainerAppsSessionPool("containerAppsSessionPool", new()
 *     {
 *         ContainerType = AzureNative.App.ContainerType.CustomContainer,
 *         CustomContainerTemplate = new AzureNative.App.Inputs.CustomContainerTemplateArgs
 *         {
 *             Containers = new[]
 *             {
 *                 new AzureNative.App.Inputs.SessionContainerArgs
 *                 {
 *                     Args = new[]
 *                     {
 *                         "-c",
 *                         "while true; do echo hello; sleep 10;done",
 *                     },
 *                     Command = new[]
 *                     {
 *                         "/bin/sh",
 *                     },
 *                     Image = "repo/testcontainer:v4",
 *                     Name = "testinitcontainer",
 *                     Resources = new AzureNative.App.Inputs.SessionContainerResourcesArgs
 *                     {
 *                         Cpu = 0.25,
 *                         Memory = "0.5Gi",
 *                     },
 *                 },
 *             },
 *             Ingress = new AzureNative.App.Inputs.SessionIngressArgs
 *             {
 *                 TargetPort = 80,
 *             },
 *         },
 *         DynamicPoolConfiguration = new AzureNative.App.Inputs.DynamicPoolConfigurationArgs
 *         {
 *             CooldownPeriodInSeconds = 600,
 *             ExecutionType = AzureNative.App.ExecutionType.Timed,
 *         },
 *         EnvironmentId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
 *         Location = "East US",
 *         PoolManagementType = AzureNative.App.PoolManagementType.Dynamic,
 *         ResourceGroupName = "rg",
 *         ScaleConfiguration = new AzureNative.App.Inputs.ScaleConfigurationArgs
 *         {
 *             MaxConcurrentSessions = 500,
 *             ReadySessionInstances = 100,
 *         },
 *         SessionNetworkConfiguration = new AzureNative.App.Inputs.SessionNetworkConfigurationArgs
 *         {
 *             Status = AzureNative.App.SessionNetworkStatus.EgressEnabled,
 *         },
 *         SessionPoolName = "testsessionpool",
 *     });
 * });
 * ```
 * ```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.NewContainerAppsSessionPool(ctx, "containerAppsSessionPool", &app.ContainerAppsSessionPoolArgs{
 * 			ContainerType: pulumi.String(app.ContainerTypeCustomContainer),
 * 			CustomContainerTemplate: &app.CustomContainerTemplateArgs{
 * 				Containers: app.SessionContainerArray{
 * 					&app.SessionContainerArgs{
 * 						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/testcontainer:v4"),
 * 						Name:  pulumi.String("testinitcontainer"),
 * 						Resources: &app.SessionContainerResourcesArgs{
 * 							Cpu:    pulumi.Float64(0.25),
 * 							Memory: pulumi.String("0.5Gi"),
 * 						},
 * 					},
 * 				},
 * 				Ingress: &app.SessionIngressArgs{
 * 					TargetPort: pulumi.Int(80),
 * 				},
 * 			},
 * 			DynamicPoolConfiguration: &app.DynamicPoolConfigurationArgs{
 * 				CooldownPeriodInSeconds: pulumi.Int(600),
 * 				ExecutionType:           pulumi.String(app.ExecutionTypeTimed),
 * 			},
 * 			EnvironmentId:      pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"),
 * 			Location:           pulumi.String("East US"),
 * 			PoolManagementType: pulumi.String(app.PoolManagementTypeDynamic),
 * 			ResourceGroupName:  pulumi.String("rg"),
 * 			ScaleConfiguration: &app.ScaleConfigurationArgs{
 * 				MaxConcurrentSessions: pulumi.Int(500),
 * 				ReadySessionInstances: pulumi.Int(100),
 * 			},
 * 			SessionNetworkConfiguration: &app.SessionNetworkConfigurationArgs{
 * 				Status: pulumi.String(app.SessionNetworkStatusEgressEnabled),
 * 			},
 * 			SessionPoolName: pulumi.String("testsessionpool"),
 * 		})
 * 		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.ContainerAppsSessionPool;
 * import com.pulumi.azurenative.app.ContainerAppsSessionPoolArgs;
 * import com.pulumi.azurenative.app.inputs.CustomContainerTemplateArgs;
 * import com.pulumi.azurenative.app.inputs.SessionIngressArgs;
 * import com.pulumi.azurenative.app.inputs.DynamicPoolConfigurationArgs;
 * import com.pulumi.azurenative.app.inputs.ScaleConfigurationArgs;
 * import com.pulumi.azurenative.app.inputs.SessionNetworkConfigurationArgs;
 * 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 containerAppsSessionPool = new ContainerAppsSessionPool("containerAppsSessionPool", ContainerAppsSessionPoolArgs.builder()
 *             .containerType("CustomContainer")
 *             .customContainerTemplate(CustomContainerTemplateArgs.builder()
 *                 .containers(SessionContainerArgs.builder()
 *                     .args(
 *                         "-c",
 *                         "while true; do echo hello; sleep 10;done")
 *                     .command("/bin/sh")
 *                     .image("repo/testcontainer:v4")
 *                     .name("testinitcontainer")
 *                     .resources(SessionContainerResourcesArgs.builder()
 *                         .cpu(0.25)
 *                         .memory("0.5Gi")
 *                         .build())
 *                     .build())
 *                 .ingress(SessionIngressArgs.builder()
 *                     .targetPort(80)
 *                     .build())
 *                 .build())
 *             .dynamicPoolConfiguration(DynamicPoolConfigurationArgs.builder()
 *                 .cooldownPeriodInSeconds(600)
 *                 .executionType("Timed")
 *                 .build())
 *             .environmentId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube")
 *             .location("East US")
 *             .poolManagementType("Dynamic")
 *             .resourceGroupName("rg")
 *             .scaleConfiguration(ScaleConfigurationArgs.builder()
 *                 .maxConcurrentSessions(500)
 *                 .readySessionInstances(100)
 *                 .build())
 *             .sessionNetworkConfiguration(SessionNetworkConfigurationArgs.builder()
 *                 .status("EgressEnabled")
 *                 .build())
 *             .sessionPoolName("testsessionpool")
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:app:ContainerAppsSessionPool testsessionpool /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}
 * ```
 */
public class ContainerAppsSessionPool internal constructor(
    override val javaResource: com.pulumi.azurenative.app.ContainerAppsSessionPool,
) : KotlinCustomResource(javaResource, ContainerAppsSessionPoolMapper) {
    /**
     * The container type of the sessions.
     */
    public val containerType: Output?
        get() = javaResource.containerType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The custom container configuration if the containerType is CustomContainer.
     */
    public val customContainerTemplate: Output?
        get() = javaResource.customContainerTemplate().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> customContainerTemplateResponseToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The pool configuration if the poolManagementType is dynamic.
     */
    public val dynamicPoolConfiguration: Output?
        get() = javaResource.dynamicPoolConfiguration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> dynamicPoolConfigurationResponseToKotlin(args0) })
            }).orElse(null)
        })

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

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

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

    /**
     * The number of nodes the session pool is using.
     */
    public val nodeCount: Output
        get() = javaResource.nodeCount().applyValue({ args0 -> args0 })

    /**
     * The endpoint to manage the pool.
     */
    public val poolManagementEndpoint: Output
        get() = javaResource.poolManagementEndpoint().applyValue({ args0 -> args0 })

    /**
     * The pool management type of the session pool.
     */
    public val poolManagementType: Output?
        get() = javaResource.poolManagementType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

    /**
     * The scale configuration of the session pool.
     */
    public val scaleConfiguration: Output?
        get() = javaResource.scaleConfiguration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> scaleConfigurationResponseToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The secrets of the session pool.
     */
    public val secrets: Output>?
        get() = javaResource.secrets().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> sessionPoolSecretResponseToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * The network configuration of the sessions in the session pool.
     */
    public val sessionNetworkConfiguration: Output?
        get() = javaResource.sessionNetworkConfiguration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> sessionNetworkConfigurationResponseToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * 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)
        })

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

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy