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

com.pulumi.gcp.logging.kotlin.OrganizationBucketConfig.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.gcp.logging.kotlin.outputs.OrganizationBucketConfigCmekSettings
import com.pulumi.gcp.logging.kotlin.outputs.OrganizationBucketConfigIndexConfig
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.OrganizationBucketConfigCmekSettings.Companion.toKotlin as organizationBucketConfigCmekSettingsToKotlin
import com.pulumi.gcp.logging.kotlin.outputs.OrganizationBucketConfigIndexConfig.Companion.toKotlin as organizationBucketConfigIndexConfigToKotlin

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

    public var args: OrganizationBucketConfigArgs = OrganizationBucketConfigArgs()

    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 OrganizationBucketConfigArgsBuilder.() -> Unit) {
        val builder = OrganizationBucketConfigArgsBuilder()
        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(): OrganizationBucketConfig {
        val builtJavaResource = com.pulumi.gcp.logging.OrganizationBucketConfig(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return OrganizationBucketConfig(builtJavaResource)
    }
}

/**
 * Manages a organization-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.getOrganization({
 *     organization: "123456789",
 * });
 * const basic = new gcp.logging.OrganizationBucketConfig("basic", {
 *     organization: _default.then(_default => _default.organization),
 *     location: "global",
 *     retentionDays: 30,
 *     bucketId: "_Default",
 *     indexConfigs: {
 *         filePath: "jsonPayload.request.status",
 *         type: "INDEX_TYPE_STRING",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.organizations.get_organization(organization="123456789")
 * basic = gcp.logging.OrganizationBucketConfig("basic",
 *     organization=default.organization,
 *     location="global",
 *     retention_days=30,
 *     bucket_id="_Default",
 *     index_configs={
 *         "filePath": "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 = Gcp.Organizations.GetOrganization.Invoke(new()
 *     {
 *         Organization = "123456789",
 *     });
 *     var basic = new Gcp.Logging.OrganizationBucketConfig("basic", new()
 *     {
 *         Organization = @default.Apply(@default => @default.Apply(getOrganizationResult => getOrganizationResult.Organization)),
 *         Location = "global",
 *         RetentionDays = 30,
 *         BucketId = "_Default",
 *         IndexConfigs =
 *         {
 *             { "filePath", "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 {
 * 		_default, err := organizations.GetOrganization(ctx, &organizations.GetOrganizationArgs{
 * 			Organization: pulumi.StringRef("123456789"),
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = logging.NewOrganizationBucketConfig(ctx, "basic", &logging.OrganizationBucketConfigArgs{
 * 			Organization:  pulumi.String(_default.Organization),
 * 			Location:      pulumi.String("global"),
 * 			RetentionDays: pulumi.Int(30),
 * 			BucketId:      pulumi.String("_Default"),
 * 			IndexConfigs: logging.OrganizationBucketConfigIndexConfigArray{
 * 				FilePath: "jsonPayload.request.status",
 * 				Type:     "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.OrganizationsFunctions;
 * import com.pulumi.gcp.organizations.inputs.GetOrganizationArgs;
 * import com.pulumi.gcp.logging.OrganizationBucketConfig;
 * import com.pulumi.gcp.logging.OrganizationBucketConfigArgs;
 * 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.getOrganization(GetOrganizationArgs.builder()
 *             .organization("123456789")
 *             .build());
 *         var basic = new OrganizationBucketConfig("basic", OrganizationBucketConfigArgs.builder()
 *             .organization(default_.organization())
 *             .location("global")
 *             .retentionDays(30)
 *             .bucketId("_Default")
 *             .indexConfigs(OrganizationBucketConfigIndexConfigArgs.builder()
 *                 .filePath("jsonPayload.request.status")
 *                 .type("INDEX_TYPE_STRING")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   basic:
 *     type: gcp:logging:OrganizationBucketConfig
 *     properties:
 *       organization: ${default.organization}
 *       location: global
 *       retentionDays: 30
 *       bucketId: _Default
 *       indexConfigs:
 *         filePath: jsonPayload.request.status
 *         type: INDEX_TYPE_STRING
 * variables:
 *   default:
 *     fn::invoke:
 *       Function: gcp:organizations:getOrganization
 *       Arguments:
 *         organization: '123456789'
 * ```
 * 
 * ## Import
 * This resource can be imported using the following format:
 * * `organizations/{{organization}}/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/organizationBucketConfig:OrganizationBucketConfig default organizations/{{organization}}/locations/{{location}}/buckets/{{bucket_id}}
 * ```
 */
public class OrganizationBucketConfig internal constructor(
    override val javaResource: com.pulumi.gcp.logging.OrganizationBucketConfig,
) : KotlinCustomResource(javaResource, OrganizationBucketConfigMapper) {
    /**
     * 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.
     */
    public val cmekSettings: Output?
        get() = javaResource.cmekSettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    organizationBucketConfigCmekSettingsToKotlin(args0)
                })
            }).orElse(null)
        })

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

    /**
     * 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 -> organizationBucketConfigIndexConfigToKotlin(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. The supported locations are: "global" "us-central1"
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The resource name of the bucket. For example: "organizations/my-organization-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 organization: Output
        get() = javaResource.organization().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. Bucket retention can not be increased on buckets outside of projects.
     */
    public val retentionDays: Output?
        get() = javaResource.retentionDays().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy