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

com.pulumi.gcp.logging.kotlin.LogScope.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.20.1.0
Show newest version
@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
import kotlin.collections.List

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

    public var args: LogScopeArgs = LogScopeArgs()

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

/**
 * Describes a group of resources to read log entries from
 * To get more information about LogScope, see:
 * * [API documentation](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.locations.logScopes)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/logging/docs/apis)
 * ## Example Usage
 * ### Logging Log Scope Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const loggingLogScope = new gcp.logging.LogScope("logging_log_scope", {
 *     parent: "projects/my-project-name",
 *     location: "global",
 *     name: "projects/my-project-name/locations/global/logScopes/my-log-scope",
 *     resourceNames: [
 *         "projects/my-project-name",
 *         "projects/my-project-name/locations/global/buckets/_Default/views/view1",
 *         "projects/my-project-name/locations/global/buckets/_Default/views/view2",
 *     ],
 *     description: "A log scope configured with Terraform",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * logging_log_scope = gcp.logging.LogScope("logging_log_scope",
 *     parent="projects/my-project-name",
 *     location="global",
 *     name="projects/my-project-name/locations/global/logScopes/my-log-scope",
 *     resource_names=[
 *         "projects/my-project-name",
 *         "projects/my-project-name/locations/global/buckets/_Default/views/view1",
 *         "projects/my-project-name/locations/global/buckets/_Default/views/view2",
 *     ],
 *     description="A log scope configured with Terraform")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var loggingLogScope = new Gcp.Logging.LogScope("logging_log_scope", new()
 *     {
 *         Parent = "projects/my-project-name",
 *         Location = "global",
 *         Name = "projects/my-project-name/locations/global/logScopes/my-log-scope",
 *         ResourceNames = new[]
 *         {
 *             "projects/my-project-name",
 *             "projects/my-project-name/locations/global/buckets/_Default/views/view1",
 *             "projects/my-project-name/locations/global/buckets/_Default/views/view2",
 *         },
 *         Description = "A log scope configured with Terraform",
 *     });
 * });
 * ```
 * ```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.NewLogScope(ctx, "logging_log_scope", &logging.LogScopeArgs{
 * 			Parent:   pulumi.String("projects/my-project-name"),
 * 			Location: pulumi.String("global"),
 * 			Name:     pulumi.String("projects/my-project-name/locations/global/logScopes/my-log-scope"),
 * 			ResourceNames: pulumi.StringArray{
 * 				pulumi.String("projects/my-project-name"),
 * 				pulumi.String("projects/my-project-name/locations/global/buckets/_Default/views/view1"),
 * 				pulumi.String("projects/my-project-name/locations/global/buckets/_Default/views/view2"),
 * 			},
 * 			Description: pulumi.String("A log scope configured with Terraform"),
 * 		})
 * 		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.LogScope;
 * import com.pulumi.gcp.logging.LogScopeArgs;
 * 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 loggingLogScope = new LogScope("loggingLogScope", LogScopeArgs.builder()
 *             .parent("projects/my-project-name")
 *             .location("global")
 *             .name("projects/my-project-name/locations/global/logScopes/my-log-scope")
 *             .resourceNames(
 *                 "projects/my-project-name",
 *                 "projects/my-project-name/locations/global/buckets/_Default/views/view1",
 *                 "projects/my-project-name/locations/global/buckets/_Default/views/view2")
 *             .description("A log scope configured with Terraform")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   loggingLogScope:
 *     type: gcp:logging:LogScope
 *     name: logging_log_scope
 *     properties:
 *       parent: projects/my-project-name
 *       location: global
 *       name: projects/my-project-name/locations/global/logScopes/my-log-scope
 *       resourceNames:
 *         - projects/my-project-name
 *         - projects/my-project-name/locations/global/buckets/_Default/views/view1
 *         - projects/my-project-name/locations/global/buckets/_Default/views/view2
 *       description: A log scope configured with Terraform
 * ```
 * 
 * ## Import
 * LogScope can be imported using any of these accepted formats:
 * * `{{parent}}/locations/{{location}}/logScopes/{{name}}`
 * When using the `pulumi import` command, LogScope can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:logging/logScope:LogScope default {{parent}}/locations/{{location}}/logScopes/{{name}}
 * ```
 */
public class LogScope internal constructor(
    override val javaResource: com.pulumi.gcp.logging.LogScope,
) : KotlinCustomResource(javaResource, LogScopeMapper) {
    /**
     * Output only. The creation timestamp of the log scopes.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

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

    /**
     * The location of the resource. The only supported location is global so far.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The resource name of the log scope. For example: \`projects/my-project/locations/global/logScopes/my-log-scope\`
     */
    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 })

    /**
     * Names of one or more parent resources : *  \`projects/[PROJECT_ID]\` May alternatively be one or more views : * \`projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]\` A log scope can include a maximum of 50 projects and a maximum of 100 resources in total.
     * - - -
     */
    public val resourceNames: Output>
        get() = javaResource.resourceNames().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

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

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy