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

com.pulumi.awsnative.logs.kotlin.QueryDefinition.kt Maven / Gradle / Ivy

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

package com.pulumi.awsnative.logs.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
import kotlin.collections.List

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

    public var args: QueryDefinitionArgs = QueryDefinitionArgs()

    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 QueryDefinitionArgsBuilder.() -> Unit) {
        val builder = QueryDefinitionArgsBuilder()
        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(): QueryDefinition {
        val builtJavaResource = com.pulumi.awsnative.logs.QueryDefinition(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return QueryDefinition(builtJavaResource)
    }
}

/**
 * The resource schema for AWSLogs QueryDefinition
 */
public class QueryDefinition internal constructor(
    override val javaResource: com.pulumi.awsnative.logs.QueryDefinition,
) : KotlinCustomResource(javaResource, QueryDefinitionMapper) {
    /**
     * Optionally define specific log groups as part of your query definition
     */
    public val logGroupNames: Output>?
        get() = javaResource.logGroupNames().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * A name for the saved query definition
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Unique identifier of a query definition
     */
    public val queryDefinitionId: Output
        get() = javaResource.queryDefinitionId().applyValue({ args0 -> args0 })

    /**
     * The query string to use for this definition
     */
    public val queryString: Output
        get() = javaResource.queryString().applyValue({ args0 -> args0 })
}

public object QueryDefinitionMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.logs.QueryDefinition::class == javaResource::class

    override fun map(javaResource: Resource): QueryDefinition = QueryDefinition(
        javaResource as
            com.pulumi.awsnative.logs.QueryDefinition,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy