@pulumi/hcloud
Version:
A Pulumi package for creating and managing hcloud cloud resources.
82 lines • 3.18 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.SshKey = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides a Hetzner Cloud SSH Key resource to manage SSH Keys for server access.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as hcloud from "@pulumi/hcloud";
* import * as std from "@pulumi/std";
*
* const main = new hcloud.SshKey("main", {
* name: "my-ssh-key",
* publicKey: std.file({
* input: "~/.ssh/id_ed25519.pub",
* }).then(invoke => invoke.result),
* });
* ```
*
* ## Import
*
* ```sh
* $ pulumi import hcloud:index/sshKey:SshKey example "$SSH_KEY_ID"
* ```
*/
class SshKey extends pulumi.CustomResource {
/**
* Get an existing SshKey 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 Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new SshKey(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of SshKey. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === SshKey.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["fingerprint"] = state ? state.fingerprint : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["publicKey"] = state ? state.publicKey : undefined;
}
else {
const args = argsOrState;
if ((!args || args.publicKey === undefined) && !opts.urn) {
throw new Error("Missing required property 'publicKey'");
}
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["publicKey"] = args ? args.publicKey : undefined;
resourceInputs["fingerprint"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(SshKey.__pulumiType, name, resourceInputs, opts);
}
}
exports.SshKey = SshKey;
/** @internal */
SshKey.__pulumiType = 'hcloud:index/sshKey:SshKey';
//# sourceMappingURL=sshKey.js.map