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

com.pulumi.azurenative.network.kotlin.UserRuleCollection.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: 2.82.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azurenative.network.kotlin

import com.pulumi.azurenative.network.kotlin.outputs.NetworkManagerSecurityGroupItemResponse
import com.pulumi.azurenative.network.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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.azurenative.network.kotlin.outputs.NetworkManagerSecurityGroupItemResponse.Companion.toKotlin as networkManagerSecurityGroupItemResponseToKotlin
import com.pulumi.azurenative.network.kotlin.outputs.SystemDataResponse.Companion.toKotlin as systemDataResponseToKotlin

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

    public var args: UserRuleCollectionArgs = UserRuleCollectionArgs()

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

/**
 * Defines the user rule collection.
 * Azure REST API version: 2022-04-01-preview. Prior API version in Azure Native 1.x: 2021-02-01-preview.
 * Other available API versions: 2021-02-01-preview, 2021-05-01-preview.
 * ## Example Usage
 * ### Create or Update a User Rule Collection
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var userRuleCollection = new AzureNative.Network.UserRuleCollection("userRuleCollection", new()
 *     {
 *         AppliesToGroups = new[]
 *         {
 *             new AzureNative.Network.Inputs.NetworkManagerSecurityGroupItemArgs
 *             {
 *                 NetworkGroupId = "/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testGroup",
 *             },
 *         },
 *         ConfigurationName = "myTestSecurityConfig",
 *         Description = "A sample policy",
 *         NetworkManagerName = "testNetworkManager",
 *         ResourceGroupName = "rg1",
 *         RuleCollectionName = "testRuleCollection",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	network "github.com/pulumi/pulumi-azure-native-sdk/network/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := network.NewUserRuleCollection(ctx, "userRuleCollection", &network.UserRuleCollectionArgs{
 * 			AppliesToGroups: network.NetworkManagerSecurityGroupItemArray{
 * 				&network.NetworkManagerSecurityGroupItemArgs{
 * 					NetworkGroupId: pulumi.String("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testGroup"),
 * 				},
 * 			},
 * 			ConfigurationName:  pulumi.String("myTestSecurityConfig"),
 * 			Description:        pulumi.String("A sample policy"),
 * 			NetworkManagerName: pulumi.String("testNetworkManager"),
 * 			ResourceGroupName:  pulumi.String("rg1"),
 * 			RuleCollectionName: pulumi.String("testRuleCollection"),
 * 		})
 * 		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.network.UserRuleCollection;
 * import com.pulumi.azurenative.network.UserRuleCollectionArgs;
 * import com.pulumi.azurenative.network.inputs.NetworkManagerSecurityGroupItemArgs;
 * 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 userRuleCollection = new UserRuleCollection("userRuleCollection", UserRuleCollectionArgs.builder()
 *             .appliesToGroups(NetworkManagerSecurityGroupItemArgs.builder()
 *                 .networkGroupId("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testGroup")
 *                 .build())
 *             .configurationName("myTestSecurityConfig")
 *             .description("A sample policy")
 *             .networkManagerName("testNetworkManager")
 *             .resourceGroupName("rg1")
 *             .ruleCollectionName("testRuleCollection")
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:network:UserRuleCollection myTestSecurityConfig /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}
 * ```
 */
public class UserRuleCollection internal constructor(
    override val javaResource: com.pulumi.azurenative.network.UserRuleCollection,
) : KotlinCustomResource(javaResource, UserRuleCollectionMapper) {
    /**
     * Groups for configuration
     */
    public val appliesToGroups: Output>
        get() = javaResource.appliesToGroups().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> networkManagerSecurityGroupItemResponseToKotlin(args0) })
            })
        })

    /**
     * A description of the user rule collection.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A unique read-only string that changes whenever the resource is updated.
     */
    public val etag: Output
        get() = javaResource.etag().applyValue({ args0 -> args0 })

    /**
     * Resource name.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

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

    /**
     * The system metadata related to this resource.
     */
    public val systemData: Output
        get() = javaResource.systemData().applyValue({ args0 ->
            args0.let({ args0 ->
                systemDataResponseToKotlin(args0)
            })
        })

    /**
     * Resource type.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object UserRuleCollectionMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azurenative.network.UserRuleCollection::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy