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

com.pulumi.gcp.organizations.kotlin.IamAuditConfig.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.organizations.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.organizations.kotlin.outputs.IamAuditConfigAuditLogConfig
import com.pulumi.gcp.organizations.kotlin.outputs.IamAuditConfigAuditLogConfig.Companion.toKotlin
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 [IamAuditConfig].
 */
@PulumiTagMarker
public class IamAuditConfigResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: IamAuditConfigArgs = IamAuditConfigArgs()

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

/**
 * Allows management of audit logging config for a given service for a Google Cloud Platform Organization.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const config = new gcp.organizations.IamAuditConfig("config", {
 *     orgId: "your-organization-id",
 *     service: "allServices",
 *     auditLogConfigs: [{
 *         logType: "DATA_READ",
 *         exemptedMembers: ["user:joebloggs@example.com"],
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * config = gcp.organizations.IamAuditConfig("config",
 *     org_id="your-organization-id",
 *     service="allServices",
 *     audit_log_configs=[gcp.organizations.IamAuditConfigAuditLogConfigArgs(
 *         log_type="DATA_READ",
 *         exempted_members=["user:joebloggs@example.com"],
 *     )])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var config = new Gcp.Organizations.IamAuditConfig("config", new()
 *     {
 *         OrgId = "your-organization-id",
 *         Service = "allServices",
 *         AuditLogConfigs = new[]
 *         {
 *             new Gcp.Organizations.Inputs.IamAuditConfigAuditLogConfigArgs
 *             {
 *                 LogType = "DATA_READ",
 *                 ExemptedMembers = new[]
 *                 {
 *                     "user:[email protected]",
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"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 {
 * 		_, err := organizations.NewIamAuditConfig(ctx, "config", &organizations.IamAuditConfigArgs{
 * 			OrgId:   pulumi.String("your-organization-id"),
 * 			Service: pulumi.String("allServices"),
 * 			AuditLogConfigs: organizations.IamAuditConfigAuditLogConfigArray{
 * 				&organizations.IamAuditConfigAuditLogConfigArgs{
 * 					LogType: pulumi.String("DATA_READ"),
 * 					ExemptedMembers: pulumi.StringArray{
 * 						pulumi.String("user:[email protected]"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.IamAuditConfig;
 * import com.pulumi.gcp.organizations.IamAuditConfigArgs;
 * import com.pulumi.gcp.organizations.inputs.IamAuditConfigAuditLogConfigArgs;
 * 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 config = new IamAuditConfig("config", IamAuditConfigArgs.builder()
 *             .orgId("your-organization-id")
 *             .service("allServices")
 *             .auditLogConfigs(IamAuditConfigAuditLogConfigArgs.builder()
 *                 .logType("DATA_READ")
 *                 .exemptedMembers("user:[email protected]")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   config:
 *     type: gcp:organizations:IamAuditConfig
 *     properties:
 *       orgId: your-organization-id
 *       service: allServices
 *       auditLogConfigs:
 *         - logType: DATA_READ
 *           exemptedMembers:
 *             - user:[email protected]
 * ```
 * 
 * ## Import
 * IAM audit config imports use the identifier of the resource in question and the service, e.g.
 * ```sh
 * $ pulumi import gcp:organizations/iamAuditConfig:IamAuditConfig config "your-organization-id foo.googleapis.com"
 * ```
 */
public class IamAuditConfig internal constructor(
    override val javaResource: com.pulumi.gcp.organizations.IamAuditConfig,
) : KotlinCustomResource(javaResource, IamAuditConfigMapper) {
    /**
     * The configuration for logging of each type of permission.  This can be specified multiple times.  Structure is documented below.
     */
    public val auditLogConfigs: Output>
        get() = javaResource.auditLogConfigs().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> toKotlin(args0) })
            })
        })

    /**
     * The etag of iam policy
     */
    public val etag: Output
        get() = javaResource.etag().applyValue({ args0 -> args0 })

    /**
     * The numeric ID of the organization in which you want to manage the audit logging config.
     */
    public val orgId: Output
        get() = javaResource.orgId().applyValue({ args0 -> args0 })

    /**
     * Service which will be enabled for audit logging.  The special value `allServices` covers all services.  Note that if there are google\_organization\_iam\_audit\_config resources covering both `allServices` and a specific service then the union of the two AuditConfigs is used for that service: the `log_types` specified in each `audit_log_config` are enabled, and the `exempted_members` in each `audit_log_config` are exempted.
     */
    public val service: Output
        get() = javaResource.service().applyValue({ args0 -> args0 })
}

public object IamAuditConfigMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.organizations.IamAuditConfig::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy