
com.pulumi.github.RepositoryDeployKey Maven / Gradle / Ivy
// *** 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
* ```java
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* 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) {
* var exampleRepositoryDeployKey = new RepositoryDeployKey("exampleRepositoryDeployKey", RepositoryDeployKeyArgs.builder()
* .key("ssh-rsa AAA...")
* .readOnly("false")
* .repository("test-repo")
* .title("Repository test key")
* .build());
*
* }
* }
* ```
*
* ## 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", type=String.class, parameters={})
private Output etag;
public Output etag() {
return this.etag;
}
/**
* A SSH key.
*
*/
@Export(name="key", type=String.class, parameters={})
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", type=Boolean.class, parameters={})
private Output* @Nullable */ Boolean> 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", type=String.class, parameters={})
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", type=String.class, parameters={})
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(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(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(String name, RepositoryDeployKeyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("github:index/repositoryDeployKey:RepositoryDeployKey", name, args == null ? RepositoryDeployKeyArgs.Empty : args, makeResourceOptions(options, Codegen.empty()));
}
private RepositoryDeployKey(String name, Output id, @Nullable RepositoryDeployKeyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("github:index/repositoryDeployKey:RepositoryDeployKey", name, state, makeResourceOptions(options, id));
}
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(String name, Output id, @Nullable RepositoryDeployKeyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new RepositoryDeployKey(name, id, state, options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy