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

com.pulumi.azure.batch.kotlin.Application.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.batch.kotlin

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

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

/**
 * Manages Azure Batch Application instance.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-rg",
 *     location: "West Europe",
 * });
 * const exampleAccount = new azure.storage.Account("example", {
 *     name: "examplesa",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const exampleAccount2 = new azure.batch.Account("example", {
 *     name: "exampleba",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     poolAllocationMode: "BatchService",
 *     storageAccountId: exampleAccount.id,
 *     storageAccountAuthenticationMode: "StorageKeys",
 * });
 * const exampleApplication = new azure.batch.Application("example", {
 *     name: "example-batch-application",
 *     resourceGroupName: example.name,
 *     accountName: exampleAccount2.name,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-rg",
 *     location="West Europe")
 * example_account = azure.storage.Account("example",
 *     name="examplesa",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     account_tier="Standard",
 *     account_replication_type="LRS")
 * example_account2 = azure.batch.Account("example",
 *     name="exampleba",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     pool_allocation_mode="BatchService",
 *     storage_account_id=example_account.id,
 *     storage_account_authentication_mode="StorageKeys")
 * example_application = azure.batch.Application("example",
 *     name="example-batch-application",
 *     resource_group_name=example.name,
 *     account_name=example_account2.name)
 * ```
 * ```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-rg",
 *         Location = "West Europe",
 *     });
 *     var exampleAccount = new Azure.Storage.Account("example", new()
 *     {
 *         Name = "examplesa",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AccountTier = "Standard",
 *         AccountReplicationType = "LRS",
 *     });
 *     var exampleAccount2 = new Azure.Batch.Account("example", new()
 *     {
 *         Name = "exampleba",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         PoolAllocationMode = "BatchService",
 *         StorageAccountId = exampleAccount.Id,
 *         StorageAccountAuthenticationMode = "StorageKeys",
 *     });
 *     var exampleApplication = new Azure.Batch.Application("example", new()
 *     {
 *         Name = "example-batch-application",
 *         ResourceGroupName = example.Name,
 *         AccountName = exampleAccount2.Name,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/batch"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
 * 	"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-rg"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
 * 			Name:                   pulumi.String("examplesa"),
 * 			ResourceGroupName:      example.Name,
 * 			Location:               example.Location,
 * 			AccountTier:            pulumi.String("Standard"),
 * 			AccountReplicationType: pulumi.String("LRS"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAccount2, err := batch.NewAccount(ctx, "example", &batch.AccountArgs{
 * 			Name:                             pulumi.String("exampleba"),
 * 			ResourceGroupName:                example.Name,
 * 			Location:                         example.Location,
 * 			PoolAllocationMode:               pulumi.String("BatchService"),
 * 			StorageAccountId:                 exampleAccount.ID(),
 * 			StorageAccountAuthenticationMode: pulumi.String("StorageKeys"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = batch.NewApplication(ctx, "example", &batch.ApplicationArgs{
 * 			Name:              pulumi.String("example-batch-application"),
 * 			ResourceGroupName: example.Name,
 * 			AccountName:       exampleAccount2.Name,
 * 		})
 * 		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.storage.Account;
 * import com.pulumi.azure.storage.AccountArgs;
 * import com.pulumi.azure.batch.Account;
 * import com.pulumi.azure.batch.AccountArgs;
 * import com.pulumi.azure.batch.Application;
 * import com.pulumi.azure.batch.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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-rg")
 *             .location("West Europe")
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("examplesa")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .build());
 *         var exampleAccount2 = new Account("exampleAccount2", AccountArgs.builder()
 *             .name("exampleba")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .poolAllocationMode("BatchService")
 *             .storageAccountId(exampleAccount.id())
 *             .storageAccountAuthenticationMode("StorageKeys")
 *             .build());
 *         var exampleApplication = new Application("exampleApplication", ApplicationArgs.builder()
 *             .name("example-batch-application")
 *             .resourceGroupName(example.name())
 *             .accountName(exampleAccount2.name())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-rg
 *       location: West Europe
 *   exampleAccount:
 *     type: azure:storage:Account
 *     name: example
 *     properties:
 *       name: examplesa
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       accountTier: Standard
 *       accountReplicationType: LRS
 *   exampleAccount2:
 *     type: azure:batch:Account
 *     name: example
 *     properties:
 *       name: exampleba
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       poolAllocationMode: BatchService
 *       storageAccountId: ${exampleAccount.id}
 *       storageAccountAuthenticationMode: StorageKeys
 *   exampleApplication:
 *     type: azure:batch:Application
 *     name: example
 *     properties:
 *       name: example-batch-application
 *       resourceGroupName: ${example.name}
 *       accountName: ${exampleAccount2.name}
 * ```
 * 
 * ## Import
 * Batch Applications can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:batch/application:Application example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-rg/providers/Microsoft.Batch/batchAccounts/exampleba/applications/example-batch-application
 * ```
 */
public class Application internal constructor(
    override val javaResource: com.pulumi.azure.batch.Application,
) : KotlinCustomResource(javaResource, ApplicationMapper) {
    /**
     * The name of the Batch account. Changing this forces a new resource to be created.
     */
    public val accountName: Output
        get() = javaResource.accountName().applyValue({ args0 -> args0 })

    /**
     * A value indicating whether packages within the application may be overwritten using the same version string. Defaults to `true`.
     */
    public val allowUpdates: Output?
        get() = javaResource.allowUpdates().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The package to use if a client requests the application but does not specify a version. This property can only be set to the name of an existing package.
     */
    public val defaultVersion: Output?
        get() = javaResource.defaultVersion().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The display name for the application.
     */
    public val displayName: Output?
        get() = javaResource.displayName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the application. This must be unique within the account. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The name of the resource group that contains the Batch account. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
}

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

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