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

com.pulumi.gitlab.kotlin.ProjectProtectedEnvironmentArgs.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.4.2.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gitlab.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gitlab.ProjectProtectedEnvironmentArgs.builder
import com.pulumi.gitlab.kotlin.inputs.ProjectProtectedEnvironmentApprovalRuleArgs
import com.pulumi.gitlab.kotlin.inputs.ProjectProtectedEnvironmentApprovalRuleArgsBuilder
import com.pulumi.gitlab.kotlin.inputs.ProjectProtectedEnvironmentDeployAccessLevelArgs
import com.pulumi.gitlab.kotlin.inputs.ProjectProtectedEnvironmentDeployAccessLevelArgsBuilder
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

/**
 * The `gitlab.ProjectProtectedEnvironment` resource allows to manage the lifecycle of a protected environment in a project.
 * > In order to use a user or group in the `deploy_access_levels` configuration,
 *    you need to make sure that users have access to the project and groups must have this project shared.
 *    You may use the `gitlab.ProjectMembership` and `gitlab_project_shared_group` resources to achieve this.
 *    Unfortunately, the GitLab API does not complain about users and groups without access to the project and just ignores those.
 *    In case this happens you will get perpetual state diffs.
 * **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/ee/api/protected_environments.html)
 * ## Import
 * Starting in Terraform v1.5.0 you can use an import block to import `gitlab_project_protected_environment`. For example:
 * terraform
 * import {
 *   to = gitlab_project_protected_environment.example
 *   id = "see CLI command below for ID"
 * }
 * Import using the CLI is supported using the following syntax:
 * GitLab protected environments can be imported using an id made up of `projectId:environmentName`, e.g.
 * ```sh
 * $ pulumi import gitlab:index/projectProtectedEnvironment:ProjectProtectedEnvironment bar 123:production
 * ```
 * @property approvalRules Array of approval rules to deploy, with each described by a hash. Elements in the `approval_rules` should be one of `user_id`, `group_id` or `access_level`.
 * @property deployAccessLevels Array of access levels allowed to deploy, with each described by a hash.  Elements in the `deploy_access_levels` should be one of `user_id`, `group_id` or `access_level`.
 * @property environment The name of the environment.
 * @property project The ID or full path of the project which the protected environment is created against.
 */
public data class ProjectProtectedEnvironmentArgs(
    public val approvalRules: Output>? = null,
    public val deployAccessLevels: Output>? =
        null,
    public val environment: Output? = null,
    public val project: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gitlab.ProjectProtectedEnvironmentArgs =
        com.pulumi.gitlab.ProjectProtectedEnvironmentArgs.builder()
            .approvalRules(
                approvalRules?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .deployAccessLevels(
                deployAccessLevels?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 -> args0.toJava() })
                    })
                }),
            )
            .environment(environment?.applyValue({ args0 -> args0 }))
            .project(project?.applyValue({ args0 -> args0 })).build()
}

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

    private var deployAccessLevels: Output>? =
        null

    private var environment: Output? = null

    private var project: Output? = null

    /**
     * @param value Array of approval rules to deploy, with each described by a hash. Elements in the `approval_rules` should be one of `user_id`, `group_id` or `access_level`.
     */
    @JvmName("qcwkuyiyfmkffkaj")
    public suspend fun approvalRules(`value`: Output>) {
        this.approvalRules = value
    }

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

    /**
     * @param values Array of approval rules to deploy, with each described by a hash. Elements in the `approval_rules` should be one of `user_id`, `group_id` or `access_level`.
     */
    @JvmName("thgscejuixbjgddf")
    public suspend fun approvalRules(values: List>) {
        this.approvalRules = Output.all(values)
    }

    /**
     * @param value Array of access levels allowed to deploy, with each described by a hash.  Elements in the `deploy_access_levels` should be one of `user_id`, `group_id` or `access_level`.
     */
    @JvmName("hueieqxfcrxahgpq")
    public suspend fun deployAccessLevels(`value`: Output>) {
        this.deployAccessLevels = value
    }

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

    /**
     * @param values Array of access levels allowed to deploy, with each described by a hash.  Elements in the `deploy_access_levels` should be one of `user_id`, `group_id` or `access_level`.
     */
    @JvmName("sjhnqprljtmtkwnn")
    public suspend fun deployAccessLevels(values: List>) {
        this.deployAccessLevels = Output.all(values)
    }

    /**
     * @param value The name of the environment.
     */
    @JvmName("nryslkrfghwukxrn")
    public suspend fun environment(`value`: Output) {
        this.environment = value
    }

    /**
     * @param value The ID or full path of the project which the protected environment is created against.
     */
    @JvmName("gmwsjaaserplneyy")
    public suspend fun project(`value`: Output) {
        this.project = value
    }

    /**
     * @param value Array of approval rules to deploy, with each described by a hash. Elements in the `approval_rules` should be one of `user_id`, `group_id` or `access_level`.
     */
    @JvmName("bmtpidwdstkbekmi")
    public suspend fun approvalRules(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.approvalRules = mapped
    }

    /**
     * @param argument Array of approval rules to deploy, with each described by a hash. Elements in the `approval_rules` should be one of `user_id`, `group_id` or `access_level`.
     */
    @JvmName("pkyxfwjtfupabftm")
    public suspend fun approvalRules(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            ProjectProtectedEnvironmentApprovalRuleArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.approvalRules = mapped
    }

    /**
     * @param argument Array of approval rules to deploy, with each described by a hash. Elements in the `approval_rules` should be one of `user_id`, `group_id` or `access_level`.
     */
    @JvmName("ypiafnhnfxjldrib")
    public suspend fun approvalRules(vararg argument: suspend ProjectProtectedEnvironmentApprovalRuleArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            ProjectProtectedEnvironmentApprovalRuleArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.approvalRules = mapped
    }

    /**
     * @param argument Array of approval rules to deploy, with each described by a hash. Elements in the `approval_rules` should be one of `user_id`, `group_id` or `access_level`.
     */
    @JvmName("ovvchekglgsvpmsb")
    public suspend fun approvalRules(argument: suspend ProjectProtectedEnvironmentApprovalRuleArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            ProjectProtectedEnvironmentApprovalRuleArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.approvalRules = mapped
    }

    /**
     * @param values Array of approval rules to deploy, with each described by a hash. Elements in the `approval_rules` should be one of `user_id`, `group_id` or `access_level`.
     */
    @JvmName("syxqwxymbgffdwyl")
    public suspend fun approvalRules(vararg values: ProjectProtectedEnvironmentApprovalRuleArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.approvalRules = mapped
    }

    /**
     * @param value Array of access levels allowed to deploy, with each described by a hash.  Elements in the `deploy_access_levels` should be one of `user_id`, `group_id` or `access_level`.
     */
    @JvmName("itftaabotafygldd")
    public suspend fun deployAccessLevels(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.deployAccessLevels = mapped
    }

    /**
     * @param argument Array of access levels allowed to deploy, with each described by a hash.  Elements in the `deploy_access_levels` should be one of `user_id`, `group_id` or `access_level`.
     */
    @JvmName("xdgnqjsvpahywwuv")
    public suspend fun deployAccessLevels(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            ProjectProtectedEnvironmentDeployAccessLevelArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.deployAccessLevels = mapped
    }

    /**
     * @param argument Array of access levels allowed to deploy, with each described by a hash.  Elements in the `deploy_access_levels` should be one of `user_id`, `group_id` or `access_level`.
     */
    @JvmName("djxprfhupbhhkieg")
    public suspend fun deployAccessLevels(vararg argument: suspend ProjectProtectedEnvironmentDeployAccessLevelArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            ProjectProtectedEnvironmentDeployAccessLevelArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.deployAccessLevels = mapped
    }

    /**
     * @param argument Array of access levels allowed to deploy, with each described by a hash.  Elements in the `deploy_access_levels` should be one of `user_id`, `group_id` or `access_level`.
     */
    @JvmName("kgdgwvonurgkvefx")
    public suspend fun deployAccessLevels(argument: suspend ProjectProtectedEnvironmentDeployAccessLevelArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            ProjectProtectedEnvironmentDeployAccessLevelArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.deployAccessLevels = mapped
    }

    /**
     * @param values Array of access levels allowed to deploy, with each described by a hash.  Elements in the `deploy_access_levels` should be one of `user_id`, `group_id` or `access_level`.
     */
    @JvmName("nuacrwtjjaueydyl")
    public suspend fun deployAccessLevels(vararg values: ProjectProtectedEnvironmentDeployAccessLevelArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.deployAccessLevels = mapped
    }

    /**
     * @param value The name of the environment.
     */
    @JvmName("icchyvlptvcywecs")
    public suspend fun environment(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.environment = mapped
    }

    /**
     * @param value The ID or full path of the project which the protected environment is created against.
     */
    @JvmName("tqxwvmtespidqecf")
    public suspend fun project(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.project = mapped
    }

    internal fun build(): ProjectProtectedEnvironmentArgs = ProjectProtectedEnvironmentArgs(
        approvalRules = approvalRules,
        deployAccessLevels = deployAccessLevels,
        environment = environment,
        project = project,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy