com.pulumi.gitlab.DeployKeyEnable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gitlab Show documentation
Show all versions of gitlab Show documentation
A Pulumi package for creating and managing GitLab resources.
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.gitlab;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import com.pulumi.gitlab.DeployKeyEnableArgs;
import com.pulumi.gitlab.Utilities;
import com.pulumi.gitlab.inputs.DeployKeyEnableState;
import java.lang.Boolean;
import java.lang.String;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* 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
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* 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());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## 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
* ```
*
*/
@ResourceType(type="gitlab:index/deployKeyEnable:DeployKeyEnable")
public class DeployKeyEnable extends com.pulumi.resources.CustomResource {
/**
* Can deploy key push to the project's repository.
*
*/
@Export(name="canPush", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> canPush;
/**
* @return Can deploy key push to the project's repository.
*
*/
public Output> canPush() {
return Codegen.optional(this.canPush);
}
/**
* Deploy key.
*
*/
@Export(name="key", refs={String.class}, tree="[0]")
private Output key;
/**
* @return Deploy key.
*
*/
public Output key() {
return this.key;
}
/**
* The Gitlab key id for the pre-existing deploy key
*
*/
@Export(name="keyId", refs={String.class}, tree="[0]")
private Output keyId;
/**
* @return The Gitlab key id for the pre-existing deploy key
*
*/
public Output keyId() {
return this.keyId;
}
/**
* The name or id of the project to add the deploy key to.
*
*/
@Export(name="project", refs={String.class}, tree="[0]")
private Output project;
/**
* @return The name or id of the project to add the deploy key to.
*
*/
public Output project() {
return this.project;
}
/**
* Deploy key's title.
*
*/
@Export(name="title", refs={String.class}, tree="[0]")
private Output title;
/**
* @return Deploy key's title.
*
*/
public Output title() {
return this.title;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public DeployKeyEnable(java.lang.String name) {
this(name, DeployKeyEnableArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public DeployKeyEnable(java.lang.String name, DeployKeyEnableArgs args) {
this(name, args, null);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
* @param options A bag of options that control this resource's behavior.
*/
public DeployKeyEnable(java.lang.String name, DeployKeyEnableArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("gitlab:index/deployKeyEnable:DeployKeyEnable", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private DeployKeyEnable(java.lang.String name, Output id, @Nullable DeployKeyEnableState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("gitlab:index/deployKeyEnable:DeployKeyEnable", name, state, makeResourceOptions(options, id), false);
}
private static DeployKeyEnableArgs makeArgs(DeployKeyEnableArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? DeployKeyEnableArgs.Empty : args;
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) {
var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
.version(Utilities.getVersion())
.build();
return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
}
/**
* Get an existing Host resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state
* @param options Optional settings to control the behavior of the CustomResource.
*/
public static DeployKeyEnable get(java.lang.String name, Output id, @Nullable DeployKeyEnableState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new DeployKeyEnable(name, id, state, options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy