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

com.pulumi.github.RepositoryDeployKey Maven / Gradle / Ivy

There is a newer version: 6.4.0-alpha.1731735876
Show newest version
// *** 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.github;

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.github.RepositoryDeployKeyArgs;
import com.pulumi.github.Utilities;
import com.pulumi.github.inputs.RepositoryDeployKeyState;
import java.lang.Boolean;
import java.lang.String;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Provides a GitHub repository deploy key resource.
 * 
 * A deploy key is an SSH key that is stored on your server and grants
 * access to a single GitHub repository. This key is attached directly to the repository instead of to a personal user
 * account.
 * 
 * This resource allows you to add/remove repository deploy keys.
 * 
 * Further documentation on GitHub repository deploy keys:
 * - [About deploy keys](https://developer.github.com/guides/managing-deploy-keys/#deploy-keys)
 * 
 * ## Example Usage
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.tls.PrivateKey;
 * import com.pulumi.tls.PrivateKeyArgs;
 * import com.pulumi.github.RepositoryDeployKey;
 * import com.pulumi.github.RepositoryDeployKeyArgs;
 * 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) {
 *         // Generate an ssh key using provider "hashicorp/tls"
 *         var exampleRepositoryDeployKey = new PrivateKey("exampleRepositoryDeployKey", PrivateKeyArgs.builder()
 *             .algorithm("ED25519")
 *             .build());
 * 
 *         // Add the ssh key as a deploy key
 *         var exampleRepositoryDeployKeyRepositoryDeployKey = new RepositoryDeployKey("exampleRepositoryDeployKeyRepositoryDeployKey", RepositoryDeployKeyArgs.builder()
 *             .title("Repository test key")
 *             .repository("test-repo")
 *             .key(exampleRepositoryDeployKey.publicKeyOpenssh())
 *             .readOnly(true)
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Import * * Repository deploy keys can be imported using a colon-separated pair of repository name * and GitHub's key id. The latter can be obtained by GitHub's SDKs and API. * * ```sh * $ pulumi import github:index/repositoryDeployKey:RepositoryDeployKey foo test-repo:23824728 * ``` * */ @ResourceType(type="github:index/repositoryDeployKey:RepositoryDeployKey") public class RepositoryDeployKey extends com.pulumi.resources.CustomResource { @Export(name="etag", refs={String.class}, tree="[0]") private Output etag; public Output etag() { return this.etag; } /** * A SSH key. * */ @Export(name="key", refs={String.class}, tree="[0]") private Output key; /** * @return A SSH key. * */ public Output key() { return this.key; } /** * A boolean qualifying the key to be either read only or read/write. * */ @Export(name="readOnly", refs={Boolean.class}, tree="[0]") private Output readOnly; /** * @return A boolean qualifying the key to be either read only or read/write. * */ public Output> readOnly() { return Codegen.optional(this.readOnly); } /** * Name of the GitHub repository. * */ @Export(name="repository", refs={String.class}, tree="[0]") private Output repository; /** * @return Name of the GitHub repository. * */ public Output repository() { return this.repository; } /** * A title. * * Changing any of the fields forces re-creating the resource. * */ @Export(name="title", refs={String.class}, tree="[0]") private Output title; /** * @return A title. * * Changing any of the fields forces re-creating the resource. * */ public Output title() { return this.title; } /** * * @param name The _unique_ name of the resulting resource. */ public RepositoryDeployKey(java.lang.String name) { this(name, RepositoryDeployKeyArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public RepositoryDeployKey(java.lang.String name, RepositoryDeployKeyArgs 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 RepositoryDeployKey(java.lang.String name, RepositoryDeployKeyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("github:index/repositoryDeployKey:RepositoryDeployKey", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private RepositoryDeployKey(java.lang.String name, Output id, @Nullable RepositoryDeployKeyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("github:index/repositoryDeployKey:RepositoryDeployKey", name, state, makeResourceOptions(options, id), false); } private static RepositoryDeployKeyArgs makeArgs(RepositoryDeployKeyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? RepositoryDeployKeyArgs.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 RepositoryDeployKey get(java.lang.String name, Output id, @Nullable RepositoryDeployKeyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new RepositoryDeployKey(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy