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

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

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

package com.pulumi.gcp.logging.kotlin

import com.pulumi.core.Output
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.String
import kotlin.Suppress
import kotlin.Unit

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

    public var args: LogViewArgs = LogViewArgs()

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

/**
 * Describes a view over log entries in a bucket.
 * To get more information about LogView, see:
 * * [API documentation](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.locations.buckets.views)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/logging/docs/apis)
 * ## Example Usage
 * ### Logging Log View Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const loggingLogView = new gcp.logging.ProjectBucketConfig("logging_log_view", {
 *     project: "my-project-name",
 *     location: "global",
 *     retentionDays: 30,
 *     bucketId: "_Default",
 * });
 * const loggingLogViewLogView = new gcp.logging.LogView("logging_log_view", {
 *     name: "my-view",
 *     bucket: loggingLogView.id,
 *     description: "A logging view configured with Terraform",
 *     filter: "SOURCE(\"projects/myproject\") AND resource.type = \"gce_instance\" AND LOG_ID(\"stdout\")",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * logging_log_view = gcp.logging.ProjectBucketConfig("logging_log_view",
 *     project="my-project-name",
 *     location="global",
 *     retention_days=30,
 *     bucket_id="_Default")
 * logging_log_view_log_view = gcp.logging.LogView("logging_log_view",
 *     name="my-view",
 *     bucket=logging_log_view.id,
 *     description="A logging view configured with Terraform",
 *     filter="SOURCE(\"projects/myproject\") AND resource.type = \"gce_instance\" AND LOG_ID(\"stdout\")")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var loggingLogView = new Gcp.Logging.ProjectBucketConfig("logging_log_view", new()
 *     {
 *         Project = "my-project-name",
 *         Location = "global",
 *         RetentionDays = 30,
 *         BucketId = "_Default",
 *     });
 *     var loggingLogViewLogView = new Gcp.Logging.LogView("logging_log_view", new()
 *     {
 *         Name = "my-view",
 *         Bucket = loggingLogView.Id,
 *         Description = "A logging view configured with Terraform",
 *         Filter = "SOURCE(\"projects/myproject\") AND resource.type = \"gce_instance\" AND LOG_ID(\"stdout\")",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"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 {
 * 		loggingLogView, err := logging.NewProjectBucketConfig(ctx, "logging_log_view", &logging.ProjectBucketConfigArgs{
 * 			Project:       pulumi.String("my-project-name"),
 * 			Location:      pulumi.String("global"),
 * 			RetentionDays: pulumi.Int(30),
 * 			BucketId:      pulumi.String("_Default"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = logging.NewLogView(ctx, "logging_log_view", &logging.LogViewArgs{
 * 			Name:        pulumi.String("my-view"),
 * 			Bucket:      loggingLogView.ID(),
 * 			Description: pulumi.String("A logging view configured with Terraform"),
 * 			Filter:      pulumi.String("SOURCE(\"projects/myproject\") AND resource.type = \"gce_instance\" AND LOG_ID(\"stdout\")"),
 * 		})
 * 		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.LogView;
 * import com.pulumi.gcp.logging.LogViewArgs;
 * 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 loggingLogView = new ProjectBucketConfig("loggingLogView", ProjectBucketConfigArgs.builder()
 *             .project("my-project-name")
 *             .location("global")
 *             .retentionDays(30)
 *             .bucketId("_Default")
 *             .build());
 *         var loggingLogViewLogView = new LogView("loggingLogViewLogView", LogViewArgs.builder()
 *             .name("my-view")
 *             .bucket(loggingLogView.id())
 *             .description("A logging view configured with Terraform")
 *             .filter("SOURCE(\"projects/myproject\") AND resource.type = \"gce_instance\" AND LOG_ID(\"stdout\")")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   loggingLogView:
 *     type: gcp:logging:ProjectBucketConfig
 *     name: logging_log_view
 *     properties:
 *       project: my-project-name
 *       location: global
 *       retentionDays: 30
 *       bucketId: _Default
 *   loggingLogViewLogView:
 *     type: gcp:logging:LogView
 *     name: logging_log_view
 *     properties:
 *       name: my-view
 *       bucket: ${loggingLogView.id}
 *       description: A logging view configured with Terraform
 *       filter: SOURCE("projects/myproject") AND resource.type = "gce_instance" AND LOG_ID("stdout")
 * ```
 * 
 * ## Import
 * LogView can be imported using any of these accepted formats:
 * * `{{parent}}/locations/{{location}}/buckets/{{bucket}}/views/{{name}}`
 * When using the `pulumi import` command, LogView can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:logging/logView:LogView default {{parent}}/locations/{{location}}/buckets/{{bucket}}/views/{{name}}
 * ```
 */
public class LogView internal constructor(
    override val javaResource: com.pulumi.gcp.logging.LogView,
) : KotlinCustomResource(javaResource, LogViewMapper) {
    /**
     * The bucket of the resource
     * - - -
     */
    public val bucket: Output
        get() = javaResource.bucket().applyValue({ args0 -> args0 })

    /**
     * Output only. The creation timestamp of the view.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * Describes this view.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Filter that restricts which log entries in a bucket are visible in this view. Filters are restricted to be a logical AND of ==/!= of any of the following: - originating project/folder/organization/billing account. - resource type - log id For example: SOURCE("projects/myproject") AND resource.type = "gce_instance" AND LOG_ID("stdout")
     */
    public val filter: Output?
        get() = javaResource.filter().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The location of the resource. The supported locations are: global, us-central1, us-east1, us-west1, asia-east1, europe-west1.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The resource name of the view. For example: \`projects/my-project/locations/global/buckets/my-bucket/views/my-view\`
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

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

    /**
     * Output only. The last update timestamp of the view.
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy