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

com.pulumi.gcp.accesscontextmanager.kotlin.AccessLevelsArgs.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.accesscontextmanager.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.accesscontextmanager.AccessLevelsArgs.builder
import com.pulumi.gcp.accesscontextmanager.kotlin.inputs.AccessLevelsAccessLevelArgs
import com.pulumi.gcp.accesscontextmanager.kotlin.inputs.AccessLevelsAccessLevelArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Replace all existing Access Levels in an Access Policy with the Access Levels provided. This is done atomically.
 * This is a bulk edit of all Access Levels and may override existing Access Levels created by `gcp.accesscontextmanager.AccessLevel`,
 * thus causing a permadiff if used alongside `gcp.accesscontextmanager.AccessLevel` on the same parent.
 * To get more information about AccessLevels, see:
 * * [API documentation](https://cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies.accessLevels)
 * * How-to Guides
 *     * [Access Policy Quickstart](https://cloud.google.com/access-context-manager/docs/quickstart)
 * ## Example Usage
 * ### Access Context Manager Access Levels Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const access_policy = new gcp.accesscontextmanager.AccessPolicy("access-policy", {
 *     parent: "organizations/123456789",
 *     title: "my policy",
 * });
 * const access_levels = new gcp.accesscontextmanager.AccessLevels("access-levels", {
 *     parent: pulumi.interpolate`accessPolicies/${access_policy.name}`,
 *     accessLevels: [
 *         {
 *             name: pulumi.interpolate`accessPolicies/${access_policy.name}/accessLevels/chromeos_no_lock`,
 *             title: "chromeos_no_lock",
 *             basic: {
 *                 conditions: [{
 *                     devicePolicy: {
 *                         requireScreenLock: true,
 *                         osConstraints: [{
 *                             osType: "DESKTOP_CHROME_OS",
 *                         }],
 *                     },
 *                     regions: [
 *                         "CH",
 *                         "IT",
 *                         "US",
 *                     ],
 *                 }],
 *             },
 *         },
 *         {
 *             name: pulumi.interpolate`accessPolicies/${access_policy.name}/accessLevels/mac_no_lock`,
 *             title: "mac_no_lock",
 *             basic: {
 *                 conditions: [{
 *                     devicePolicy: {
 *                         requireScreenLock: true,
 *                         osConstraints: [{
 *                             osType: "DESKTOP_MAC",
 *                         }],
 *                     },
 *                     regions: [
 *                         "CH",
 *                         "IT",
 *                         "US",
 *                     ],
 *                 }],
 *             },
 *         },
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * access_policy = gcp.accesscontextmanager.AccessPolicy("access-policy",
 *     parent="organizations/123456789",
 *     title="my policy")
 * access_levels = gcp.accesscontextmanager.AccessLevels("access-levels",
 *     parent=access_policy.name.apply(lambda name: f"accessPolicies/{name}"),
 *     access_levels=[
 *         gcp.accesscontextmanager.AccessLevelsAccessLevelArgs(
 *             name=access_policy.name.apply(lambda name: f"accessPolicies/{name}/accessLevels/chromeos_no_lock"),
 *             title="chromeos_no_lock",
 *             basic=gcp.accesscontextmanager.AccessLevelsAccessLevelBasicArgs(
 *                 conditions=[gcp.accesscontextmanager.AccessLevelsAccessLevelBasicConditionArgs(
 *                     device_policy=gcp.accesscontextmanager.AccessLevelsAccessLevelBasicConditionDevicePolicyArgs(
 *                         require_screen_lock=True,
 *                         os_constraints=[gcp.accesscontextmanager.AccessLevelsAccessLevelBasicConditionDevicePolicyOsConstraintArgs(
 *                             os_type="DESKTOP_CHROME_OS",
 *                         )],
 *                     ),
 *                     regions=[
 *                         "CH",
 *                         "IT",
 *                         "US",
 *                     ],
 *                 )],
 *             ),
 *         ),
 *         gcp.accesscontextmanager.AccessLevelsAccessLevelArgs(
 *             name=access_policy.name.apply(lambda name: f"accessPolicies/{name}/accessLevels/mac_no_lock"),
 *             title="mac_no_lock",
 *             basic=gcp.accesscontextmanager.AccessLevelsAccessLevelBasicArgs(
 *                 conditions=[gcp.accesscontextmanager.AccessLevelsAccessLevelBasicConditionArgs(
 *                     device_policy=gcp.accesscontextmanager.AccessLevelsAccessLevelBasicConditionDevicePolicyArgs(
 *                         require_screen_lock=True,
 *                         os_constraints=[gcp.accesscontextmanager.AccessLevelsAccessLevelBasicConditionDevicePolicyOsConstraintArgs(
 *                             os_type="DESKTOP_MAC",
 *                         )],
 *                     ),
 *                     regions=[
 *                         "CH",
 *                         "IT",
 *                         "US",
 *                     ],
 *                 )],
 *             ),
 *         ),
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var access_policy = new Gcp.AccessContextManager.AccessPolicy("access-policy", new()
 *     {
 *         Parent = "organizations/123456789",
 *         Title = "my policy",
 *     });
 *     var access_levels = new Gcp.AccessContextManager.AccessLevels("access-levels", new()
 *     {
 *         Parent = access_policy.Name.Apply(name => $"accessPolicies/{name}"),
 *         AccessLevelDetails = new[]
 *         {
 *             new Gcp.AccessContextManager.Inputs.AccessLevelsAccessLevelArgs
 *             {
 *                 Name = access_policy.Name.Apply(name => $"accessPolicies/{name}/accessLevels/chromeos_no_lock"),
 *                 Title = "chromeos_no_lock",
 *                 Basic = new Gcp.AccessContextManager.Inputs.AccessLevelsAccessLevelBasicArgs
 *                 {
 *                     Conditions = new[]
 *                     {
 *                         new Gcp.AccessContextManager.Inputs.AccessLevelsAccessLevelBasicConditionArgs
 *                         {
 *                             DevicePolicy = new Gcp.AccessContextManager.Inputs.AccessLevelsAccessLevelBasicConditionDevicePolicyArgs
 *                             {
 *                                 RequireScreenLock = true,
 *                                 OsConstraints = new[]
 *                                 {
 *                                     new Gcp.AccessContextManager.Inputs.AccessLevelsAccessLevelBasicConditionDevicePolicyOsConstraintArgs
 *                                     {
 *                                         OsType = "DESKTOP_CHROME_OS",
 *                                     },
 *                                 },
 *                             },
 *                             Regions = new[]
 *                             {
 *                                 "CH",
 *                                 "IT",
 *                                 "US",
 *                             },
 *                         },
 *                     },
 *                 },
 *             },
 *             new Gcp.AccessContextManager.Inputs.AccessLevelsAccessLevelArgs
 *             {
 *                 Name = access_policy.Name.Apply(name => $"accessPolicies/{name}/accessLevels/mac_no_lock"),
 *                 Title = "mac_no_lock",
 *                 Basic = new Gcp.AccessContextManager.Inputs.AccessLevelsAccessLevelBasicArgs
 *                 {
 *                     Conditions = new[]
 *                     {
 *                         new Gcp.AccessContextManager.Inputs.AccessLevelsAccessLevelBasicConditionArgs
 *                         {
 *                             DevicePolicy = new Gcp.AccessContextManager.Inputs.AccessLevelsAccessLevelBasicConditionDevicePolicyArgs
 *                             {
 *                                 RequireScreenLock = true,
 *                                 OsConstraints = new[]
 *                                 {
 *                                     new Gcp.AccessContextManager.Inputs.AccessLevelsAccessLevelBasicConditionDevicePolicyOsConstraintArgs
 *                                     {
 *                                         OsType = "DESKTOP_MAC",
 *                                     },
 *                                 },
 *                             },
 *                             Regions = new[]
 *                             {
 *                                 "CH",
 *                                 "IT",
 *                                 "US",
 *                             },
 *                         },
 *                     },
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/accesscontextmanager"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := accesscontextmanager.NewAccessPolicy(ctx, "access-policy", &accesscontextmanager.AccessPolicyArgs{
 * 			Parent: pulumi.String("organizations/123456789"),
 * 			Title:  pulumi.String("my policy"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = accesscontextmanager.NewAccessLevels(ctx, "access-levels", &accesscontextmanager.AccessLevelsArgs{
 * 			Parent: access_policy.Name.ApplyT(func(name string) (string, error) {
 * 				return fmt.Sprintf("accessPolicies/%v", name), nil
 * 			}).(pulumi.StringOutput),
 * 			AccessLevels: accesscontextmanager.AccessLevelsAccessLevelArray{
 * 				&accesscontextmanager.AccessLevelsAccessLevelArgs{
 * 					Name: access_policy.Name.ApplyT(func(name string) (string, error) {
 * 						return fmt.Sprintf("accessPolicies/%v/accessLevels/chromeos_no_lock", name), nil
 * 					}).(pulumi.StringOutput),
 * 					Title: pulumi.String("chromeos_no_lock"),
 * 					Basic: &accesscontextmanager.AccessLevelsAccessLevelBasicArgs{
 * 						Conditions: accesscontextmanager.AccessLevelsAccessLevelBasicConditionArray{
 * 							&accesscontextmanager.AccessLevelsAccessLevelBasicConditionArgs{
 * 								DevicePolicy: &accesscontextmanager.AccessLevelsAccessLevelBasicConditionDevicePolicyArgs{
 * 									RequireScreenLock: pulumi.Bool(true),
 * 									OsConstraints: accesscontextmanager.AccessLevelsAccessLevelBasicConditionDevicePolicyOsConstraintArray{
 * 										&accesscontextmanager.AccessLevelsAccessLevelBasicConditionDevicePolicyOsConstraintArgs{
 * 											OsType: pulumi.String("DESKTOP_CHROME_OS"),
 * 										},
 * 									},
 * 								},
 * 								Regions: pulumi.StringArray{
 * 									pulumi.String("CH"),
 * 									pulumi.String("IT"),
 * 									pulumi.String("US"),
 * 								},
 * 							},
 * 						},
 * 					},
 * 				},
 * 				&accesscontextmanager.AccessLevelsAccessLevelArgs{
 * 					Name: access_policy.Name.ApplyT(func(name string) (string, error) {
 * 						return fmt.Sprintf("accessPolicies/%v/accessLevels/mac_no_lock", name), nil
 * 					}).(pulumi.StringOutput),
 * 					Title: pulumi.String("mac_no_lock"),
 * 					Basic: &accesscontextmanager.AccessLevelsAccessLevelBasicArgs{
 * 						Conditions: accesscontextmanager.AccessLevelsAccessLevelBasicConditionArray{
 * 							&accesscontextmanager.AccessLevelsAccessLevelBasicConditionArgs{
 * 								DevicePolicy: &accesscontextmanager.AccessLevelsAccessLevelBasicConditionDevicePolicyArgs{
 * 									RequireScreenLock: pulumi.Bool(true),
 * 									OsConstraints: accesscontextmanager.AccessLevelsAccessLevelBasicConditionDevicePolicyOsConstraintArray{
 * 										&accesscontextmanager.AccessLevelsAccessLevelBasicConditionDevicePolicyOsConstraintArgs{
 * 											OsType: pulumi.String("DESKTOP_MAC"),
 * 										},
 * 									},
 * 								},
 * 								Regions: pulumi.StringArray{
 * 									pulumi.String("CH"),
 * 									pulumi.String("IT"),
 * 									pulumi.String("US"),
 * 								},
 * 							},
 * 						},
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.accesscontextmanager.AccessPolicy;
 * import com.pulumi.gcp.accesscontextmanager.AccessPolicyArgs;
 * import com.pulumi.gcp.accesscontextmanager.AccessLevels;
 * import com.pulumi.gcp.accesscontextmanager.AccessLevelsArgs;
 * import com.pulumi.gcp.accesscontextmanager.inputs.AccessLevelsAccessLevelArgs;
 * import com.pulumi.gcp.accesscontextmanager.inputs.AccessLevelsAccessLevelBasicArgs;
 * 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 access_policy = new AccessPolicy("access-policy", AccessPolicyArgs.builder()
 *             .parent("organizations/123456789")
 *             .title("my policy")
 *             .build());
 *         var access_levels = new AccessLevels("access-levels", AccessLevelsArgs.builder()
 *             .parent(access_policy.name().applyValue(name -> String.format("accessPolicies/%s", name)))
 *             .accessLevels(
 *                 AccessLevelsAccessLevelArgs.builder()
 *                     .name(access_policy.name().applyValue(name -> String.format("accessPolicies/%s/accessLevels/chromeos_no_lock", name)))
 *                     .title("chromeos_no_lock")
 *                     .basic(AccessLevelsAccessLevelBasicArgs.builder()
 *                         .conditions(AccessLevelsAccessLevelBasicConditionArgs.builder()
 *                             .devicePolicy(AccessLevelsAccessLevelBasicConditionDevicePolicyArgs.builder()
 *                                 .requireScreenLock(true)
 *                                 .osConstraints(AccessLevelsAccessLevelBasicConditionDevicePolicyOsConstraintArgs.builder()
 *                                     .osType("DESKTOP_CHROME_OS")
 *                                     .build())
 *                                 .build())
 *                             .regions(
 *                                 "CH",
 *                                 "IT",
 *                                 "US")
 *                             .build())
 *                         .build())
 *                     .build(),
 *                 AccessLevelsAccessLevelArgs.builder()
 *                     .name(access_policy.name().applyValue(name -> String.format("accessPolicies/%s/accessLevels/mac_no_lock", name)))
 *                     .title("mac_no_lock")
 *                     .basic(AccessLevelsAccessLevelBasicArgs.builder()
 *                         .conditions(AccessLevelsAccessLevelBasicConditionArgs.builder()
 *                             .devicePolicy(AccessLevelsAccessLevelBasicConditionDevicePolicyArgs.builder()
 *                                 .requireScreenLock(true)
 *                                 .osConstraints(AccessLevelsAccessLevelBasicConditionDevicePolicyOsConstraintArgs.builder()
 *                                     .osType("DESKTOP_MAC")
 *                                     .build())
 *                                 .build())
 *                             .regions(
 *                                 "CH",
 *                                 "IT",
 *                                 "US")
 *                             .build())
 *                         .build())
 *                     .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   access-levels:
 *     type: gcp:accesscontextmanager:AccessLevels
 *     properties:
 *       parent: accessPolicies/${["access-policy"].name}
 *       accessLevels:
 *         - name: accessPolicies/${["access-policy"].name}/accessLevels/chromeos_no_lock
 *           title: chromeos_no_lock
 *           basic:
 *             conditions:
 *               - devicePolicy:
 *                   requireScreenLock: true
 *                   osConstraints:
 *                     - osType: DESKTOP_CHROME_OS
 *                 regions:
 *                   - CH
 *                   - IT
 *                   - US
 *         - name: accessPolicies/${["access-policy"].name}/accessLevels/mac_no_lock
 *           title: mac_no_lock
 *           basic:
 *             conditions:
 *               - devicePolicy:
 *                   requireScreenLock: true
 *                   osConstraints:
 *                     - osType: DESKTOP_MAC
 *                 regions:
 *                   - CH
 *                   - IT
 *                   - US
 *   access-policy:
 *     type: gcp:accesscontextmanager:AccessPolicy
 *     properties:
 *       parent: organizations/123456789
 *       title: my policy
 * ```
 * 
 * ## Import
 * AccessLevels can be imported using any of these accepted formats:
 * * `{{parent}}/accessLevels`
 * * `{{parent}}`
 * When using the `pulumi import` command, AccessLevels can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:accesscontextmanager/accessLevels:AccessLevels default {{parent}}/accessLevels
 * ```
 * ```sh
 * $ pulumi import gcp:accesscontextmanager/accessLevels:AccessLevels default {{parent}}
 * ```
 * @property accessLevels The desired Access Levels that should replace all existing Access Levels in the Access Policy.
 * Structure is documented below.
 * @property parent The AccessPolicy this AccessLevel lives in.
 * Format: accessPolicies/{policy_id}
 * - - -
 */
public data class AccessLevelsArgs(
    public val accessLevels: Output>? = null,
    public val parent: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.accesscontextmanager.AccessLevelsArgs =
        com.pulumi.gcp.accesscontextmanager.AccessLevelsArgs.builder()
            .accessLevels(
                accessLevels?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .parent(parent?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [AccessLevelsArgs].
 */
@PulumiTagMarker
public class AccessLevelsArgsBuilder internal constructor() {
    private var accessLevels: Output>? = null

    private var parent: Output? = null

    /**
     * @param value The desired Access Levels that should replace all existing Access Levels in the Access Policy.
     * Structure is documented below.
     */
    @JvmName("rnxuodddbwgyobcu")
    public suspend fun accessLevels(`value`: Output>) {
        this.accessLevels = value
    }

    @JvmName("ygtovoymynmgynsq")
    public suspend fun accessLevels(vararg values: Output) {
        this.accessLevels = Output.all(values.asList())
    }

    /**
     * @param values The desired Access Levels that should replace all existing Access Levels in the Access Policy.
     * Structure is documented below.
     */
    @JvmName("obwriolsotlhnxpq")
    public suspend fun accessLevels(values: List>) {
        this.accessLevels = Output.all(values)
    }

    /**
     * @param value The AccessPolicy this AccessLevel lives in.
     * Format: accessPolicies/{policy_id}
     * - - -
     */
    @JvmName("uqbiserjunemuojc")
    public suspend fun parent(`value`: Output) {
        this.parent = value
    }

    /**
     * @param value The desired Access Levels that should replace all existing Access Levels in the Access Policy.
     * Structure is documented below.
     */
    @JvmName("irglswirdesmeenp")
    public suspend fun accessLevels(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.accessLevels = mapped
    }

    /**
     * @param argument The desired Access Levels that should replace all existing Access Levels in the Access Policy.
     * Structure is documented below.
     */
    @JvmName("bbmsbtmyxyoyatlt")
    public suspend fun accessLevels(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            AccessLevelsAccessLevelArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.accessLevels = mapped
    }

    /**
     * @param argument The desired Access Levels that should replace all existing Access Levels in the Access Policy.
     * Structure is documented below.
     */
    @JvmName("hcotnsftgvjisgpj")
    public suspend fun accessLevels(vararg argument: suspend AccessLevelsAccessLevelArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            AccessLevelsAccessLevelArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.accessLevels = mapped
    }

    /**
     * @param argument The desired Access Levels that should replace all existing Access Levels in the Access Policy.
     * Structure is documented below.
     */
    @JvmName("dbhqncrgeomlmmxe")
    public suspend fun accessLevels(argument: suspend AccessLevelsAccessLevelArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            AccessLevelsAccessLevelArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.accessLevels = mapped
    }

    /**
     * @param values The desired Access Levels that should replace all existing Access Levels in the Access Policy.
     * Structure is documented below.
     */
    @JvmName("tvjqdgkrdtckcoat")
    public suspend fun accessLevels(vararg values: AccessLevelsAccessLevelArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.accessLevels = mapped
    }

    /**
     * @param value The AccessPolicy this AccessLevel lives in.
     * Format: accessPolicies/{policy_id}
     * - - -
     */
    @JvmName("kiaarwjmrckliukl")
    public suspend fun parent(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.parent = mapped
    }

    internal fun build(): AccessLevelsArgs = AccessLevelsArgs(
        accessLevels = accessLevels,
        parent = parent,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy