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

com.pulumi.gcp.logging.kotlin.ProjectSink.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: 8.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.logging.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.logging.kotlin.outputs.ProjectSinkBigqueryOptions
import com.pulumi.gcp.logging.kotlin.outputs.ProjectSinkExclusion
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.gcp.logging.kotlin.outputs.ProjectSinkBigqueryOptions.Companion.toKotlin as projectSinkBigqueryOptionsToKotlin
import com.pulumi.gcp.logging.kotlin.outputs.ProjectSinkExclusion.Companion.toKotlin as projectSinkExclusionToKotlin

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

    public var args: ProjectSinkArgs = ProjectSinkArgs()

    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 ProjectSinkArgsBuilder.() -> Unit) {
        val builder = ProjectSinkArgsBuilder()
        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(): ProjectSink {
        val builtJavaResource = com.pulumi.gcp.logging.ProjectSink(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return ProjectSink(builtJavaResource)
    }
}

/**
 *
 * ## Import
 * Project-level logging sinks can be imported using their URI, e.g.
 * * `projects/{{project_id}}/sinks/{{name}}`
 * When using the `pulumi import` command, project-level logging sinks can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:logging/projectSink:ProjectSink default projects/{{project_id}}/sinks/{{name}}
 * ```
 */
public class ProjectSink internal constructor(
    override val javaResource: com.pulumi.gcp.logging.ProjectSink,
) : KotlinCustomResource(javaResource, ProjectSinkMapper) {
    /**
     * Options that affect sinks exporting data to BigQuery. Structure documented below.
     */
    public val bigqueryOptions: Output
        get() = javaResource.bigqueryOptions().applyValue({ args0 ->
            args0.let({ args0 ->
                projectSinkBigqueryOptionsToKotlin(args0)
            })
        })

    /**
     * A user managed service account that will be used to write
     * the log entries. The format must be `serviceAccount:some@email`. This field can only be specified if you are
     * routing logs to a destination outside this sink's project. If not specified, a Logging service account
     * will automatically be generated.
     */
    public val customWriterIdentity: Output?
        get() = javaResource.customWriterIdentity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A description of this sink. The maximum length of the description is 8000 characters.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The destination of the sink (or, in other words, where logs are written to). Can be a Cloud Storage bucket, a PubSub topic, a BigQuery dataset, a Cloud Logging bucket, or a Google Cloud project. Examples:
     * - `storage.googleapis.com/[GCS_BUCKET]`
     * - `bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]`
     * - `pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]`
     * - `logging.googleapis.com/projects/[PROJECT_ID]/locations/global/buckets/[BUCKET_ID]`
     * - `logging.googleapis.com/projects/[PROJECT_ID]`
     * The writer associated with the sink must have access to write to the above resource.
     */
    public val destination: Output
        get() = javaResource.destination().applyValue({ args0 -> args0 })

    /**
     * If set to True, then this sink is disabled and it does not export any log entries.
     */
    public val disabled: Output?
        get() = javaResource.disabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Log entries that match any of the exclusion filters will not be exported. If a log entry is matched by both `filter` and one of `exclusions.filter`, it will not be exported.  Can be repeated multiple times for multiple exclusions. Structure is documented below.
     */
    public val exclusions: Output>?
        get() = javaResource.exclusions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> projectSinkExclusionToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * The filter to apply when exporting logs. Only log entries that match the filter are exported.
     * See [Advanced Log Filters](https://cloud.google.com/logging/docs/view/advanced_filters) for information on how to
     * write a filter.
     */
    public val filter: Output?
        get() = javaResource.filter().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The name of the logging sink. Logging automatically creates two sinks: `_Required` and `_Default`.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The ID of the project to create the sink in. If omitted, the project associated with the provider is
     * used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * Whether or not to create a unique identity associated with this sink. If `false`, then the `writer_identity` used is `serviceAccount:[email protected]`. If `true` (the default),
     * then a unique service account is created and used for this sink. If you wish to publish logs across projects or utilize
     * `bigquery_options`, you must set `unique_writer_identity` to true.
     */
    public val uniqueWriterIdentity: Output?
        get() = javaResource.uniqueWriterIdentity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The identity associated with this sink. This identity must be granted write access to the
     * configured `destination`.
     */
    public val writerIdentity: Output
        get() = javaResource.writerIdentity().applyValue({ args0 -> args0 })
}

public object ProjectSinkMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.logging.ProjectSink::class == javaResource::class

    override fun map(javaResource: Resource): ProjectSink = ProjectSink(
        javaResource as
            com.pulumi.gcp.logging.ProjectSink,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy