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

com.pulumi.gcp.logging.kotlin.BillingAccountBucketConfigArgs.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.BillingAccountBucketConfigArgs.builder
import com.pulumi.gcp.logging.kotlin.inputs.BillingAccountBucketConfigCmekSettingsArgs
import com.pulumi.gcp.logging.kotlin.inputs.BillingAccountBucketConfigCmekSettingsArgsBuilder
import com.pulumi.gcp.logging.kotlin.inputs.BillingAccountBucketConfigIndexConfigArgs
import com.pulumi.gcp.logging.kotlin.inputs.BillingAccountBucketConfigIndexConfigArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Manages a billing account level logging bucket config. For more information see
 * [the official logging documentation](https://cloud.google.com/logging/docs/) and
 * [Storing Logs](https://cloud.google.com/logging/docs/storage).
 * > **Note:** Logging buckets are automatically created for a given folder, project, organization, billingAccount and cannot be deleted. Creating a resource of this type will acquire and update the resource that already exists at the desired location. These buckets cannot be removed so deleting this resource will remove the bucket config from your state but will leave the logging bucket unchanged. The buckets that are currently automatically created are "_Default" and "_Required".
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const default = gcp.organizations.getBillingAccount({
 *     billingAccount: "00AA00-000AAA-00AA0A",
 * });
 * const basic = new gcp.logging.BillingAccountBucketConfig("basic", {
 *     billingAccount: _default.then(_default => _default.billingAccount),
 *     location: "global",
 *     retentionDays: 30,
 *     bucketId: "_Default",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.organizations.get_billing_account(billing_account="00AA00-000AAA-00AA0A")
 * basic = gcp.logging.BillingAccountBucketConfig("basic",
 *     billing_account=default.billing_account,
 *     location="global",
 *     retention_days=30,
 *     bucket_id="_Default")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = Gcp.Organizations.GetBillingAccount.Invoke(new()
 *     {
 *         BillingAccount = "00AA00-000AAA-00AA0A",
 *     });
 *     var basic = new Gcp.Logging.BillingAccountBucketConfig("basic", new()
 *     {
 *         BillingAccount = @default.Apply(@default => @default.Apply(getBillingAccountResult => getBillingAccountResult.BillingAccount)),
 *         Location = "global",
 *         RetentionDays = 30,
 *         BucketId = "_Default",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/logging"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_default, err := organizations.GetBillingAccount(ctx, &organizations.GetBillingAccountArgs{
 * 			BillingAccount: pulumi.StringRef("00AA00-000AAA-00AA0A"),
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = logging.NewBillingAccountBucketConfig(ctx, "basic", &logging.BillingAccountBucketConfigArgs{
 * 			BillingAccount: pulumi.String(_default.BillingAccount),
 * 			Location:       pulumi.String("global"),
 * 			RetentionDays:  pulumi.Int(30),
 * 			BucketId:       pulumi.String("_Default"),
 * 		})
 * 		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.organizations.OrganizationsFunctions;
 * import com.pulumi.gcp.organizations.inputs.GetBillingAccountArgs;
 * import com.pulumi.gcp.logging.BillingAccountBucketConfig;
 * import com.pulumi.gcp.logging.BillingAccountBucketConfigArgs;
 * 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) {
 *         final var default = OrganizationsFunctions.getBillingAccount(GetBillingAccountArgs.builder()
 *             .billingAccount("00AA00-000AAA-00AA0A")
 *             .build());
 *         var basic = new BillingAccountBucketConfig("basic", BillingAccountBucketConfigArgs.builder()
 *             .billingAccount(default_.billingAccount())
 *             .location("global")
 *             .retentionDays(30)
 *             .bucketId("_Default")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   basic:
 *     type: gcp:logging:BillingAccountBucketConfig
 *     properties:
 *       billingAccount: ${default.billingAccount}
 *       location: global
 *       retentionDays: 30
 *       bucketId: _Default
 * variables:
 *   default:
 *     fn::invoke:
 *       Function: gcp:organizations:getBillingAccount
 *       Arguments:
 *         billingAccount: 00AA00-000AAA-00AA0A
 * ```
 * 
 * Create logging bucket with index configs
 * 
 * ```yaml
 * resources:
 *   example-billing-account-bucket-index-configs:
 *     type: gcp:logging:BillingAccountBucketConfig
 *     properties:
 *       folder: ${default.billingAccount}
 *       location: global
 *       retentionDays: 30
 *       bucketId: _Default
 *       indexConfigs:
 *         filePath: jsonPayload.request.status
 *         type: INDEX_TYPE_STRING
 * ```
 * 
 * ## Import
 * This resource can be imported using the following format:
 * * `billingAccounts/{{billingAccount}}/locations/{{location}}/buckets/{{bucket_id}}`
 * When using the `pulumi import` command, this resource can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:logging/billingAccountBucketConfig:BillingAccountBucketConfig default billingAccounts/{{billingAccount}}/locations/{{location}}/buckets/{{bucket_id}}
 * ```
 * @property billingAccount The parent resource that contains the logging bucket.
 * @property bucketId The name of the logging bucket. Logging automatically creates two log buckets: `_Required` and `_Default`.
 * @property cmekSettings The CMEK settings of the log bucket. If present, new log entries written to this log bucket are encrypted using the CMEK
 * key provided in this configuration. If a log bucket has CMEK settings, the CMEK settings cannot be disabled later by
 * updating the log bucket. Changing the KMS key is allowed.
 * @property description Describes this bucket.
 * @property indexConfigs A list of indexed fields and related configuration data. Structure is documented below.
 * @property location The location of the bucket.
 * @property retentionDays Logs will be retained by default for this amount of time, after which they will automatically be deleted. The minimum retention period is 1 day. If this value is set to zero at bucket creation time, the default time of 30 days will be used. Bucket retention can not be increased on buckets outside of projects.
 */
public data class BillingAccountBucketConfigArgs(
    public val billingAccount: Output? = null,
    public val bucketId: Output? = null,
    public val cmekSettings: Output? = null,
    public val description: Output? = null,
    public val indexConfigs: Output>? = null,
    public val location: Output? = null,
    public val retentionDays: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.logging.BillingAccountBucketConfigArgs =
        com.pulumi.gcp.logging.BillingAccountBucketConfigArgs.builder()
            .billingAccount(billingAccount?.applyValue({ args0 -> args0 }))
            .bucketId(bucketId?.applyValue({ args0 -> args0 }))
            .cmekSettings(cmekSettings?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .description(description?.applyValue({ args0 -> args0 }))
            .indexConfigs(
                indexConfigs?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .location(location?.applyValue({ args0 -> args0 }))
            .retentionDays(retentionDays?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [BillingAccountBucketConfigArgs].
 */
@PulumiTagMarker
public class BillingAccountBucketConfigArgsBuilder internal constructor() {
    private var billingAccount: Output? = null

    private var bucketId: Output? = null

    private var cmekSettings: Output? = null

    private var description: Output? = null

    private var indexConfigs: Output>? = null

    private var location: Output? = null

    private var retentionDays: Output? = null

    /**
     * @param value The parent resource that contains the logging bucket.
     */
    @JvmName("ubhttxdinxmmwhne")
    public suspend fun billingAccount(`value`: Output) {
        this.billingAccount = value
    }

    /**
     * @param value The name of the logging bucket. Logging automatically creates two log buckets: `_Required` and `_Default`.
     */
    @JvmName("dkioktixgshyrycq")
    public suspend fun bucketId(`value`: Output) {
        this.bucketId = value
    }

    /**
     * @param value The CMEK settings of the log bucket. If present, new log entries written to this log bucket are encrypted using the CMEK
     * key provided in this configuration. If a log bucket has CMEK settings, the CMEK settings cannot be disabled later by
     * updating the log bucket. Changing the KMS key is allowed.
     */
    @JvmName("eyqncoauwuvcswcg")
    public suspend fun cmekSettings(`value`: Output) {
        this.cmekSettings = value
    }

    /**
     * @param value Describes this bucket.
     */
    @JvmName("qrybaboeuawxhnye")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value A list of indexed fields and related configuration data. Structure is documented below.
     */
    @JvmName("fysbsfvrmqhfkrod")
    public suspend fun indexConfigs(`value`: Output>) {
        this.indexConfigs = value
    }

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

    /**
     * @param values A list of indexed fields and related configuration data. Structure is documented below.
     */
    @JvmName("abuswkmywgtpwhhl")
    public suspend fun indexConfigs(values: List>) {
        this.indexConfigs = Output.all(values)
    }

    /**
     * @param value The location of the bucket.
     */
    @JvmName("dhpsbsjphowlhprw")
    public suspend fun location(`value`: Output) {
        this.location = value
    }

    /**
     * @param value Logs will be retained by default for this amount of time, after which they will automatically be deleted. The minimum retention period is 1 day. If this value is set to zero at bucket creation time, the default time of 30 days will be used. Bucket retention can not be increased on buckets outside of projects.
     */
    @JvmName("wpxldyhadhfnmuop")
    public suspend fun retentionDays(`value`: Output) {
        this.retentionDays = value
    }

    /**
     * @param value The parent resource that contains the logging bucket.
     */
    @JvmName("mqethaqyqphqekem")
    public suspend fun billingAccount(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.billingAccount = mapped
    }

    /**
     * @param value The name of the logging bucket. Logging automatically creates two log buckets: `_Required` and `_Default`.
     */
    @JvmName("hoswmndxhqcufojm")
    public suspend fun bucketId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.bucketId = mapped
    }

    /**
     * @param value The CMEK settings of the log bucket. If present, new log entries written to this log bucket are encrypted using the CMEK
     * key provided in this configuration. If a log bucket has CMEK settings, the CMEK settings cannot be disabled later by
     * updating the log bucket. Changing the KMS key is allowed.
     */
    @JvmName("tqilejsjnnxalplg")
    public suspend fun cmekSettings(`value`: BillingAccountBucketConfigCmekSettingsArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.cmekSettings = mapped
    }

    /**
     * @param argument The CMEK settings of the log bucket. If present, new log entries written to this log bucket are encrypted using the CMEK
     * key provided in this configuration. If a log bucket has CMEK settings, the CMEK settings cannot be disabled later by
     * updating the log bucket. Changing the KMS key is allowed.
     */
    @JvmName("iaenyauiouhelhae")
    public suspend fun cmekSettings(argument: suspend BillingAccountBucketConfigCmekSettingsArgsBuilder.() -> Unit) {
        val toBeMapped = BillingAccountBucketConfigCmekSettingsArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.cmekSettings = mapped
    }

    /**
     * @param value Describes this bucket.
     */
    @JvmName("acqivooinpsxqfma")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value A list of indexed fields and related configuration data. Structure is documented below.
     */
    @JvmName("tdcarpxygbtmfrlw")
    public suspend fun indexConfigs(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.indexConfigs = mapped
    }

    /**
     * @param argument A list of indexed fields and related configuration data. Structure is documented below.
     */
    @JvmName("memfhpvmxiniacqn")
    public suspend fun indexConfigs(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            BillingAccountBucketConfigIndexConfigArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.indexConfigs = mapped
    }

    /**
     * @param argument A list of indexed fields and related configuration data. Structure is documented below.
     */
    @JvmName("adruiruqkcmtfgfd")
    public suspend fun indexConfigs(vararg argument: suspend BillingAccountBucketConfigIndexConfigArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            BillingAccountBucketConfigIndexConfigArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.indexConfigs = mapped
    }

    /**
     * @param argument A list of indexed fields and related configuration data. Structure is documented below.
     */
    @JvmName("yrgkgowlkisgkito")
    public suspend fun indexConfigs(argument: suspend BillingAccountBucketConfigIndexConfigArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            BillingAccountBucketConfigIndexConfigArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.indexConfigs = mapped
    }

    /**
     * @param values A list of indexed fields and related configuration data. Structure is documented below.
     */
    @JvmName("kxkfajxglrodbjig")
    public suspend fun indexConfigs(vararg values: BillingAccountBucketConfigIndexConfigArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.indexConfigs = mapped
    }

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

    /**
     * @param value Logs will be retained by default for this amount of time, after which they will automatically be deleted. The minimum retention period is 1 day. If this value is set to zero at bucket creation time, the default time of 30 days will be used. Bucket retention can not be increased on buckets outside of projects.
     */
    @JvmName("nenroyrkcpushvys")
    public suspend fun retentionDays(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.retentionDays = mapped
    }

    internal fun build(): BillingAccountBucketConfigArgs = BillingAccountBucketConfigArgs(
        billingAccount = billingAccount,
        bucketId = bucketId,
        cmekSettings = cmekSettings,
        description = description,
        indexConfigs = indexConfigs,
        location = location,
        retentionDays = retentionDays,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy