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

com.pulumi.gcp.logging.kotlin.FolderSettingsArgs.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.12.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.FolderSettingsArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName

/**
 * Default resource settings control whether CMEK is required for new log buckets. These settings also determine the storage location for the _Default and _Required log buckets, and whether the _Default sink is enabled or disabled.
 * To get more information about FolderSettings, see:
 * * [API documentation](https://cloud.google.com/logging/docs/reference/v2/rest/v2/TopLevel/getSettings)
 * * How-to Guides
 *     * [Configure default settings for organizations and folders](https://cloud.google.com/logging/docs/default-settings)
 * ## Example Usage
 * ### Logging Folder Settings All
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const myFolder = new gcp.organizations.Folder("my_folder", {
 *     displayName: "folder-name",
 *     parent: "organizations/123456789",
 * });
 * const example = new gcp.logging.FolderSettings("example", {
 *     disableDefaultSink: true,
 *     folder: myFolder.folderId,
 *     kmsKeyName: "kms-key",
 *     storageLocation: "us-central1",
 * });
 * const settings = gcp.logging.getFolderSettingsOutput({
 *     folder: myFolder.folderId,
 * });
 * const iam = new gcp.kms.CryptoKeyIAMMember("iam", {
 *     cryptoKeyId: "kms-key",
 *     role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
 *     member: settings.apply(settings => `serviceAccount:${settings.kmsServiceAccountId}`),
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * my_folder = gcp.organizations.Folder("my_folder",
 *     display_name="folder-name",
 *     parent="organizations/123456789")
 * example = gcp.logging.FolderSettings("example",
 *     disable_default_sink=True,
 *     folder=my_folder.folder_id,
 *     kms_key_name="kms-key",
 *     storage_location="us-central1")
 * settings = gcp.logging.get_folder_settings_output(folder=my_folder.folder_id)
 * iam = gcp.kms.CryptoKeyIAMMember("iam",
 *     crypto_key_id="kms-key",
 *     role="roles/cloudkms.cryptoKeyEncrypterDecrypter",
 *     member=settings.apply(lambda settings: f"serviceAccount:{settings.kms_service_account_id}"))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var myFolder = new Gcp.Organizations.Folder("my_folder", new()
 *     {
 *         DisplayName = "folder-name",
 *         Parent = "organizations/123456789",
 *     });
 *     var example = new Gcp.Logging.FolderSettings("example", new()
 *     {
 *         DisableDefaultSink = true,
 *         Folder = myFolder.FolderId,
 *         KmsKeyName = "kms-key",
 *         StorageLocation = "us-central1",
 *     });
 *     var settings = Gcp.Logging.GetFolderSettings.Invoke(new()
 *     {
 *         Folder = myFolder.FolderId,
 *     });
 *     var iam = new Gcp.Kms.CryptoKeyIAMMember("iam", new()
 *     {
 *         CryptoKeyId = "kms-key",
 *         Role = "roles/cloudkms.cryptoKeyEncrypterDecrypter",
 *         Member = $"serviceAccount:{settings.Apply(getFolderSettingsResult => getFolderSettingsResult.KmsServiceAccountId)}",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/kms"
 * 	"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 {
 * 		myFolder, err := organizations.NewFolder(ctx, "my_folder", &organizations.FolderArgs{
 * 			DisplayName: pulumi.String("folder-name"),
 * 			Parent:      pulumi.String("organizations/123456789"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = logging.NewFolderSettings(ctx, "example", &logging.FolderSettingsArgs{
 * 			DisableDefaultSink: pulumi.Bool(true),
 * 			Folder:             myFolder.FolderId,
 * 			KmsKeyName:         pulumi.String("kms-key"),
 * 			StorageLocation:    pulumi.String("us-central1"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		settings := logging.LookupFolderSettingsOutput(ctx, logging.GetFolderSettingsOutputArgs{
 * 			Folder: myFolder.FolderId,
 * 		}, nil)
 * 		_, err = kms.NewCryptoKeyIAMMember(ctx, "iam", &kms.CryptoKeyIAMMemberArgs{
 * 			CryptoKeyId: pulumi.String("kms-key"),
 * 			Role:        pulumi.String("roles/cloudkms.cryptoKeyEncrypterDecrypter"),
 * 			Member: settings.ApplyT(func(settings logging.GetFolderSettingsResult) (string, error) {
 * 				return fmt.Sprintf("serviceAccount:%v", settings.KmsServiceAccountId), nil
 * 			}).(pulumi.StringOutput),
 * 		})
 * 		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.FolderSettings;
 * import com.pulumi.gcp.logging.FolderSettingsArgs;
 * import com.pulumi.gcp.logging.LoggingFunctions;
 * import com.pulumi.gcp.logging.inputs.GetFolderSettingsArgs;
 * import com.pulumi.gcp.kms.CryptoKeyIAMMember;
 * import com.pulumi.gcp.kms.CryptoKeyIAMMemberArgs;
 * 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 myFolder = new Folder("myFolder", FolderArgs.builder()
 *             .displayName("folder-name")
 *             .parent("organizations/123456789")
 *             .build());
 *         var example = new FolderSettings("example", FolderSettingsArgs.builder()
 *             .disableDefaultSink(true)
 *             .folder(myFolder.folderId())
 *             .kmsKeyName("kms-key")
 *             .storageLocation("us-central1")
 *             .build());
 *         final var settings = LoggingFunctions.getFolderSettings(GetFolderSettingsArgs.builder()
 *             .folder(myFolder.folderId())
 *             .build());
 *         var iam = new CryptoKeyIAMMember("iam", CryptoKeyIAMMemberArgs.builder()
 *             .cryptoKeyId("kms-key")
 *             .role("roles/cloudkms.cryptoKeyEncrypterDecrypter")
 *             .member(settings.applyValue(getFolderSettingsResult -> getFolderSettingsResult).applyValue(settings -> String.format("serviceAccount:%s", settings.applyValue(getFolderSettingsResult -> getFolderSettingsResult.kmsServiceAccountId()))))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: gcp:logging:FolderSettings
 *     properties:
 *       disableDefaultSink: true
 *       folder: ${myFolder.folderId}
 *       kmsKeyName: kms-key
 *       storageLocation: us-central1
 *   myFolder:
 *     type: gcp:organizations:Folder
 *     name: my_folder
 *     properties:
 *       displayName: folder-name
 *       parent: organizations/123456789
 *   iam:
 *     type: gcp:kms:CryptoKeyIAMMember
 *     properties:
 *       cryptoKeyId: kms-key
 *       role: roles/cloudkms.cryptoKeyEncrypterDecrypter
 *       member: serviceAccount:${settings.kmsServiceAccountId}
 * variables:
 *   settings:
 *     fn::invoke:
 *       Function: gcp:logging:getFolderSettings
 *       Arguments:
 *         folder: ${myFolder.folderId}
 * ```
 * 
 * ## Import
 * FolderSettings can be imported using any of these accepted formats:
 * * `folders/{{folder}}/settings`
 * * `{{folder}}`
 * When using the `pulumi import` command, FolderSettings can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:logging/folderSettings:FolderSettings default folders/{{folder}}/settings
 * ```
 * ```sh
 * $ pulumi import gcp:logging/folderSettings:FolderSettings default {{folder}}
 * ```
 * @property disableDefaultSink If set to true, the _Default sink in newly created projects and folders will created in a disabled state. This can be used to automatically disable log storage if there is already an aggregated sink configured in the hierarchy. The _Default sink can be re-enabled manually if needed.
 * @property folder The folder for which to retrieve settings.
 * - - -
 * @property kmsKeyName The resource name for the configured Cloud KMS key.
 * @property storageLocation The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
 */
public data class FolderSettingsArgs(
    public val disableDefaultSink: Output? = null,
    public val folder: Output? = null,
    public val kmsKeyName: Output? = null,
    public val storageLocation: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.logging.FolderSettingsArgs =
        com.pulumi.gcp.logging.FolderSettingsArgs.builder()
            .disableDefaultSink(disableDefaultSink?.applyValue({ args0 -> args0 }))
            .folder(folder?.applyValue({ args0 -> args0 }))
            .kmsKeyName(kmsKeyName?.applyValue({ args0 -> args0 }))
            .storageLocation(storageLocation?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [FolderSettingsArgs].
 */
@PulumiTagMarker
public class FolderSettingsArgsBuilder internal constructor() {
    private var disableDefaultSink: Output? = null

    private var folder: Output? = null

    private var kmsKeyName: Output? = null

    private var storageLocation: Output? = null

    /**
     * @param value If set to true, the _Default sink in newly created projects and folders will created in a disabled state. This can be used to automatically disable log storage if there is already an aggregated sink configured in the hierarchy. The _Default sink can be re-enabled manually if needed.
     */
    @JvmName("saxtjddbkhipxeuy")
    public suspend fun disableDefaultSink(`value`: Output) {
        this.disableDefaultSink = value
    }

    /**
     * @param value The folder for which to retrieve settings.
     * - - -
     */
    @JvmName("tytckwaeaawapbai")
    public suspend fun folder(`value`: Output) {
        this.folder = value
    }

    /**
     * @param value The resource name for the configured Cloud KMS key.
     */
    @JvmName("ueloswieqvjdyxju")
    public suspend fun kmsKeyName(`value`: Output) {
        this.kmsKeyName = value
    }

    /**
     * @param value The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
     */
    @JvmName("vnwcplngmgvdjnqt")
    public suspend fun storageLocation(`value`: Output) {
        this.storageLocation = value
    }

    /**
     * @param value If set to true, the _Default sink in newly created projects and folders will created in a disabled state. This can be used to automatically disable log storage if there is already an aggregated sink configured in the hierarchy. The _Default sink can be re-enabled manually if needed.
     */
    @JvmName("kolfvdwpwxmnfddm")
    public suspend fun disableDefaultSink(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.disableDefaultSink = mapped
    }

    /**
     * @param value The folder for which to retrieve settings.
     * - - -
     */
    @JvmName("ybnalfbsuhxytkyo")
    public suspend fun folder(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.folder = mapped
    }

    /**
     * @param value The resource name for the configured Cloud KMS key.
     */
    @JvmName("qvalrfbhlveptiud")
    public suspend fun kmsKeyName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.kmsKeyName = mapped
    }

    /**
     * @param value The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
     */
    @JvmName("eijoabggykncmpnu")
    public suspend fun storageLocation(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.storageLocation = mapped
    }

    internal fun build(): FolderSettingsArgs = FolderSettingsArgs(
        disableDefaultSink = disableDefaultSink,
        folder = folder,
        kmsKeyName = kmsKeyName,
        storageLocation = storageLocation,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy