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

com.pulumi.digitalocean.SshKey Maven / Gradle / Ivy

There is a newer version: 4.35.0
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.digitalocean;

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.digitalocean.SshKeyArgs;
import com.pulumi.digitalocean.Utilities;
import com.pulumi.digitalocean.inputs.SshKeyState;
import java.lang.String;
import javax.annotation.Nullable;

/**
 * Provides a DigitalOcean SSH key resource to allow you to manage SSH
 * keys for Droplet access. Keys created with this resource
 * can be referenced in your Droplet configuration via their ID or
 * fingerprint.
 * 
 * ## Example Usage
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.digitalocean.SshKey;
 * import com.pulumi.digitalocean.SshKeyArgs;
 * import com.pulumi.digitalocean.Droplet;
 * import com.pulumi.digitalocean.DropletArgs;
 * 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) {
 *         // Create a new SSH key
 *         var default_ = new SshKey("default", SshKeyArgs.builder()
 *             .name("Example")
 *             .publicKey(StdFunctions.file(FileArgs.builder()
 *                 .input("/Users/myuser/.ssh/id_rsa.pub")
 *                 .build()).result())
 *             .build());
 * 
 *         // Create a new Droplet using the SSH key
 *         var web = new Droplet("web", DropletArgs.builder()
 *             .image("ubuntu-18-04-x64")
 *             .name("web-1")
 *             .region("nyc3")
 *             .size("s-1vcpu-1gb")
 *             .sshKeys(default_.fingerprint())
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Import * * SSH Keys can be imported using the `ssh key id`, e.g. * * ```sh * $ pulumi import digitalocean:index/sshKey:SshKey mykey 263654 * ``` * */ @ResourceType(type="digitalocean:index/sshKey:SshKey") public class SshKey extends com.pulumi.resources.CustomResource { /** * The fingerprint of the SSH key * */ @Export(name="fingerprint", refs={String.class}, tree="[0]") private Output fingerprint; /** * @return The fingerprint of the SSH key * */ public Output fingerprint() { return this.fingerprint; } /** * The name of the SSH key for identification * */ @Export(name="name", refs={String.class}, tree="[0]") private Output name; /** * @return The name of the SSH key for identification * */ public Output name() { return this.name; } /** * The public key. If this is a file, it * can be read using the file interpolation function * */ @Export(name="publicKey", refs={String.class}, tree="[0]") private Output publicKey; /** * @return The public key. If this is a file, it * can be read using the file interpolation function * */ public Output publicKey() { return this.publicKey; } /** * * @param name The _unique_ name of the resulting resource. */ public SshKey(java.lang.String name) { this(name, SshKeyArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public SshKey(java.lang.String name, SshKeyArgs 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 SshKey(java.lang.String name, SshKeyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("digitalocean:index/sshKey:SshKey", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private SshKey(java.lang.String name, Output id, @Nullable SshKeyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("digitalocean:index/sshKey:SshKey", name, state, makeResourceOptions(options, id), false); } private static SshKeyArgs makeArgs(SshKeyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? SshKeyArgs.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 SshKey get(java.lang.String name, Output id, @Nullable SshKeyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new SshKey(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy