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

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

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.logging.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.logging.kotlin.outputs.ProjectBucketConfigCmekSettings
import com.pulumi.gcp.logging.kotlin.outputs.ProjectBucketConfigIndexConfig
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.gcp.logging.kotlin.outputs.ProjectBucketConfigCmekSettings.Companion.toKotlin as projectBucketConfigCmekSettingsToKotlin
import com.pulumi.gcp.logging.kotlin.outputs.ProjectBucketConfigIndexConfig.Companion.toKotlin as projectBucketConfigIndexConfigToKotlin

/**
 * Builder for [ProjectBucketConfig].
 */
@PulumiTagMarker
public class ProjectBucketConfigResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ProjectBucketConfigArgs = ProjectBucketConfigArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend ProjectBucketConfigArgsBuilder.() -> Unit) {
        val builder = ProjectBucketConfigArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): ProjectBucketConfig {
        val builtJavaResource = com.pulumi.gcp.logging.ProjectBucketConfig(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return ProjectBucketConfig(builtJavaResource)
    }
}

/**
 * Manages a project-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.Project("default", {
 *     projectId: "your-project-id",
 *     name: "your-project-id",
 *     orgId: "123456789",
 * });
 * const basic = new gcp.logging.ProjectBucketConfig("basic", {
 *     project: _default.projectId,
 *     location: "global",
 *     retentionDays: 30,
 *     bucketId: "_Default",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.organizations.Project("default",
 *     project_id="your-project-id",
 *     name="your-project-id",
 *     org_id="123456789")
 * basic = gcp.logging.ProjectBucketConfig("basic",
 *     project=default.project_id,
 *     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 = new Gcp.Organizations.Project("default", new()
 *     {
 *         ProjectId = "your-project-id",
 *         Name = "your-project-id",
 *         OrgId = "123456789",
 *     });
 *     var basic = new Gcp.Logging.ProjectBucketConfig("basic", new()
 *     {
 *         Project = @default.ProjectId,
 *         Location = "global",
 *         RetentionDays = 30,
 *         BucketId = "_Default",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/logging"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := organizations.NewProject(ctx, "default", &organizations.ProjectArgs{
 * 			ProjectId: pulumi.String("your-project-id"),
 * 			Name:      pulumi.String("your-project-id"),
 * 			OrgId:     pulumi.String("123456789"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = logging.NewProjectBucketConfig(ctx, "basic", &logging.ProjectBucketConfigArgs{
 * 			Project:       _default.ProjectId,
 * 			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.Project;
 * import com.pulumi.gcp.organizations.ProjectArgs;
 * import com.pulumi.gcp.logging.ProjectBucketConfig;
 * import com.pulumi.gcp.logging.ProjectBucketConfigArgs;
 * 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 Project("default", ProjectArgs.builder()
 *             .projectId("your-project-id")
 *             .name("your-project-id")
 *             .orgId("123456789")
 *             .build());
 *         var basic = new ProjectBucketConfig("basic", ProjectBucketConfigArgs.builder()
 *             .project(default_.projectId())
 *             .location("global")
 *             .retentionDays(30)
 *             .bucketId("_Default")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:organizations:Project
 *     properties:
 *       projectId: your-project-id
 *       name: your-project-id
 *       orgId: '123456789'
 *   basic:
 *     type: gcp:logging:ProjectBucketConfig
 *     properties:
 *       project: ${default.projectId}
 *       location: global
 *       retentionDays: 30
 *       bucketId: _Default
 * ```
 * 
 * Create logging bucket with customId
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const basic = new gcp.logging.ProjectBucketConfig("basic", {
 *     project: "project_id",
 *     location: "global",
 *     retentionDays: 30,
 *     bucketId: "custom-bucket",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * basic = gcp.logging.ProjectBucketConfig("basic",
 *     project="project_id",
 *     location="global",
 *     retention_days=30,
 *     bucket_id="custom-bucket")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var basic = new Gcp.Logging.ProjectBucketConfig("basic", new()
 *     {
 *         Project = "project_id",
 *         Location = "global",
 *         RetentionDays = 30,
 *         BucketId = "custom-bucket",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/logging"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := logging.NewProjectBucketConfig(ctx, "basic", &logging.ProjectBucketConfigArgs{
 * 			Project:       pulumi.String("project_id"),
 * 			Location:      pulumi.String("global"),
 * 			RetentionDays: pulumi.Int(30),
 * 			BucketId:      pulumi.String("custom-bucket"),
 * 		})
 * 		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.ProjectBucketConfig;
 * import com.pulumi.gcp.logging.ProjectBucketConfigArgs;
 * 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 basic = new ProjectBucketConfig("basic", ProjectBucketConfigArgs.builder()
 *             .project("project_id")
 *             .location("global")
 *             .retentionDays(30)
 *             .bucketId("custom-bucket")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   basic:
 *     type: gcp:logging:ProjectBucketConfig
 *     properties:
 *       project: project_id
 *       location: global
 *       retentionDays: 30
 *       bucketId: custom-bucket
 * ```
 * 
 * Create logging bucket with Log Analytics enabled
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const analytics_enabled_bucket = new gcp.logging.ProjectBucketConfig("analytics-enabled-bucket", {
 *     project: "project_id",
 *     location: "global",
 *     retentionDays: 30,
 *     enableAnalytics: true,
 *     bucketId: "custom-bucket",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * analytics_enabled_bucket = gcp.logging.ProjectBucketConfig("analytics-enabled-bucket",
 *     project="project_id",
 *     location="global",
 *     retention_days=30,
 *     enable_analytics=True,
 *     bucket_id="custom-bucket")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var analytics_enabled_bucket = new Gcp.Logging.ProjectBucketConfig("analytics-enabled-bucket", new()
 *     {
 *         Project = "project_id",
 *         Location = "global",
 *         RetentionDays = 30,
 *         EnableAnalytics = true,
 *         BucketId = "custom-bucket",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/logging"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := logging.NewProjectBucketConfig(ctx, "analytics-enabled-bucket", &logging.ProjectBucketConfigArgs{
 * 			Project:         pulumi.String("project_id"),
 * 			Location:        pulumi.String("global"),
 * 			RetentionDays:   pulumi.Int(30),
 * 			EnableAnalytics: pulumi.Bool(true),
 * 			BucketId:        pulumi.String("custom-bucket"),
 * 		})
 * 		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.ProjectBucketConfig;
 * import com.pulumi.gcp.logging.ProjectBucketConfigArgs;
 * 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 analytics_enabled_bucket = new ProjectBucketConfig("analytics-enabled-bucket", ProjectBucketConfigArgs.builder()
 *             .project("project_id")
 *             .location("global")
 *             .retentionDays(30)
 *             .enableAnalytics(true)
 *             .bucketId("custom-bucket")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   analytics-enabled-bucket:
 *     type: gcp:logging:ProjectBucketConfig
 *     properties:
 *       project: project_id
 *       location: global
 *       retentionDays: 30
 *       enableAnalytics: true
 *       bucketId: custom-bucket
 * ```
 * 
 * Create logging bucket with customId and cmekSettings
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const cmekSettings = gcp.logging.getProjectCmekSettings({
 *     project: "project_id",
 * });
 * const keyring = new gcp.kms.KeyRing("keyring", {
 *     name: "keyring-example",
 *     location: "us-central1",
 * });
 * const key = new gcp.kms.CryptoKey("key", {
 *     name: "crypto-key-example",
 *     keyRing: keyring.id,
 *     rotationPeriod: "7776000s",
 * });
 * const cryptoKeyBinding = new gcp.kms.CryptoKeyIAMBinding("crypto_key_binding", {
 *     cryptoKeyId: key.id,
 *     role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
 *     members: [cmekSettings.then(cmekSettings => `serviceAccount:${cmekSettings.serviceAccountId}`)],
 * });
 * const example_project_bucket_cmek_settings = new gcp.logging.ProjectBucketConfig("example-project-bucket-cmek-settings", {
 *     project: "project_id",
 *     location: "us-central1",
 *     retentionDays: 30,
 *     bucketId: "custom-bucket",
 *     cmekSettings: {
 *         kmsKeyName: key.id,
 *     },
 * }, {
 *     dependsOn: [cryptoKeyBinding],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * cmek_settings = gcp.logging.get_project_cmek_settings(project="project_id")
 * keyring = gcp.kms.KeyRing("keyring",
 *     name="keyring-example",
 *     location="us-central1")
 * key = gcp.kms.CryptoKey("key",
 *     name="crypto-key-example",
 *     key_ring=keyring.id,
 *     rotation_period="7776000s")
 * crypto_key_binding = gcp.kms.CryptoKeyIAMBinding("crypto_key_binding",
 *     crypto_key_id=key.id,
 *     role="roles/cloudkms.cryptoKeyEncrypterDecrypter",
 *     members=[f"serviceAccount:{cmek_settings.service_account_id}"])
 * example_project_bucket_cmek_settings = gcp.logging.ProjectBucketConfig("example-project-bucket-cmek-settings",
 *     project="project_id",
 *     location="us-central1",
 *     retention_days=30,
 *     bucket_id="custom-bucket",
 *     cmek_settings={
 *         "kms_key_name": key.id,
 *     },
 *     opts = pulumi.ResourceOptions(depends_on=[crypto_key_binding]))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var cmekSettings = Gcp.Logging.GetProjectCmekSettings.Invoke(new()
 *     {
 *         Project = "project_id",
 *     });
 *     var keyring = new Gcp.Kms.KeyRing("keyring", new()
 *     {
 *         Name = "keyring-example",
 *         Location = "us-central1",
 *     });
 *     var key = new Gcp.Kms.CryptoKey("key", new()
 *     {
 *         Name = "crypto-key-example",
 *         KeyRing = keyring.Id,
 *         RotationPeriod = "7776000s",
 *     });
 *     var cryptoKeyBinding = new Gcp.Kms.CryptoKeyIAMBinding("crypto_key_binding", new()
 *     {
 *         CryptoKeyId = key.Id,
 *         Role = "roles/cloudkms.cryptoKeyEncrypterDecrypter",
 *         Members = new[]
 *         {
 *             $"serviceAccount:{cmekSettings.Apply(getProjectCmekSettingsResult => getProjectCmekSettingsResult.ServiceAccountId)}",
 *         },
 *     });
 *     var example_project_bucket_cmek_settings = new Gcp.Logging.ProjectBucketConfig("example-project-bucket-cmek-settings", new()
 *     {
 *         Project = "project_id",
 *         Location = "us-central1",
 *         RetentionDays = 30,
 *         BucketId = "custom-bucket",
 *         CmekSettings = new Gcp.Logging.Inputs.ProjectBucketConfigCmekSettingsArgs
 *         {
 *             KmsKeyName = key.Id,
 *         },
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             cryptoKeyBinding,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/kms"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/logging"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		cmekSettings, err := logging.GetProjectCmekSettings(ctx, &logging.GetProjectCmekSettingsArgs{
 * 			Project: "project_id",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		keyring, err := kms.NewKeyRing(ctx, "keyring", &kms.KeyRingArgs{
 * 			Name:     pulumi.String("keyring-example"),
 * 			Location: pulumi.String("us-central1"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		key, err := kms.NewCryptoKey(ctx, "key", &kms.CryptoKeyArgs{
 * 			Name:           pulumi.String("crypto-key-example"),
 * 			KeyRing:        keyring.ID(),
 * 			RotationPeriod: pulumi.String("7776000s"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		cryptoKeyBinding, err := kms.NewCryptoKeyIAMBinding(ctx, "crypto_key_binding", &kms.CryptoKeyIAMBindingArgs{
 * 			CryptoKeyId: key.ID(),
 * 			Role:        pulumi.String("roles/cloudkms.cryptoKeyEncrypterDecrypter"),
 * 			Members: pulumi.StringArray{
 * 				pulumi.Sprintf("serviceAccount:%v", cmekSettings.ServiceAccountId),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = logging.NewProjectBucketConfig(ctx, "example-project-bucket-cmek-settings", &logging.ProjectBucketConfigArgs{
 * 			Project:       pulumi.String("project_id"),
 * 			Location:      pulumi.String("us-central1"),
 * 			RetentionDays: pulumi.Int(30),
 * 			BucketId:      pulumi.String("custom-bucket"),
 * 			CmekSettings: &logging.ProjectBucketConfigCmekSettingsArgs{
 * 				KmsKeyName: key.ID(),
 * 			},
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			cryptoKeyBinding,
 * 		}))
 * 		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.LoggingFunctions;
 * import com.pulumi.gcp.logging.inputs.GetProjectCmekSettingsArgs;
 * import com.pulumi.gcp.kms.KeyRing;
 * import com.pulumi.gcp.kms.KeyRingArgs;
 * import com.pulumi.gcp.kms.CryptoKey;
 * import com.pulumi.gcp.kms.CryptoKeyArgs;
 * import com.pulumi.gcp.kms.CryptoKeyIAMBinding;
 * import com.pulumi.gcp.kms.CryptoKeyIAMBindingArgs;
 * import com.pulumi.gcp.logging.ProjectBucketConfig;
 * import com.pulumi.gcp.logging.ProjectBucketConfigArgs;
 * import com.pulumi.gcp.logging.inputs.ProjectBucketConfigCmekSettingsArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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 cmekSettings = LoggingFunctions.getProjectCmekSettings(GetProjectCmekSettingsArgs.builder()
 *             .project("project_id")
 *             .build());
 *         var keyring = new KeyRing("keyring", KeyRingArgs.builder()
 *             .name("keyring-example")
 *             .location("us-central1")
 *             .build());
 *         var key = new CryptoKey("key", CryptoKeyArgs.builder()
 *             .name("crypto-key-example")
 *             .keyRing(keyring.id())
 *             .rotationPeriod("7776000s")
 *             .build());
 *         var cryptoKeyBinding = new CryptoKeyIAMBinding("cryptoKeyBinding", CryptoKeyIAMBindingArgs.builder()
 *             .cryptoKeyId(key.id())
 *             .role("roles/cloudkms.cryptoKeyEncrypterDecrypter")
 *             .members(String.format("serviceAccount:%s", cmekSettings.applyValue(getProjectCmekSettingsResult -> getProjectCmekSettingsResult.serviceAccountId())))
 *             .build());
 *         var example_project_bucket_cmek_settings = new ProjectBucketConfig("example-project-bucket-cmek-settings", ProjectBucketConfigArgs.builder()
 *             .project("project_id")
 *             .location("us-central1")
 *             .retentionDays(30)
 *             .bucketId("custom-bucket")
 *             .cmekSettings(ProjectBucketConfigCmekSettingsArgs.builder()
 *                 .kmsKeyName(key.id())
 *                 .build())
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(cryptoKeyBinding)
 *                 .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   keyring:
 *     type: gcp:kms:KeyRing
 *     properties:
 *       name: keyring-example
 *       location: us-central1
 *   key:
 *     type: gcp:kms:CryptoKey
 *     properties:
 *       name: crypto-key-example
 *       keyRing: ${keyring.id}
 *       rotationPeriod: 7776000s
 *   cryptoKeyBinding:
 *     type: gcp:kms:CryptoKeyIAMBinding
 *     name: crypto_key_binding
 *     properties:
 *       cryptoKeyId: ${key.id}
 *       role: roles/cloudkms.cryptoKeyEncrypterDecrypter
 *       members:
 *         - serviceAccount:${cmekSettings.serviceAccountId}
 *   example-project-bucket-cmek-settings:
 *     type: gcp:logging:ProjectBucketConfig
 *     properties:
 *       project: project_id
 *       location: us-central1
 *       retentionDays: 30
 *       bucketId: custom-bucket
 *       cmekSettings:
 *         kmsKeyName: ${key.id}
 *     options:
 *       dependsOn:
 *         - ${cryptoKeyBinding}
 * variables:
 *   cmekSettings:
 *     fn::invoke:
 *       function: gcp:logging:getProjectCmekSettings
 *       arguments:
 *         project: project_id
 * ```
 * 
 * Create logging bucket with index configs
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const example_project_bucket_index_configs = new gcp.logging.ProjectBucketConfig("example-project-bucket-index-configs", {
 *     project: "project_id",
 *     location: "global",
 *     retentionDays: 30,
 *     bucketId: "custom-bucket",
 *     indexConfigs: [{
 *         fieldPath: "jsonPayload.request.status",
 *         type: "INDEX_TYPE_STRING",
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * example_project_bucket_index_configs = gcp.logging.ProjectBucketConfig("example-project-bucket-index-configs",
 *     project="project_id",
 *     location="global",
 *     retention_days=30,
 *     bucket_id="custom-bucket",
 *     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 example_project_bucket_index_configs = new Gcp.Logging.ProjectBucketConfig("example-project-bucket-index-configs", new()
 *     {
 *         Project = "project_id",
 *         Location = "global",
 *         RetentionDays = 30,
 *         BucketId = "custom-bucket",
 *         IndexConfigs = new[]
 *         {
 *             new Gcp.Logging.Inputs.ProjectBucketConfigIndexConfigArgs
 *             {
 *                 FieldPath = "jsonPayload.request.status",
 *                 Type = "INDEX_TYPE_STRING",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/logging"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := logging.NewProjectBucketConfig(ctx, "example-project-bucket-index-configs", &logging.ProjectBucketConfigArgs{
 * 			Project:       pulumi.String("project_id"),
 * 			Location:      pulumi.String("global"),
 * 			RetentionDays: pulumi.Int(30),
 * 			BucketId:      pulumi.String("custom-bucket"),
 * 			IndexConfigs: logging.ProjectBucketConfigIndexConfigArray{
 * 				&logging.ProjectBucketConfigIndexConfigArgs{
 * 					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.logging.ProjectBucketConfig;
 * import com.pulumi.gcp.logging.ProjectBucketConfigArgs;
 * import com.pulumi.gcp.logging.inputs.ProjectBucketConfigIndexConfigArgs;
 * 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_project_bucket_index_configs = new ProjectBucketConfig("example-project-bucket-index-configs", ProjectBucketConfigArgs.builder()
 *             .project("project_id")
 *             .location("global")
 *             .retentionDays(30)
 *             .bucketId("custom-bucket")
 *             .indexConfigs(ProjectBucketConfigIndexConfigArgs.builder()
 *                 .fieldPath("jsonPayload.request.status")
 *                 .type("INDEX_TYPE_STRING")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example-project-bucket-index-configs:
 *     type: gcp:logging:ProjectBucketConfig
 *     properties:
 *       project: project_id
 *       location: global
 *       retentionDays: 30
 *       bucketId: custom-bucket
 *       indexConfigs:
 *         - fieldPath: jsonPayload.request.status
 *           type: INDEX_TYPE_STRING
 * ```
 * 
 * ## Import
 * This resource can be imported using the following format:
 * * `projects/{{project}}/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/projectBucketConfig:ProjectBucketConfig default projects/{{project}}/locations/{{location}}/buckets/{{bucket_id}}
 * ```
 */
public class ProjectBucketConfig internal constructor(
    override val javaResource: com.pulumi.gcp.logging.ProjectBucketConfig,
) : KotlinCustomResource(javaResource, ProjectBucketConfigMapper) {
    /**
     * The name of the logging bucket. Logging automatically creates two log buckets: `_Required` and `_Default`.
     */
    public val bucketId: Output
        get() = javaResource.bucketId().applyValue({ args0 -> args0 })

    /**
     * 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. Structure is documented below.
     */
    public val cmekSettings: Output?
        get() = javaResource.cmekSettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    projectBucketConfigCmekSettingsToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Describes this bucket.
     */
    public val description: Output
        get() = javaResource.description().applyValue({ args0 -> args0 })

    /**
     * Whether or not Log Analytics is enabled. Logs for buckets with Log Analytics enabled can be queried in the **Log Analytics** page using SQL queries. Cannot be disabled once enabled.
     */
    public val enableAnalytics: Output?
        get() = javaResource.enableAnalytics().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A list of indexed fields and related configuration data. Structure is documented below.
     */
    public val indexConfigs: Output>?
        get() = javaResource.indexConfigs().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> projectBucketConfigIndexConfigToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * The bucket's lifecycle such as active or deleted. See [LifecycleState](https://cloud.google.com/logging/docs/reference/v2/rest/v2/billingAccounts.buckets#LogBucket.LifecycleState).
     */
    public val lifecycleState: Output
        get() = javaResource.lifecycleState().applyValue({ args0 -> args0 })

    /**
     * The location of the bucket.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Whether the bucket is locked. The retention period on a locked bucket cannot be changed. Locked buckets may only be deleted if they are empty.
     */
    public val locked: Output?
        get() = javaResource.locked().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The resource name of the bucket. For example: "projects/my-project-id/locations/my-location/buckets/my-bucket-id"
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The parent resource that contains the logging bucket.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * 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.
     */
    public val retentionDays: Output?
        get() = javaResource.retentionDays().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object ProjectBucketConfigMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.logging.ProjectBucketConfig::class == javaResource::class

    override fun map(javaResource: Resource): ProjectBucketConfig = ProjectBucketConfig(
        javaResource
            as com.pulumi.gcp.logging.ProjectBucketConfig,
    )
}

/**
 * @see [ProjectBucketConfig].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [ProjectBucketConfig].
 */
public suspend fun projectBucketConfig(
    name: String,
    block: suspend ProjectBucketConfigResourceBuilder.() -> Unit,
): ProjectBucketConfig {
    val builder = ProjectBucketConfigResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [ProjectBucketConfig].
 * @param name The _unique_ name of the resulting resource.
 */
public fun projectBucketConfig(name: String): ProjectBucketConfig {
    val builder = ProjectBucketConfigResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy