@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
108 lines • 4.35 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.SshPublicKey = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* The SSH public key information associated with a Google account.
*
* To get more information about SSHPublicKey, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/oslogin/rest/v1/users.sshPublicKeys)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/compute/docs/oslogin)
*
* ## Example Usage
*
* ### Os Login Ssh Key Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as std from "@pulumi/std";
*
* const me = gcp.organizations.getClientOpenIdUserInfo({});
* const cache = new gcp.oslogin.SshPublicKey("cache", {
* user: me.then(me => me.email),
* key: std.file({
* input: "path/to/id_rsa.pub",
* }).then(invoke => invoke.result),
* });
* ```
*
* ## Import
*
* SSHPublicKey can be imported using any of these accepted formats:
*
* * `users/{{user}}/sshPublicKeys/{{fingerprint}}`
*
* * `{{user}}/{{fingerprint}}`
*
* When using the `pulumi import` command, SSHPublicKey can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:oslogin/sshPublicKey:SshPublicKey default users/{{user}}/sshPublicKeys/{{fingerprint}}
* ```
*
* ```sh
* $ pulumi import gcp:oslogin/sshPublicKey:SshPublicKey default {{user}}/{{fingerprint}}
* ```
*/
class SshPublicKey extends pulumi.CustomResource {
/**
* Get an existing SshPublicKey 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 SshPublicKey(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of SshPublicKey. 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'] === SshPublicKey.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["expirationTimeUsec"] = state ? state.expirationTimeUsec : undefined;
resourceInputs["fingerprint"] = state ? state.fingerprint : undefined;
resourceInputs["key"] = state ? state.key : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["user"] = state ? state.user : undefined;
}
else {
const args = argsOrState;
if ((!args || args.key === undefined) && !opts.urn) {
throw new Error("Missing required property 'key'");
}
if ((!args || args.user === undefined) && !opts.urn) {
throw new Error("Missing required property 'user'");
}
resourceInputs["expirationTimeUsec"] = args ? args.expirationTimeUsec : undefined;
resourceInputs["key"] = args ? args.key : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["user"] = args ? args.user : undefined;
resourceInputs["fingerprint"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(SshPublicKey.__pulumiType, name, resourceInputs, opts);
}
}
exports.SshPublicKey = SshPublicKey;
/** @internal */
SshPublicKey.__pulumiType = 'gcp:oslogin/sshPublicKey:SshPublicKey';
//# sourceMappingURL=sshPublicKey.js.map