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

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

package com.pulumi.azure.managedapplication.kotlin

import com.pulumi.azure.managedapplication.DefinitionArgs.builder
import com.pulumi.azure.managedapplication.kotlin.inputs.DefinitionAuthorizationArgs
import com.pulumi.azure.managedapplication.kotlin.inputs.DefinitionAuthorizationArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Manages a Managed Application Definition.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const current = azure.core.getClientConfig({});
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleDefinition = new azure.managedapplication.Definition("example", {
 *     name: "examplemanagedapplicationdefinition",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     lockLevel: "ReadOnly",
 *     packageFileUri: "https://github.com/Azure/azure-managedapp-samples/raw/master/Managed Application Sample Packages/201-managed-storage-account/managedstorage.zip",
 *     displayName: "TestManagedApplicationDefinition",
 *     description: "Test Managed Application Definition",
 *     authorizations: [{
 *         servicePrincipalId: current.then(current => current.objectId),
 *         roleDefinitionId: "a094b430-dad3-424d-ae58-13f72fd72591",
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * current = azure.core.get_client_config()
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_definition = azure.managedapplication.Definition("example",
 *     name="examplemanagedapplicationdefinition",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     lock_level="ReadOnly",
 *     package_file_uri="https://github.com/Azure/azure-managedapp-samples/raw/master/Managed Application Sample Packages/201-managed-storage-account/managedstorage.zip",
 *     display_name="TestManagedApplicationDefinition",
 *     description="Test Managed Application Definition",
 *     authorizations=[{
 *         "service_principal_id": current.object_id,
 *         "role_definition_id": "a094b430-dad3-424d-ae58-13f72fd72591",
 *     }])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var current = Azure.Core.GetClientConfig.Invoke();
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleDefinition = new Azure.ManagedApplication.Definition("example", new()
 *     {
 *         Name = "examplemanagedapplicationdefinition",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         LockLevel = "ReadOnly",
 *         PackageFileUri = "https://github.com/Azure/azure-managedapp-samples/raw/master/Managed Application Sample Packages/201-managed-storage-account/managedstorage.zip",
 *         DisplayName = "TestManagedApplicationDefinition",
 *         Description = "Test Managed Application Definition",
 *         Authorizations = new[]
 *         {
 *             new Azure.ManagedApplication.Inputs.DefinitionAuthorizationArgs
 *             {
 *                 ServicePrincipalId = current.Apply(getClientConfigResult => getClientConfigResult.ObjectId),
 *                 RoleDefinitionId = "a094b430-dad3-424d-ae58-13f72fd72591",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/managedapplication"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		current, err := core.GetClientConfig(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = managedapplication.NewDefinition(ctx, "example", &managedapplication.DefinitionArgs{
 * 			Name:              pulumi.String("examplemanagedapplicationdefinition"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			LockLevel:         pulumi.String("ReadOnly"),
 * 			PackageFileUri:    pulumi.String("https://github.com/Azure/azure-managedapp-samples/raw/master/Managed Application Sample Packages/201-managed-storage-account/managedstorage.zip"),
 * 			DisplayName:       pulumi.String("TestManagedApplicationDefinition"),
 * 			Description:       pulumi.String("Test Managed Application Definition"),
 * 			Authorizations: managedapplication.DefinitionAuthorizationArray{
 * 				&managedapplication.DefinitionAuthorizationArgs{
 * 					ServicePrincipalId: pulumi.String(current.ObjectId),
 * 					RoleDefinitionId:   pulumi.String("a094b430-dad3-424d-ae58-13f72fd72591"),
 * 				},
 * 			},
 * 		})
 * 		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.CoreFunctions;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.managedapplication.Definition;
 * import com.pulumi.azure.managedapplication.DefinitionArgs;
 * import com.pulumi.azure.managedapplication.inputs.DefinitionAuthorizationArgs;
 * 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) {
 *         final var current = CoreFunctions.getClientConfig();
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleDefinition = new Definition("exampleDefinition", DefinitionArgs.builder()
 *             .name("examplemanagedapplicationdefinition")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .lockLevel("ReadOnly")
 *             .packageFileUri("https://github.com/Azure/azure-managedapp-samples/raw/master/Managed Application Sample Packages/201-managed-storage-account/managedstorage.zip")
 *             .displayName("TestManagedApplicationDefinition")
 *             .description("Test Managed Application Definition")
 *             .authorizations(DefinitionAuthorizationArgs.builder()
 *                 .servicePrincipalId(current.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
 *                 .roleDefinitionId("a094b430-dad3-424d-ae58-13f72fd72591")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleDefinition:
 *     type: azure:managedapplication:Definition
 *     name: example
 *     properties:
 *       name: examplemanagedapplicationdefinition
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       lockLevel: ReadOnly
 *       packageFileUri: https://github.com/Azure/azure-managedapp-samples/raw/master/Managed Application Sample Packages/201-managed-storage-account/managedstorage.zip
 *       displayName: TestManagedApplicationDefinition
 *       description: Test Managed Application Definition
 *       authorizations:
 *         - servicePrincipalId: ${current.objectId}
 *           roleDefinitionId: a094b430-dad3-424d-ae58-13f72fd72591
 * variables:
 *   current:
 *     fn::invoke:
 *       Function: azure:core:getClientConfig
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * Managed Application Definition can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:managedapplication/definition:Definition example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Solutions/applicationDefinitions/appDefinition1
 * ```
 * @property authorizations One or more `authorization` block defined below.
 * @property createUiDefinition Specifies the `createUiDefinition` JSON for the backing template with `Microsoft.Solutions/applications` resource.
 * @property description Specifies the managed application definition description.
 * @property displayName Specifies the managed application definition display name.
 * @property location Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
 * @property lockLevel Specifies the managed application lock level. Valid values include `CanNotDelete`, `None`, `ReadOnly`. Changing this forces a new resource to be created.
 * @property mainTemplate Specifies the inline main template JSON which has resources to be provisioned.
 * @property name Specifies the name of the Managed Application Definition. Changing this forces a new resource to be created.
 * @property packageEnabled Is the package enabled? Defaults to `true`.
 * @property packageFileUri Specifies the managed application definition package file Uri.
 * @property resourceGroupName The name of the Resource Group where the Managed Application Definition should exist. Changing this forces a new resource to be created.
 * @property tags A mapping of tags to assign to the resource.
 * > **NOTE:** If either `create_ui_definition` or `main_template` is set they both must be set.
 */
public data class DefinitionArgs(
    public val authorizations: Output>? = null,
    public val createUiDefinition: Output? = null,
    public val description: Output? = null,
    public val displayName: Output? = null,
    public val location: Output? = null,
    public val lockLevel: Output? = null,
    public val mainTemplate: Output? = null,
    public val name: Output? = null,
    public val packageEnabled: Output? = null,
    public val packageFileUri: Output? = null,
    public val resourceGroupName: Output? = null,
    public val tags: Output>? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.managedapplication.DefinitionArgs =
        com.pulumi.azure.managedapplication.DefinitionArgs.builder()
            .authorizations(
                authorizations?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .createUiDefinition(createUiDefinition?.applyValue({ args0 -> args0 }))
            .description(description?.applyValue({ args0 -> args0 }))
            .displayName(displayName?.applyValue({ args0 -> args0 }))
            .location(location?.applyValue({ args0 -> args0 }))
            .lockLevel(lockLevel?.applyValue({ args0 -> args0 }))
            .mainTemplate(mainTemplate?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .packageEnabled(packageEnabled?.applyValue({ args0 -> args0 }))
            .packageFileUri(packageFileUri?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .tags(
                tags?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            ).build()
}

/**
 * Builder for [DefinitionArgs].
 */
@PulumiTagMarker
public class DefinitionArgsBuilder internal constructor() {
    private var authorizations: Output>? = null

    private var createUiDefinition: Output? = null

    private var description: Output? = null

    private var displayName: Output? = null

    private var location: Output? = null

    private var lockLevel: Output? = null

    private var mainTemplate: Output? = null

    private var name: Output? = null

    private var packageEnabled: Output? = null

    private var packageFileUri: Output? = null

    private var resourceGroupName: Output? = null

    private var tags: Output>? = null

    /**
     * @param value One or more `authorization` block defined below.
     */
    @JvmName("ktisxxmyrfdgstws")
    public suspend fun authorizations(`value`: Output>) {
        this.authorizations = value
    }

    @JvmName("ovkrkdlmjainucix")
    public suspend fun authorizations(vararg values: Output) {
        this.authorizations = Output.all(values.asList())
    }

    /**
     * @param values One or more `authorization` block defined below.
     */
    @JvmName("tyxrhwwfudpwvwfq")
    public suspend fun authorizations(values: List>) {
        this.authorizations = Output.all(values)
    }

    /**
     * @param value Specifies the `createUiDefinition` JSON for the backing template with `Microsoft.Solutions/applications` resource.
     */
    @JvmName("urgermknpxvkyymd")
    public suspend fun createUiDefinition(`value`: Output) {
        this.createUiDefinition = value
    }

    /**
     * @param value Specifies the managed application definition description.
     */
    @JvmName("rhwvmeesgauygrvr")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value Specifies the managed application definition display name.
     */
    @JvmName("fppvluxaamrnpidp")
    public suspend fun displayName(`value`: Output) {
        this.displayName = value
    }

    /**
     * @param value Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
     */
    @JvmName("flikwbwbbudkpcpy")
    public suspend fun location(`value`: Output) {
        this.location = value
    }

    /**
     * @param value Specifies the managed application lock level. Valid values include `CanNotDelete`, `None`, `ReadOnly`. Changing this forces a new resource to be created.
     */
    @JvmName("lvdlmqnyulmoedsy")
    public suspend fun lockLevel(`value`: Output) {
        this.lockLevel = value
    }

    /**
     * @param value Specifies the inline main template JSON which has resources to be provisioned.
     */
    @JvmName("epnsmqiamgfkvcvk")
    public suspend fun mainTemplate(`value`: Output) {
        this.mainTemplate = value
    }

    /**
     * @param value Specifies the name of the Managed Application Definition. Changing this forces a new resource to be created.
     */
    @JvmName("otnapxgksbjloegf")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value Is the package enabled? Defaults to `true`.
     */
    @JvmName("jroccnohosnrcmev")
    public suspend fun packageEnabled(`value`: Output) {
        this.packageEnabled = value
    }

    /**
     * @param value Specifies the managed application definition package file Uri.
     */
    @JvmName("baanixqvyddhvgbx")
    public suspend fun packageFileUri(`value`: Output) {
        this.packageFileUri = value
    }

    /**
     * @param value The name of the Resource Group where the Managed Application Definition should exist. Changing this forces a new resource to be created.
     */
    @JvmName("catoxhyqplqwvvnf")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value A mapping of tags to assign to the resource.
     * > **NOTE:** If either `create_ui_definition` or `main_template` is set they both must be set.
     */
    @JvmName("jyevnduoachirqfe")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value One or more `authorization` block defined below.
     */
    @JvmName("xmrtymridepxxyjh")
    public suspend fun authorizations(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.authorizations = mapped
    }

    /**
     * @param argument One or more `authorization` block defined below.
     */
    @JvmName("yxopxqslhjnguopj")
    public suspend fun authorizations(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            DefinitionAuthorizationArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.authorizations = mapped
    }

    /**
     * @param argument One or more `authorization` block defined below.
     */
    @JvmName("awsokgvefmnkhqrj")
    public suspend fun authorizations(vararg argument: suspend DefinitionAuthorizationArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            DefinitionAuthorizationArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.authorizations = mapped
    }

    /**
     * @param argument One or more `authorization` block defined below.
     */
    @JvmName("yasbjwvphpjhsfnq")
    public suspend fun authorizations(argument: suspend DefinitionAuthorizationArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            DefinitionAuthorizationArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.authorizations = mapped
    }

    /**
     * @param values One or more `authorization` block defined below.
     */
    @JvmName("cksgykigecsxhwvb")
    public suspend fun authorizations(vararg values: DefinitionAuthorizationArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.authorizations = mapped
    }

    /**
     * @param value Specifies the `createUiDefinition` JSON for the backing template with `Microsoft.Solutions/applications` resource.
     */
    @JvmName("pdwkeclmiksbkdtp")
    public suspend fun createUiDefinition(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.createUiDefinition = mapped
    }

    /**
     * @param value Specifies the managed application definition description.
     */
    @JvmName("fhbfhoeacmwqpbvd")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value Specifies the managed application definition display name.
     */
    @JvmName("vsjswvciookslvvf")
    public suspend fun displayName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.displayName = mapped
    }

    /**
     * @param value Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
     */
    @JvmName("ycfsefslieqcmgld")
    public suspend fun location(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.location = mapped
    }

    /**
     * @param value Specifies the managed application lock level. Valid values include `CanNotDelete`, `None`, `ReadOnly`. Changing this forces a new resource to be created.
     */
    @JvmName("ueuxugyrmsiynqcy")
    public suspend fun lockLevel(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.lockLevel = mapped
    }

    /**
     * @param value Specifies the inline main template JSON which has resources to be provisioned.
     */
    @JvmName("lcaqeakmwvpfbdcm")
    public suspend fun mainTemplate(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.mainTemplate = mapped
    }

    /**
     * @param value Specifies the name of the Managed Application Definition. Changing this forces a new resource to be created.
     */
    @JvmName("ehpdshkqetngkctc")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value Is the package enabled? Defaults to `true`.
     */
    @JvmName("jxysxeymcsdpapog")
    public suspend fun packageEnabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.packageEnabled = mapped
    }

    /**
     * @param value Specifies the managed application definition package file Uri.
     */
    @JvmName("shsascdguxhkyqxl")
    public suspend fun packageFileUri(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.packageFileUri = mapped
    }

    /**
     * @param value The name of the Resource Group where the Managed Application Definition should exist. Changing this forces a new resource to be created.
     */
    @JvmName("nebvvfoftpfgynys")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value A mapping of tags to assign to the resource.
     * > **NOTE:** If either `create_ui_definition` or `main_template` is set they both must be set.
     */
    @JvmName("lceowcksnqcntotm")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values A mapping of tags to assign to the resource.
     * > **NOTE:** If either `create_ui_definition` or `main_template` is set they both must be set.
     */
    @JvmName("uqbjaorvhlojxlhr")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    internal fun build(): DefinitionArgs = DefinitionArgs(
        authorizations = authorizations,
        createUiDefinition = createUiDefinition,
        description = description,
        displayName = displayName,
        location = location,
        lockLevel = lockLevel,
        mainTemplate = mainTemplate,
        name = name,
        packageEnabled = packageEnabled,
        packageFileUri = packageFileUri,
        resourceGroupName = resourceGroupName,
        tags = tags,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy