com.pulumi.gcp.logging.kotlin.BillingAccountBucketConfig.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.logging.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.logging.kotlin.outputs.BillingAccountBucketConfigCmekSettings
import com.pulumi.gcp.logging.kotlin.outputs.BillingAccountBucketConfigIndexConfig
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.BillingAccountBucketConfigCmekSettings.Companion.toKotlin as billingAccountBucketConfigCmekSettingsToKotlin
import com.pulumi.gcp.logging.kotlin.outputs.BillingAccountBucketConfigIndexConfig.Companion.toKotlin as billingAccountBucketConfigIndexConfigToKotlin
/**
* Builder for [BillingAccountBucketConfig].
*/
@PulumiTagMarker
public class BillingAccountBucketConfigResourceBuilder internal constructor() {
public var name: String? = null
public var args: BillingAccountBucketConfigArgs = BillingAccountBucketConfigArgs()
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 BillingAccountBucketConfigArgsBuilder.() -> Unit) {
val builder = BillingAccountBucketConfigArgsBuilder()
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(): BillingAccountBucketConfig {
val builtJavaResource =
com.pulumi.gcp.logging.BillingAccountBucketConfig(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return BillingAccountBucketConfig(builtJavaResource)
}
}
/**
* Manages a billing account 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.getBillingAccount({
* billingAccount: "00AA00-000AAA-00AA0A",
* });
* const basic = new gcp.logging.BillingAccountBucketConfig("basic", {
* billingAccount: _default.then(_default => _default.billingAccount),
* location: "global",
* retentionDays: 30,
* bucketId: "_Default",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.organizations.get_billing_account(billing_account="00AA00-000AAA-00AA0A")
* basic = gcp.logging.BillingAccountBucketConfig("basic",
* billing_account=default.billing_account,
* 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 = Gcp.Organizations.GetBillingAccount.Invoke(new()
* {
* BillingAccount = "00AA00-000AAA-00AA0A",
* });
* var basic = new Gcp.Logging.BillingAccountBucketConfig("basic", new()
* {
* BillingAccount = @default.Apply(@default => @default.Apply(getBillingAccountResult => getBillingAccountResult.BillingAccount)),
* Location = "global",
* RetentionDays = 30,
* BucketId = "_Default",
* });
* });
* ```
* ```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.GetBillingAccount(ctx, &organizations.GetBillingAccountArgs{
* BillingAccount: pulumi.StringRef("00AA00-000AAA-00AA0A"),
* }, nil)
* if err != nil {
* return err
* }
* _, err = logging.NewBillingAccountBucketConfig(ctx, "basic", &logging.BillingAccountBucketConfigArgs{
* BillingAccount: pulumi.String(_default.BillingAccount),
* 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.OrganizationsFunctions;
* import com.pulumi.gcp.organizations.inputs.GetBillingAccountArgs;
* import com.pulumi.gcp.logging.BillingAccountBucketConfig;
* import com.pulumi.gcp.logging.BillingAccountBucketConfigArgs;
* 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.getBillingAccount(GetBillingAccountArgs.builder()
* .billingAccount("00AA00-000AAA-00AA0A")
* .build());
* var basic = new BillingAccountBucketConfig("basic", BillingAccountBucketConfigArgs.builder()
* .billingAccount(default_.billingAccount())
* .location("global")
* .retentionDays(30)
* .bucketId("_Default")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* basic:
* type: gcp:logging:BillingAccountBucketConfig
* properties:
* billingAccount: ${default.billingAccount}
* location: global
* retentionDays: 30
* bucketId: _Default
* variables:
* default:
* fn::invoke:
* Function: gcp:organizations:getBillingAccount
* Arguments:
* billingAccount: 00AA00-000AAA-00AA0A
* ```
*
* Create logging bucket with index configs
*
* ```yaml
* resources:
* example-billing-account-bucket-index-configs:
* type: gcp:logging:BillingAccountBucketConfig
* properties:
* folder: ${default.billingAccount}
* location: global
* retentionDays: 30
* bucketId: _Default
* indexConfigs:
* filePath: jsonPayload.request.status
* type: INDEX_TYPE_STRING
* ```
*
* ## Import
* This resource can be imported using the following format:
* * `billingAccounts/{{billingAccount}}/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/billingAccountBucketConfig:BillingAccountBucketConfig default billingAccounts/{{billingAccount}}/locations/{{location}}/buckets/{{bucket_id}}
* ```
*/
public class BillingAccountBucketConfig internal constructor(
override val javaResource: com.pulumi.gcp.logging.BillingAccountBucketConfig,
) : KotlinCustomResource(javaResource, BillingAccountBucketConfigMapper) {
/**
* The parent resource that contains the logging bucket.
*/
public val billingAccount: Output
get() = javaResource.billingAccount().applyValue({ args0 -> args0 })
/**
* 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 ->
billingAccountBucketConfigCmekSettingsToKotlin(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 ->
billingAccountBucketConfigIndexConfigToKotlin(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 })
/**
* 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 })
/**
* 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 BillingAccountBucketConfigMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.logging.BillingAccountBucketConfig::class == javaResource::class
override fun map(javaResource: Resource): BillingAccountBucketConfig =
BillingAccountBucketConfig(javaResource as com.pulumi.gcp.logging.BillingAccountBucketConfig)
}
/**
* @see [BillingAccountBucketConfig].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [BillingAccountBucketConfig].
*/
public suspend fun billingAccountBucketConfig(
name: String,
block: suspend BillingAccountBucketConfigResourceBuilder.() -> Unit,
): BillingAccountBucketConfig {
val builder = BillingAccountBucketConfigResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [BillingAccountBucketConfig].
* @param name The _unique_ name of the resulting resource.
*/
public fun billingAccountBucketConfig(name: String): BillingAccountBucketConfig {
val builder = BillingAccountBucketConfigResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy