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

com.pulumi.gcp.logging.kotlin.BillingAccountSinkArgs.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.core.Output.of
import com.pulumi.gcp.logging.BillingAccountSinkArgs.builder
import com.pulumi.gcp.logging.kotlin.inputs.BillingAccountSinkBigqueryOptionsArgs
import com.pulumi.gcp.logging.kotlin.inputs.BillingAccountSinkBigqueryOptionsArgsBuilder
import com.pulumi.gcp.logging.kotlin.inputs.BillingAccountSinkExclusionArgs
import com.pulumi.gcp.logging.kotlin.inputs.BillingAccountSinkExclusionArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * * [API documentation](https://cloud.google.com/logging/docs/reference/v2/rest/v2/billingAccounts.sinks)
 * * How-to Guides
 *     * [Exporting Logs](https://cloud.google.com/logging/docs/export)
 * > **Note** You must have the "Logs Configuration Writer" IAM role (`roles/logging.configWriter`)
 * [granted on the billing account](https://cloud.google.com/billing/reference/rest/v1/billingAccounts/getIamPolicy) to
 * the credentials used with this provider. [IAM roles granted on a billing account](https://cloud.google.com/billing/docs/how-to/billing-access) are separate from the
 * typical IAM roles granted on a project.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const log_bucket = new gcp.storage.Bucket("log-bucket", {
 *     name: "billing-logging-bucket",
 *     location: "US",
 * });
 * const my_sink = new gcp.logging.BillingAccountSink("my-sink", {
 *     name: "my-sink",
 *     description: "some explanation on what this is",
 *     billingAccount: "ABCDEF-012345-GHIJKL",
 *     destination: pulumi.interpolate`storage.googleapis.com/${log_bucket.name}`,
 * });
 * const log_writer = new gcp.projects.IAMBinding("log-writer", {
 *     project: "your-project-id",
 *     role: "roles/storage.objectCreator",
 *     members: [my_sink.writerIdentity],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * log_bucket = gcp.storage.Bucket("log-bucket",
 *     name="billing-logging-bucket",
 *     location="US")
 * my_sink = gcp.logging.BillingAccountSink("my-sink",
 *     name="my-sink",
 *     description="some explanation on what this is",
 *     billing_account="ABCDEF-012345-GHIJKL",
 *     destination=log_bucket.name.apply(lambda name: f"storage.googleapis.com/{name}"))
 * log_writer = gcp.projects.IAMBinding("log-writer",
 *     project="your-project-id",
 *     role="roles/storage.objectCreator",
 *     members=[my_sink.writer_identity])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var log_bucket = new Gcp.Storage.Bucket("log-bucket", new()
 *     {
 *         Name = "billing-logging-bucket",
 *         Location = "US",
 *     });
 *     var my_sink = new Gcp.Logging.BillingAccountSink("my-sink", new()
 *     {
 *         Name = "my-sink",
 *         Description = "some explanation on what this is",
 *         BillingAccount = "ABCDEF-012345-GHIJKL",
 *         Destination = log_bucket.Name.Apply(name => $"storage.googleapis.com/{name}"),
 *     });
 *     var log_writer = new Gcp.Projects.IAMBinding("log-writer", new()
 *     {
 *         Project = "your-project-id",
 *         Role = "roles/storage.objectCreator",
 *         Members = new[]
 *         {
 *             my_sink.WriterIdentity,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/logging"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := storage.NewBucket(ctx, "log-bucket", &storage.BucketArgs{
 * 			Name:     pulumi.String("billing-logging-bucket"),
 * 			Location: pulumi.String("US"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = logging.NewBillingAccountSink(ctx, "my-sink", &logging.BillingAccountSinkArgs{
 * 			Name:           pulumi.String("my-sink"),
 * 			Description:    pulumi.String("some explanation on what this is"),
 * 			BillingAccount: pulumi.String("ABCDEF-012345-GHIJKL"),
 * 			Destination: log_bucket.Name.ApplyT(func(name string) (string, error) {
 * 				return fmt.Sprintf("storage.googleapis.com/%v", name), nil
 * 			}).(pulumi.StringOutput),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = projects.NewIAMBinding(ctx, "log-writer", &projects.IAMBindingArgs{
 * 			Project: pulumi.String("your-project-id"),
 * 			Role:    pulumi.String("roles/storage.objectCreator"),
 * 			Members: pulumi.StringArray{
 * 				my_sink.WriterIdentity,
 * 			},
 * 		})
 * 		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.gcp.storage.Bucket;
 * import com.pulumi.gcp.storage.BucketArgs;
 * import com.pulumi.gcp.logging.BillingAccountSink;
 * import com.pulumi.gcp.logging.BillingAccountSinkArgs;
 * import com.pulumi.gcp.projects.IAMBinding;
 * import com.pulumi.gcp.projects.IAMBindingArgs;
 * 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 log_bucket = new Bucket("log-bucket", BucketArgs.builder()
 *             .name("billing-logging-bucket")
 *             .location("US")
 *             .build());
 *         var my_sink = new BillingAccountSink("my-sink", BillingAccountSinkArgs.builder()
 *             .name("my-sink")
 *             .description("some explanation on what this is")
 *             .billingAccount("ABCDEF-012345-GHIJKL")
 *             .destination(log_bucket.name().applyValue(name -> String.format("storage.googleapis.com/%s", name)))
 *             .build());
 *         var log_writer = new IAMBinding("log-writer", IAMBindingArgs.builder()
 *             .project("your-project-id")
 *             .role("roles/storage.objectCreator")
 *             .members(my_sink.writerIdentity())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   my-sink:
 *     type: gcp:logging:BillingAccountSink
 *     properties:
 *       name: my-sink
 *       description: some explanation on what this is
 *       billingAccount: ABCDEF-012345-GHIJKL
 *       destination: storage.googleapis.com/${["log-bucket"].name}
 *   log-bucket:
 *     type: gcp:storage:Bucket
 *     properties:
 *       name: billing-logging-bucket
 *       location: US
 *   log-writer:
 *     type: gcp:projects:IAMBinding
 *     properties:
 *       project: your-project-id
 *       role: roles/storage.objectCreator
 *       members:
 *         - ${["my-sink"].writerIdentity}
 * ```
 * 
 * ## Import
 * Billing account logging sinks can be imported using this format:
 * * `billingAccounts/{{billing_account_id}}/sinks/{{sink_id}}`
 * When using the `pulumi import` command, billing account logging sinks can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:logging/billingAccountSink:BillingAccountSink default billingAccounts/{{billing_account_id}}/sinks/{{sink_id}}
 * ```
 * @property bigqueryOptions Options that affect sinks exporting data to BigQuery. Structure documented below.
 * @property billingAccount The billing account exported to the sink.
 * @property description A description of this sink. The maximum length of the description is 8000 characters.
 * @property destination 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 or a Cloud Logging bucket. 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]`
 * The writer associated with the sink must have access to write to the above resource.
 * @property disabled If set to True, then this sink is disabled and it does not export any log entries.
 * @property exclusions 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.
 * @property filter 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.
 * @property name The name of the logging sink.
 */
public data class BillingAccountSinkArgs(
    public val bigqueryOptions: Output? = null,
    public val billingAccount: Output? = null,
    public val description: Output? = null,
    public val destination: Output? = null,
    public val disabled: Output? = null,
    public val exclusions: Output>? = null,
    public val filter: Output? = null,
    public val name: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.logging.BillingAccountSinkArgs =
        com.pulumi.gcp.logging.BillingAccountSinkArgs.builder()
            .bigqueryOptions(bigqueryOptions?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .billingAccount(billingAccount?.applyValue({ args0 -> args0 }))
            .description(description?.applyValue({ args0 -> args0 }))
            .destination(destination?.applyValue({ args0 -> args0 }))
            .disabled(disabled?.applyValue({ args0 -> args0 }))
            .exclusions(
                exclusions?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .filter(filter?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [BillingAccountSinkArgs].
 */
@PulumiTagMarker
public class BillingAccountSinkArgsBuilder internal constructor() {
    private var bigqueryOptions: Output? = null

    private var billingAccount: Output? = null

    private var description: Output? = null

    private var destination: Output? = null

    private var disabled: Output? = null

    private var exclusions: Output>? = null

    private var filter: Output? = null

    private var name: Output? = null

    /**
     * @param value Options that affect sinks exporting data to BigQuery. Structure documented below.
     */
    @JvmName("uthqyblrvnhjjdoh")
    public suspend fun bigqueryOptions(`value`: Output) {
        this.bigqueryOptions = value
    }

    /**
     * @param value The billing account exported to the sink.
     */
    @JvmName("nxkkrssppcbilses")
    public suspend fun billingAccount(`value`: Output) {
        this.billingAccount = value
    }

    /**
     * @param value A description of this sink. The maximum length of the description is 8000 characters.
     */
    @JvmName("ayrfryintelncxjp")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value 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 or a Cloud Logging bucket. 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]`
     * The writer associated with the sink must have access to write to the above resource.
     */
    @JvmName("mlahgpnlhokthhfm")
    public suspend fun destination(`value`: Output) {
        this.destination = value
    }

    /**
     * @param value If set to True, then this sink is disabled and it does not export any log entries.
     */
    @JvmName("jcibemroreaykpxo")
    public suspend fun disabled(`value`: Output) {
        this.disabled = value
    }

    /**
     * @param value 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.
     */
    @JvmName("pfbblrerugqpnbgh")
    public suspend fun exclusions(`value`: Output>) {
        this.exclusions = value
    }

    @JvmName("wtmvsnumanckntdh")
    public suspend fun exclusions(vararg values: Output) {
        this.exclusions = Output.all(values.asList())
    }

    /**
     * @param values 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.
     */
    @JvmName("npcthjgsyhplugbq")
    public suspend fun exclusions(values: List>) {
        this.exclusions = Output.all(values)
    }

    /**
     * @param value 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.
     */
    @JvmName("ncqtkqihpvnwtlho")
    public suspend fun filter(`value`: Output) {
        this.filter = value
    }

    /**
     * @param value The name of the logging sink.
     */
    @JvmName("imdxcpbasidfiytj")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value Options that affect sinks exporting data to BigQuery. Structure documented below.
     */
    @JvmName("vqfrlptmobdqwfbx")
    public suspend fun bigqueryOptions(`value`: BillingAccountSinkBigqueryOptionsArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.bigqueryOptions = mapped
    }

    /**
     * @param argument Options that affect sinks exporting data to BigQuery. Structure documented below.
     */
    @JvmName("sxelracxmrfffyvj")
    public suspend fun bigqueryOptions(argument: suspend BillingAccountSinkBigqueryOptionsArgsBuilder.() -> Unit) {
        val toBeMapped = BillingAccountSinkBigqueryOptionsArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.bigqueryOptions = mapped
    }

    /**
     * @param value The billing account exported to the sink.
     */
    @JvmName("vuhsvktusrgkaydv")
    public suspend fun billingAccount(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.billingAccount = mapped
    }

    /**
     * @param value A description of this sink. The maximum length of the description is 8000 characters.
     */
    @JvmName("pstfqyvcgsceevtt")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value 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 or a Cloud Logging bucket. 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]`
     * The writer associated with the sink must have access to write to the above resource.
     */
    @JvmName("feujvbeycmccivkh")
    public suspend fun destination(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.destination = mapped
    }

    /**
     * @param value If set to True, then this sink is disabled and it does not export any log entries.
     */
    @JvmName("ttqwuiivlhaekshw")
    public suspend fun disabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.disabled = mapped
    }

    /**
     * @param value 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.
     */
    @JvmName("wjvuslmtbixswioq")
    public suspend fun exclusions(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.exclusions = mapped
    }

    /**
     * @param argument 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.
     */
    @JvmName("lqbyobulceinebko")
    public suspend fun exclusions(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            BillingAccountSinkExclusionArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.exclusions = mapped
    }

    /**
     * @param argument 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.
     */
    @JvmName("cklyuixnsnklheii")
    public suspend fun exclusions(vararg argument: suspend BillingAccountSinkExclusionArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            BillingAccountSinkExclusionArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.exclusions = mapped
    }

    /**
     * @param argument 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.
     */
    @JvmName("jgkbhvukdxtuwrty")
    public suspend fun exclusions(argument: suspend BillingAccountSinkExclusionArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            BillingAccountSinkExclusionArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.exclusions = mapped
    }

    /**
     * @param values 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.
     */
    @JvmName("pevemmescmvnxjxm")
    public suspend fun exclusions(vararg values: BillingAccountSinkExclusionArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.exclusions = mapped
    }

    /**
     * @param value 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.
     */
    @JvmName("ehglhhoanihlkroq")
    public suspend fun filter(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.filter = mapped
    }

    /**
     * @param value The name of the logging sink.
     */
    @JvmName("jajkosvryyesvjca")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    internal fun build(): BillingAccountSinkArgs = BillingAccountSinkArgs(
        bigqueryOptions = bigqueryOptions,
        billingAccount = billingAccount,
        description = description,
        destination = destination,
        disabled = disabled,
        exclusions = exclusions,
        filter = filter,
        name = name,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy