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

com.pulumi.gitlab.kotlin.DeployKeyEnableArgs.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.DeployKeyEnableArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName

/**
 * The `gitlab.DeployKeyEnable` resource allows to enable an already existing deploy key (see `gitlab.DeployKey resource`) for a specific project.
 * **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/ee/api/deploy_keys.html#enable-a-deploy-key)
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gitlab from "@pulumi/gitlab";
 * // A repo to host the deployment key
 * const parent = new gitlab.Project("parent", {name: "parent_project"});
 * // A second repo to use the deployment key from the parent project
 * const foo = new gitlab.Project("foo", {name: "foo_project"});
 * // Upload a deployment key for the parent repo
 * const parentDeployKey = new gitlab.DeployKey("parent", {
 *     project: parent.id,
 *     title: "Example deploy key",
 *     key: "ssh-ed25519 AAAA...",
 * });
 * // Enable the deployment key on the second repo
 * const fooDeployKeyEnable = new gitlab.DeployKeyEnable("foo", {
 *     project: foo.id,
 *     keyId: parentDeployKey.deployKeyId,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gitlab as gitlab
 * # A repo to host the deployment key
 * parent = gitlab.Project("parent", name="parent_project")
 * # A second repo to use the deployment key from the parent project
 * foo = gitlab.Project("foo", name="foo_project")
 * # Upload a deployment key for the parent repo
 * parent_deploy_key = gitlab.DeployKey("parent",
 *     project=parent.id,
 *     title="Example deploy key",
 *     key="ssh-ed25519 AAAA...")
 * # Enable the deployment key on the second repo
 * foo_deploy_key_enable = gitlab.DeployKeyEnable("foo",
 *     project=foo.id,
 *     key_id=parent_deploy_key.deploy_key_id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using GitLab = Pulumi.GitLab;
 * return await Deployment.RunAsync(() =>
 * {
 *     // A repo to host the deployment key
 *     var parent = new GitLab.Project("parent", new()
 *     {
 *         Name = "parent_project",
 *     });
 *     // A second repo to use the deployment key from the parent project
 *     var foo = new GitLab.Project("foo", new()
 *     {
 *         Name = "foo_project",
 *     });
 *     // Upload a deployment key for the parent repo
 *     var parentDeployKey = new GitLab.DeployKey("parent", new()
 *     {
 *         Project = parent.Id,
 *         Title = "Example deploy key",
 *         Key = "ssh-ed25519 AAAA...",
 *     });
 *     // Enable the deployment key on the second repo
 *     var fooDeployKeyEnable = new GitLab.DeployKeyEnable("foo", new()
 *     {
 *         Project = foo.Id,
 *         KeyId = parentDeployKey.DeployKeyId,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gitlab/sdk/v8/go/gitlab"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		// A repo to host the deployment key
 * 		parent, err := gitlab.NewProject(ctx, "parent", &gitlab.ProjectArgs{
 * 			Name: pulumi.String("parent_project"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// A second repo to use the deployment key from the parent project
 * 		foo, err := gitlab.NewProject(ctx, "foo", &gitlab.ProjectArgs{
 * 			Name: pulumi.String("foo_project"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// Upload a deployment key for the parent repo
 * 		parentDeployKey, err := gitlab.NewDeployKey(ctx, "parent", &gitlab.DeployKeyArgs{
 * 			Project: parent.ID(),
 * 			Title:   pulumi.String("Example deploy key"),
 * 			Key:     pulumi.String("ssh-ed25519 AAAA..."),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// Enable the deployment key on the second repo
 * 		_, err = gitlab.NewDeployKeyEnable(ctx, "foo", &gitlab.DeployKeyEnableArgs{
 * 			Project: foo.ID(),
 * 			KeyId:   parentDeployKey.DeployKeyId,
 * 		})
 * 		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.gitlab.Project;
 * import com.pulumi.gitlab.ProjectArgs;
 * import com.pulumi.gitlab.DeployKey;
 * import com.pulumi.gitlab.DeployKeyArgs;
 * import com.pulumi.gitlab.DeployKeyEnable;
 * import com.pulumi.gitlab.DeployKeyEnableArgs;
 * 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) {
 *         // A repo to host the deployment key
 *         var parent = new Project("parent", ProjectArgs.builder()
 *             .name("parent_project")
 *             .build());
 *         // A second repo to use the deployment key from the parent project
 *         var foo = new Project("foo", ProjectArgs.builder()
 *             .name("foo_project")
 *             .build());
 *         // Upload a deployment key for the parent repo
 *         var parentDeployKey = new DeployKey("parentDeployKey", DeployKeyArgs.builder()
 *             .project(parent.id())
 *             .title("Example deploy key")
 *             .key("ssh-ed25519 AAAA...")
 *             .build());
 *         // Enable the deployment key on the second repo
 *         var fooDeployKeyEnable = new DeployKeyEnable("fooDeployKeyEnable", DeployKeyEnableArgs.builder()
 *             .project(foo.id())
 *             .keyId(parentDeployKey.deployKeyId())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   # A repo to host the deployment key
 *   parent:
 *     type: gitlab:Project
 *     properties:
 *       name: parent_project
 *   # A second repo to use the deployment key from the parent project
 *   foo:
 *     type: gitlab:Project
 *     properties:
 *       name: foo_project
 *   # Upload a deployment key for the parent repo
 *   parentDeployKey:
 *     type: gitlab:DeployKey
 *     name: parent
 *     properties:
 *       project: ${parent.id}
 *       title: Example deploy key
 *       key: ssh-ed25519 AAAA...
 *   # Enable the deployment key on the second repo
 *   fooDeployKeyEnable:
 *     type: gitlab:DeployKeyEnable
 *     name: foo
 *     properties:
 *       project: ${foo.id}
 *       keyId: ${parentDeployKey.deployKeyId}
 * ```
 * 
 * ## Import
 * GitLab enabled deploy keys can be imported using an id made up of `{project_id}:{deploy_key_id}`, e.g.
 * `project_id` can be whatever the [get single project api][get_single_project] takes for
 * its `:id` value, so for example:
 * ```sh
 * $ pulumi import gitlab:index/deployKeyEnable:DeployKeyEnable example 12345:67890
 * ```
 * ```sh
 * $ pulumi import gitlab:index/deployKeyEnable:DeployKeyEnable example richardc/example:67890
 * ```
 * @property canPush Can deploy key push to the project's repository.
 * @property key Deploy key.
 * @property keyId The Gitlab key id for the pre-existing deploy key
 * @property project The name or id of the project to add the deploy key to.
 * @property title Deploy key's title.
 */
public data class DeployKeyEnableArgs(
    public val canPush: Output? = null,
    public val key: Output? = null,
    public val keyId: Output? = null,
    public val project: Output? = null,
    public val title: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gitlab.DeployKeyEnableArgs =
        com.pulumi.gitlab.DeployKeyEnableArgs.builder()
            .canPush(canPush?.applyValue({ args0 -> args0 }))
            .key(key?.applyValue({ args0 -> args0 }))
            .keyId(keyId?.applyValue({ args0 -> args0 }))
            .project(project?.applyValue({ args0 -> args0 }))
            .title(title?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [DeployKeyEnableArgs].
 */
@PulumiTagMarker
public class DeployKeyEnableArgsBuilder internal constructor() {
    private var canPush: Output? = null

    private var key: Output? = null

    private var keyId: Output? = null

    private var project: Output? = null

    private var title: Output? = null

    /**
     * @param value Can deploy key push to the project's repository.
     */
    @JvmName("itbgovsiajnqrfei")
    public suspend fun canPush(`value`: Output) {
        this.canPush = value
    }

    /**
     * @param value Deploy key.
     */
    @JvmName("awyrufusmmpdkxyn")
    public suspend fun key(`value`: Output) {
        this.key = value
    }

    /**
     * @param value The Gitlab key id for the pre-existing deploy key
     */
    @JvmName("ddgatejmiyshndkj")
    public suspend fun keyId(`value`: Output) {
        this.keyId = value
    }

    /**
     * @param value The name or id of the project to add the deploy key to.
     */
    @JvmName("dhrfgpqxfsqhqeww")
    public suspend fun project(`value`: Output) {
        this.project = value
    }

    /**
     * @param value Deploy key's title.
     */
    @JvmName("uhvtnjftiihkswbt")
    public suspend fun title(`value`: Output) {
        this.title = value
    }

    /**
     * @param value Can deploy key push to the project's repository.
     */
    @JvmName("dwyhhvaifpentqrd")
    public suspend fun canPush(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.canPush = mapped
    }

    /**
     * @param value Deploy key.
     */
    @JvmName("xntkdyfepprwvdae")
    public suspend fun key(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.key = mapped
    }

    /**
     * @param value The Gitlab key id for the pre-existing deploy key
     */
    @JvmName("dtlvlpwqwgtmkvrg")
    public suspend fun keyId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.keyId = mapped
    }

    /**
     * @param value The name or id of the project to add the deploy key to.
     */
    @JvmName("cuekwfkdjxqufvtr")
    public suspend fun project(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.project = mapped
    }

    /**
     * @param value Deploy key's title.
     */
    @JvmName("jqfwqvrsjmlpxnui")
    public suspend fun title(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.title = mapped
    }

    internal fun build(): DeployKeyEnableArgs = DeployKeyEnableArgs(
        canPush = canPush,
        key = key,
        keyId = keyId,
        project = project,
        title = title,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy