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

com.pulumi.azure.appconfiguration.kotlin.ConfigurationFeature.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.14.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.appconfiguration.kotlin

import com.pulumi.azure.appconfiguration.kotlin.outputs.ConfigurationFeatureTargetingFilter
import com.pulumi.azure.appconfiguration.kotlin.outputs.ConfigurationFeatureTimewindowFilter
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.Double
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.appconfiguration.kotlin.outputs.ConfigurationFeatureTargetingFilter.Companion.toKotlin as configurationFeatureTargetingFilterToKotlin
import com.pulumi.azure.appconfiguration.kotlin.outputs.ConfigurationFeatureTimewindowFilter.Companion.toKotlin as configurationFeatureTimewindowFilterToKotlin

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

    public var args: ConfigurationFeatureArgs = ConfigurationFeatureArgs()

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

/**
 * Manages an Azure App Configuration Feature.
 * > **Note:** App Configuration Features are provisioned using a Data Plane API which requires the role `App Configuration Data Owner` on either the App Configuration or a parent scope (such as the Resource Group/Subscription). [More information can be found in the Azure Documentation for App Configuration](https://docs.microsoft.com/azure/azure-app-configuration/concept-enable-rbac#azure-built-in-roles-for-azure-app-configuration). This is similar to providing App Configuration Keys.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const appconf = new azure.appconfiguration.ConfigurationStore("appconf", {
 *     name: "appConf1",
 *     resourceGroupName: example.name,
 *     location: example.location,
 * });
 * const current = azure.core.getClientConfig({});
 * const appconfDataowner = new azure.authorization.Assignment("appconf_dataowner", {
 *     scope: appconf.id,
 *     roleDefinitionName: "App Configuration Data Owner",
 *     principalId: current.then(current => current.objectId),
 * });
 * const test = new azure.appconfiguration.ConfigurationFeature("test", {
 *     configurationStoreId: appconf.id,
 *     description: "test description",
 *     name: "test-ackey",
 *     label: "test-ackeylabel",
 *     enabled: true,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * appconf = azure.appconfiguration.ConfigurationStore("appconf",
 *     name="appConf1",
 *     resource_group_name=example.name,
 *     location=example.location)
 * current = azure.core.get_client_config()
 * appconf_dataowner = azure.authorization.Assignment("appconf_dataowner",
 *     scope=appconf.id,
 *     role_definition_name="App Configuration Data Owner",
 *     principal_id=current.object_id)
 * test = azure.appconfiguration.ConfigurationFeature("test",
 *     configuration_store_id=appconf.id,
 *     description="test description",
 *     name="test-ackey",
 *     label="test-ackeylabel",
 *     enabled=True)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var appconf = new Azure.AppConfiguration.ConfigurationStore("appconf", new()
 *     {
 *         Name = "appConf1",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *     });
 *     var current = Azure.Core.GetClientConfig.Invoke();
 *     var appconfDataowner = new Azure.Authorization.Assignment("appconf_dataowner", new()
 *     {
 *         Scope = appconf.Id,
 *         RoleDefinitionName = "App Configuration Data Owner",
 *         PrincipalId = current.Apply(getClientConfigResult => getClientConfigResult.ObjectId),
 *     });
 *     var test = new Azure.AppConfiguration.ConfigurationFeature("test", new()
 *     {
 *         ConfigurationStoreId = appconf.Id,
 *         Description = "test description",
 *         Name = "test-ackey",
 *         Label = "test-ackeylabel",
 *         Enabled = true,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appconfiguration"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		appconf, err := appconfiguration.NewConfigurationStore(ctx, "appconf", &appconfiguration.ConfigurationStoreArgs{
 * 			Name:              pulumi.String("appConf1"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		current, err := core.GetClientConfig(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = authorization.NewAssignment(ctx, "appconf_dataowner", &authorization.AssignmentArgs{
 * 			Scope:              appconf.ID(),
 * 			RoleDefinitionName: pulumi.String("App Configuration Data Owner"),
 * 			PrincipalId:        pulumi.String(current.ObjectId),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = appconfiguration.NewConfigurationFeature(ctx, "test", &appconfiguration.ConfigurationFeatureArgs{
 * 			ConfigurationStoreId: appconf.ID(),
 * 			Description:          pulumi.String("test description"),
 * 			Name:                 pulumi.String("test-ackey"),
 * 			Label:                pulumi.String("test-ackeylabel"),
 * 			Enabled:              pulumi.Bool(true),
 * 		})
 * 		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.appconfiguration.ConfigurationStore;
 * import com.pulumi.azure.appconfiguration.ConfigurationStoreArgs;
 * import com.pulumi.azure.core.CoreFunctions;
 * import com.pulumi.azure.authorization.Assignment;
 * import com.pulumi.azure.authorization.AssignmentArgs;
 * import com.pulumi.azure.appconfiguration.ConfigurationFeature;
 * import com.pulumi.azure.appconfiguration.ConfigurationFeatureArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var appconf = new ConfigurationStore("appconf", ConfigurationStoreArgs.builder()
 *             .name("appConf1")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .build());
 *         final var current = CoreFunctions.getClientConfig();
 *         var appconfDataowner = new Assignment("appconfDataowner", AssignmentArgs.builder()
 *             .scope(appconf.id())
 *             .roleDefinitionName("App Configuration Data Owner")
 *             .principalId(current.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
 *             .build());
 *         var test = new ConfigurationFeature("test", ConfigurationFeatureArgs.builder()
 *             .configurationStoreId(appconf.id())
 *             .description("test description")
 *             .name("test-ackey")
 *             .label("test-ackeylabel")
 *             .enabled(true)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   appconf:
 *     type: azure:appconfiguration:ConfigurationStore
 *     properties:
 *       name: appConf1
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *   appconfDataowner:
 *     type: azure:authorization:Assignment
 *     name: appconf_dataowner
 *     properties:
 *       scope: ${appconf.id}
 *       roleDefinitionName: App Configuration Data Owner
 *       principalId: ${current.objectId}
 *   test:
 *     type: azure:appconfiguration:ConfigurationFeature
 *     properties:
 *       configurationStoreId: ${appconf.id}
 *       description: test description
 *       name: test-ackey
 *       label: test-ackeylabel
 *       enabled: true
 * variables:
 *   current:
 *     fn::invoke:
 *       Function: azure:core:getClientConfig
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * App Configuration Features can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:appconfiguration/configurationFeature:ConfigurationFeature test https://appconfname1.azconfig.io/kv/.appconfig.featureflag%2FkeyName?label=labelName
 * ```
 * If you wish to import with an empty label then simply leave the label's name blank:
 * ```sh
 * $ pulumi import azure:appconfiguration/configurationFeature:ConfigurationFeature test https://appconfname1.azconfig.io/kv/.appconfig.featureflag%2FkeyName?label=
 * ```
 */
public class ConfigurationFeature internal constructor(
    override val javaResource: com.pulumi.azure.appconfiguration.ConfigurationFeature,
) : KotlinCustomResource(javaResource, ConfigurationFeatureMapper) {
    /**
     * Specifies the id of the App Configuration. Changing this forces a new resource to be created.
     */
    public val configurationStoreId: Output
        get() = javaResource.configurationStoreId().applyValue({ args0 -> args0 })

    /**
     * The description of the App Configuration Feature.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The status of the App Configuration Feature. By default, this is set to false.
     */
    public val enabled: Output?
        get() = javaResource.enabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    public val etag: Output
        get() = javaResource.etag().applyValue({ args0 -> args0 })

    /**
     * The key of the App Configuration Feature. The value for `name` will be used if this is unspecified. Changing this forces a new resource to be created.
     */
    public val key: Output
        get() = javaResource.key().applyValue({ args0 -> args0 })

    /**
     * The label of the App Configuration Feature. Changing this forces a new resource to be created.
     */
    public val label: Output?
        get() = javaResource.label().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Should this App Configuration Feature be Locked to prevent changes?
     */
    public val locked: Output?
        get() = javaResource.locked().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The name of the App Configuration Feature. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * A number representing the value of the percentage required to enable this feature.
     */
    public val percentageFilterValue: Output?
        get() = javaResource.percentageFilterValue().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A mapping of tags to assign to the resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * A `targeting_filter` block as defined below.
     */
    public val targetingFilters: Output>?
        get() = javaResource.targetingFilters().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        configurationFeatureTargetingFilterToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * A `timewindow_filter` block as defined below.
     */
    public val timewindowFilters: Output>?
        get() = javaResource.timewindowFilters().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        configurationFeatureTimewindowFilterToKotlin(args0)
                    })
                })
            }).orElse(null)
        })
}

public object ConfigurationFeatureMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.appconfiguration.ConfigurationFeature::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy