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

com.pulumi.gcp.logging.kotlin.FolderBucketConfigArgs.kt Maven / Gradle / Ivy

@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.FolderBucketConfigArgs.builder
import com.pulumi.gcp.logging.kotlin.inputs.FolderBucketConfigCmekSettingsArgs
import com.pulumi.gcp.logging.kotlin.inputs.FolderBucketConfigCmekSettingsArgsBuilder
import com.pulumi.gcp.logging.kotlin.inputs.FolderBucketConfigIndexConfigArgs
import com.pulumi.gcp.logging.kotlin.inputs.FolderBucketConfigIndexConfigArgsBuilder
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 folder-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 = new gcp.organizations.Folder("default", {
 *     displayName: "some-folder-name",
 *     parent: "organizations/123456789",
 * });
 * const basic = new gcp.logging.FolderBucketConfig("basic", {
 *     folder: _default.name,
 *     location: "global",
 *     retentionDays: 30,
 *     bucketId: "_Default",
 *     indexConfigs: [{
 *         fieldPath: "jsonPayload.request.status",
 *         type: "INDEX_TYPE_STRING",
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.organizations.Folder("default",
 *     display_name="some-folder-name",
 *     parent="organizations/123456789")
 * basic = gcp.logging.FolderBucketConfig("basic",
 *     folder=default.name,
 *     location="global",
 *     retention_days=30,
 *     bucket_id="_Default",
 *     index_configs=[{
 *         "field_path": "jsonPayload.request.status",
 *         "type": "INDEX_TYPE_STRING",
 *     }])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.Organizations.Folder("default", new()
 *     {
 *         DisplayName = "some-folder-name",
 *         Parent = "organizations/123456789",
 *     });
 *     var basic = new Gcp.Logging.FolderBucketConfig("basic", new()
 *     {
 *         Folder = @default.Name,
 *         Location = "global",
 *         RetentionDays = 30,
 *         BucketId = "_Default",
 *         IndexConfigs = new[]
 *         {
 *             new Gcp.Logging.Inputs.FolderBucketConfigIndexConfigArgs
 *             {
 *                 FieldPath = "jsonPayload.request.status",
 *                 Type = "INDEX_TYPE_STRING",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```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 {
 * 		_, err := organizations.NewFolder(ctx, "default", &organizations.FolderArgs{
 * 			DisplayName: pulumi.String("some-folder-name"),
 * 			Parent:      pulumi.String("organizations/123456789"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = logging.NewFolderBucketConfig(ctx, "basic", &logging.FolderBucketConfigArgs{
 * 			Folder:        _default.Name,
 * 			Location:      pulumi.String("global"),
 * 			RetentionDays: pulumi.Int(30),
 * 			BucketId:      pulumi.String("_Default"),
 * 			IndexConfigs: logging.FolderBucketConfigIndexConfigArray{
 * 				&logging.FolderBucketConfigIndexConfigArgs{
 * 					FieldPath: pulumi.String("jsonPayload.request.status"),
 * 					Type:      pulumi.String("INDEX_TYPE_STRING"),
 * 				},
 * 			},
 * 		})
 * 		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.Folder;
 * import com.pulumi.gcp.organizations.FolderArgs;
 * import com.pulumi.gcp.logging.FolderBucketConfig;
 * import com.pulumi.gcp.logging.FolderBucketConfigArgs;
 * import com.pulumi.gcp.logging.inputs.FolderBucketConfigIndexConfigArgs;
 * 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 default_ = new Folder("default", FolderArgs.builder()
 *             .displayName("some-folder-name")
 *             .parent("organizations/123456789")
 *             .build());
 *         var basic = new FolderBucketConfig("basic", FolderBucketConfigArgs.builder()
 *             .folder(default_.name())
 *             .location("global")
 *             .retentionDays(30)
 *             .bucketId("_Default")
 *             .indexConfigs(FolderBucketConfigIndexConfigArgs.builder()
 *                 .fieldPath("jsonPayload.request.status")
 *                 .type("INDEX_TYPE_STRING")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:organizations:Folder
 *     properties:
 *       displayName: some-folder-name
 *       parent: organizations/123456789
 *   basic:
 *     type: gcp:logging:FolderBucketConfig
 *     properties:
 *       folder: ${default.name}
 *       location: global
 *       retentionDays: 30
 *       bucketId: _Default
 *       indexConfigs:
 *         - fieldPath: jsonPayload.request.status
 *           type: INDEX_TYPE_STRING
 * ```
 * 
 * ## Import
 * This resource can be imported using the following format:
 * * `folders/{{folder}}/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/folderBucketConfig:FolderBucketConfig default folders/{{folder}}/locations/{{location}}/buckets/{{bucket_id}}
 * ```
 * @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 folder The parent resource that contains the logging 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 FolderBucketConfigArgs(
    public val bucketId: Output? = null,
    public val cmekSettings: Output? = null,
    public val description: Output? = null,
    public val folder: 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.FolderBucketConfigArgs =
        com.pulumi.gcp.logging.FolderBucketConfigArgs.builder()
            .bucketId(bucketId?.applyValue({ args0 -> args0 }))
            .cmekSettings(cmekSettings?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .description(description?.applyValue({ args0 -> args0 }))
            .folder(folder?.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 [FolderBucketConfigArgs].
 */
@PulumiTagMarker
public class FolderBucketConfigArgsBuilder internal constructor() {
    private var bucketId: Output? = null

    private var cmekSettings: Output? = null

    private var description: Output? = null

    private var folder: Output? = null

    private var indexConfigs: Output>? = null

    private var location: Output? = null

    private var retentionDays: Output? = null

    /**
     * @param value The name of the logging bucket. Logging automatically creates two log buckets: `_Required` and `_Default`.
     */
    @JvmName("ejwnvjohihmuhqke")
    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("gxelfffbheaygkql")
    public suspend fun cmekSettings(`value`: Output) {
        this.cmekSettings = value
    }

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

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

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

    @JvmName("slvnvaudimjxthmu")
    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("daudjuxkncfudtlv")
    public suspend fun indexConfigs(values: List>) {
        this.indexConfigs = Output.all(values)
    }

    /**
     * @param value The location of the bucket.
     */
    @JvmName("cqsotbllhjqgcwmt")
    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("prjllrwavuesnykn")
    public suspend fun retentionDays(`value`: Output) {
        this.retentionDays = value
    }

    /**
     * @param value The name of the logging bucket. Logging automatically creates two log buckets: `_Required` and `_Default`.
     */
    @JvmName("nyuawbusnsxaleir")
    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("uklwpnqibpnqcolv")
    public suspend fun cmekSettings(`value`: FolderBucketConfigCmekSettingsArgs?) {
        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("uwkjojgwvelbpmkr")
    public suspend fun cmekSettings(argument: suspend FolderBucketConfigCmekSettingsArgsBuilder.() -> Unit) {
        val toBeMapped = FolderBucketConfigCmekSettingsArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.cmekSettings = mapped
    }

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

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

    /**
     * @param value A list of indexed fields and related configuration data. Structure is documented below.
     */
    @JvmName("brkefrtaxpsnkkxk")
    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("hbljhgrshovsfsai")
    public suspend fun indexConfigs(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            FolderBucketConfigIndexConfigArgsBuilder().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("gluliybcjhcrqtqm")
    public suspend fun indexConfigs(vararg argument: suspend FolderBucketConfigIndexConfigArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            FolderBucketConfigIndexConfigArgsBuilder().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("sauydvtoshmtbqda")
    public suspend fun indexConfigs(argument: suspend FolderBucketConfigIndexConfigArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            FolderBucketConfigIndexConfigArgsBuilder().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("pnbljxksbqawsrvu")
    public suspend fun indexConfigs(vararg values: FolderBucketConfigIndexConfigArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.indexConfigs = mapped
    }

    /**
     * @param value The location of the bucket.
     */
    @JvmName("sognhekmisofhepi")
    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("hvgciuieifpqhcso")
    public suspend fun retentionDays(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.retentionDays = mapped
    }

    internal fun build(): FolderBucketConfigArgs = FolderBucketConfigArgs(
        bucketId = bucketId,
        cmekSettings = cmekSettings,
        description = description,
        folder = folder,
        indexConfigs = indexConfigs,
        location = location,
        retentionDays = retentionDays,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy