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

com.pulumi.gcp.logging.kotlin.OrganizationSettingsArgs.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.OrganizationSettingsArgs.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 OrganizationSettings, 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 Organization Settings All
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const example = new gcp.logging.OrganizationSettings("example", {
 *     disableDefaultSink: true,
 *     kmsKeyName: "kms-key",
 *     organization: "123456789",
 *     storageLocation: "us-central1",
 * });
 * const settings = gcp.logging.getOrganizationSettings({
 *     organization: "123456789",
 * });
 * const iam = new gcp.kms.CryptoKeyIAMMember("iam", {
 *     cryptoKeyId: "kms-key",
 *     role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
 *     member: settings.then(settings => `serviceAccount:${settings.kmsServiceAccountId}`),
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * example = gcp.logging.OrganizationSettings("example",
 *     disable_default_sink=True,
 *     kms_key_name="kms-key",
 *     organization="123456789",
 *     storage_location="us-central1")
 * settings = gcp.logging.get_organization_settings(organization="123456789")
 * iam = gcp.kms.CryptoKeyIAMMember("iam",
 *     crypto_key_id="kms-key",
 *     role="roles/cloudkms.cryptoKeyEncrypterDecrypter",
 *     member=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 example = new Gcp.Logging.OrganizationSettings("example", new()
 *     {
 *         DisableDefaultSink = true,
 *         KmsKeyName = "kms-key",
 *         Organization = "123456789",
 *         StorageLocation = "us-central1",
 *     });
 *     var settings = Gcp.Logging.GetOrganizationSettings.Invoke(new()
 *     {
 *         Organization = "123456789",
 *     });
 *     var iam = new Gcp.Kms.CryptoKeyIAMMember("iam", new()
 *     {
 *         CryptoKeyId = "kms-key",
 *         Role = "roles/cloudkms.cryptoKeyEncrypterDecrypter",
 *         Member = $"serviceAccount:{settings.Apply(getOrganizationSettingsResult => getOrganizationSettingsResult.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/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := logging.NewOrganizationSettings(ctx, "example", &logging.OrganizationSettingsArgs{
 * 			DisableDefaultSink: pulumi.Bool(true),
 * 			KmsKeyName:         pulumi.String("kms-key"),
 * 			Organization:       pulumi.String("123456789"),
 * 			StorageLocation:    pulumi.String("us-central1"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		settings, err := logging.LookupOrganizationSettings(ctx, &logging.LookupOrganizationSettingsArgs{
 * 			Organization: "123456789",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = kms.NewCryptoKeyIAMMember(ctx, "iam", &kms.CryptoKeyIAMMemberArgs{
 * 			CryptoKeyId: pulumi.String("kms-key"),
 * 			Role:        pulumi.String("roles/cloudkms.cryptoKeyEncrypterDecrypter"),
 * 			Member:      pulumi.String(fmt.Sprintf("serviceAccount:%v", settings.KmsServiceAccountId)),
 * 		})
 * 		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.logging.OrganizationSettings;
 * import com.pulumi.gcp.logging.OrganizationSettingsArgs;
 * import com.pulumi.gcp.logging.LoggingFunctions;
 * import com.pulumi.gcp.logging.inputs.GetOrganizationSettingsArgs;
 * 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 example = new OrganizationSettings("example", OrganizationSettingsArgs.builder()
 *             .disableDefaultSink(true)
 *             .kmsKeyName("kms-key")
 *             .organization("123456789")
 *             .storageLocation("us-central1")
 *             .build());
 *         final var settings = LoggingFunctions.getOrganizationSettings(GetOrganizationSettingsArgs.builder()
 *             .organization("123456789")
 *             .build());
 *         var iam = new CryptoKeyIAMMember("iam", CryptoKeyIAMMemberArgs.builder()
 *             .cryptoKeyId("kms-key")
 *             .role("roles/cloudkms.cryptoKeyEncrypterDecrypter")
 *             .member(String.format("serviceAccount:%s", settings.applyValue(getOrganizationSettingsResult -> getOrganizationSettingsResult.kmsServiceAccountId())))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: gcp:logging:OrganizationSettings
 *     properties:
 *       disableDefaultSink: true
 *       kmsKeyName: kms-key
 *       organization: '123456789'
 *       storageLocation: us-central1
 *   iam:
 *     type: gcp:kms:CryptoKeyIAMMember
 *     properties:
 *       cryptoKeyId: kms-key
 *       role: roles/cloudkms.cryptoKeyEncrypterDecrypter
 *       member: serviceAccount:${settings.kmsServiceAccountId}
 * variables:
 *   settings:
 *     fn::invoke:
 *       Function: gcp:logging:getOrganizationSettings
 *       Arguments:
 *         organization: '123456789'
 * ```
 * 
 * ## Import
 * OrganizationSettings can be imported using any of these accepted formats:
 * * `organizations/{{organization}}/settings`
 * * `{{organization}}`
 * When using the `pulumi import` command, OrganizationSettings can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:logging/organizationSettings:OrganizationSettings default organizations/{{organization}}/settings
 * ```
 * ```sh
 * $ pulumi import gcp:logging/organizationSettings:OrganizationSettings default {{organization}}
 * ```
 * @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 kmsKeyName The resource name for the configured Cloud KMS key.
 * @property organization The organization for which to retrieve or configure settings.
 * - - -
 * @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 OrganizationSettingsArgs(
    public val disableDefaultSink: Output? = null,
    public val kmsKeyName: Output? = null,
    public val organization: Output? = null,
    public val storageLocation: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.logging.OrganizationSettingsArgs =
        com.pulumi.gcp.logging.OrganizationSettingsArgs.builder()
            .disableDefaultSink(disableDefaultSink?.applyValue({ args0 -> args0 }))
            .kmsKeyName(kmsKeyName?.applyValue({ args0 -> args0 }))
            .organization(organization?.applyValue({ args0 -> args0 }))
            .storageLocation(storageLocation?.applyValue({ args0 -> args0 })).build()
}

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

    private var kmsKeyName: Output? = null

    private var organization: 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("bnppqubivpmvfufp")
    public suspend fun disableDefaultSink(`value`: Output) {
        this.disableDefaultSink = value
    }

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

    /**
     * @param value The organization for which to retrieve or configure settings.
     * - - -
     */
    @JvmName("gliarwcblilyfakl")
    public suspend fun organization(`value`: Output) {
        this.organization = 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("ocsgyetqdwrhkpdt")
    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("rekhtrxxrafkncsy")
    public suspend fun disableDefaultSink(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.disableDefaultSink = mapped
    }

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

    /**
     * @param value The organization for which to retrieve or configure settings.
     * - - -
     */
    @JvmName("lbpdpvuwkxscvdmi")
    public suspend fun organization(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.organization = 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("ieaqlsjpsujfstiu")
    public suspend fun storageLocation(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.storageLocation = mapped
    }

    internal fun build(): OrganizationSettingsArgs = OrganizationSettingsArgs(
        disableDefaultSink = disableDefaultSink,
        kmsKeyName = kmsKeyName,
        organization = organization,
        storageLocation = storageLocation,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy