UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

96 lines 4.07 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** 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"); /** * Uploads an SSH public key and associates it with the specified IAM user. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const user = new aws.iam.User("user", { * name: "test-user", * path: "/", * }); * const userSshKey = new aws.iam.SshKey("user", { * username: user.name, * encoding: "SSH", * publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 mytest@mydomain.com", * }); * ``` * * ## Import * * Using `pulumi import`, import SSH public keys using the `username`, `ssh_public_key_id`, and `encoding`. For example: * * ```sh * $ pulumi import aws:iam/sshKey:SshKey user user:APKAJNCNNJICVN7CFKCA:SSH * ``` */ 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, { ...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["encoding"] = state?.encoding; resourceInputs["fingerprint"] = state?.fingerprint; resourceInputs["publicKey"] = state?.publicKey; resourceInputs["sshPublicKeyId"] = state?.sshPublicKeyId; resourceInputs["status"] = state?.status; resourceInputs["username"] = state?.username; } else { const args = argsOrState; if (args?.encoding === undefined && !opts.urn) { throw new Error("Missing required property 'encoding'"); } if (args?.publicKey === undefined && !opts.urn) { throw new Error("Missing required property 'publicKey'"); } if (args?.username === undefined && !opts.urn) { throw new Error("Missing required property 'username'"); } resourceInputs["encoding"] = args?.encoding; resourceInputs["publicKey"] = args?.publicKey; resourceInputs["status"] = args?.status; resourceInputs["username"] = args?.username; resourceInputs["fingerprint"] = undefined /*out*/; resourceInputs["sshPublicKeyId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(SshKey.__pulumiType, name, resourceInputs, opts); } } exports.SshKey = SshKey; /** @internal */ SshKey.__pulumiType = 'aws:iam/sshKey:SshKey'; //# sourceMappingURL=sshKey.js.map