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

com.pulumi.azure.monitoring.kotlin.DataCollectionRule.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.monitoring.kotlin

import com.pulumi.azure.monitoring.kotlin.outputs.DataCollectionRuleDataFlow
import com.pulumi.azure.monitoring.kotlin.outputs.DataCollectionRuleDataSources
import com.pulumi.azure.monitoring.kotlin.outputs.DataCollectionRuleDestinations
import com.pulumi.azure.monitoring.kotlin.outputs.DataCollectionRuleIdentity
import com.pulumi.azure.monitoring.kotlin.outputs.DataCollectionRuleStreamDeclaration
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 kotlin.collections.Map
import com.pulumi.azure.monitoring.kotlin.outputs.DataCollectionRuleDataFlow.Companion.toKotlin as dataCollectionRuleDataFlowToKotlin
import com.pulumi.azure.monitoring.kotlin.outputs.DataCollectionRuleDataSources.Companion.toKotlin as dataCollectionRuleDataSourcesToKotlin
import com.pulumi.azure.monitoring.kotlin.outputs.DataCollectionRuleDestinations.Companion.toKotlin as dataCollectionRuleDestinationsToKotlin
import com.pulumi.azure.monitoring.kotlin.outputs.DataCollectionRuleIdentity.Companion.toKotlin as dataCollectionRuleIdentityToKotlin
import com.pulumi.azure.monitoring.kotlin.outputs.DataCollectionRuleStreamDeclaration.Companion.toKotlin as dataCollectionRuleStreamDeclarationToKotlin

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

    public var args: DataCollectionRuleArgs = DataCollectionRuleArgs()

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

/**
 * Manages a Data Collection Rule.
 * ## Import
 * Data Collection Rules can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:monitoring/dataCollectionRule:DataCollectionRule example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/dataCollectionRules/rule1
 * ```
 */
public class DataCollectionRule internal constructor(
    override val javaResource: com.pulumi.azure.monitoring.DataCollectionRule,
) : KotlinCustomResource(javaResource, DataCollectionRuleMapper) {
    /**
     * The resource ID of the Data Collection Endpoint that this rule can be used with.
     */
    public val dataCollectionEndpointId: Output?
        get() = javaResource.dataCollectionEndpointId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * One or more `data_flow` blocks as defined below.
     */
    public val dataFlows: Output>
        get() = javaResource.dataFlows().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    dataCollectionRuleDataFlowToKotlin(args0)
                })
            })
        })

    /**
     * A `data_sources` block as defined below. This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint.
     */
    public val dataSources: Output?
        get() = javaResource.dataSources().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    dataCollectionRuleDataSourcesToKotlin(args0)
                })
            }).orElse(null)
        })

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

    /**
     * A `destinations` block as defined below.
     */
    public val destinations: Output
        get() = javaResource.destinations().applyValue({ args0 ->
            args0.let({ args0 ->
                dataCollectionRuleDestinationsToKotlin(args0)
            })
        })

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

    /**
     * The immutable ID of the Data Collection Rule.
     */
    public val immutableId: Output
        get() = javaResource.immutableId().applyValue({ args0 -> args0 })

    /**
     * The kind of the Data Collection Rule. Possible values are `Linux`, `Windows`, `AgentDirectToStore` and `WorkspaceTransforms`. A rule of kind `Linux` does not allow for `windows_event_log` data sources. And a rule of kind `Windows` does not allow for `syslog` data sources. If kind is not specified, all kinds of data sources are allowed.
     * > **NOTE** Once `kind` has been set, changing it forces a new Data Collection Rule to be created.
     */
    public val kind: Output?
        get() = javaResource.kind().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The Azure Region where the Data Collection Rule should exist. Changing this forces a new Data Collection Rule to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The name which should be used for this Data Collection Rule. Changing this forces a new Data Collection Rule to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The name of the Resource Group where the Data Collection Rule should exist. Changing this forces a new Data Collection Rule to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

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

    /**
     * A mapping of tags which should be assigned to the Data Collection Rule.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })
}

public object DataCollectionRuleMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.monitoring.DataCollectionRule::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy