@twingate/pulumi-twingate
Version:
A Pulumi package for creating and managing Twingate cloud resources.
104 lines • 4.17 kB
JavaScript
;
// *** 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.TwingateGateway = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Gateways are the Twingate components that route traffic to remote networks.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as std from "@pulumi/std";
* import * as twingate from "@twingate/pulumi-twingate";
*
* const gcp = new twingate.TwingateRemoteNetwork("gcp", {name: "GCP Network"});
* const tls = new twingate.TwingateX509CertificateAuthority("tls", {
* name: "My TLS CA",
* certificate: std.file({
* input: "ca.pem",
* }).then(invoke => invoke.result),
* });
* const ssh = new twingate.TwingateSSHCertificateAuthority("ssh", {
* name: "My SSH CA",
* publicKey: std.file({
* input: "~/.ssh/id_ed25519.pub",
* }).then(invoke => std.trimspace({
* input: invoke.result,
* })).then(invoke => invoke.result),
* });
* // Gateway with both X.509 and SSH CAs
* const main = new twingate.TwingateGateway("main", {
* remoteNetworkId: gcp.id,
* address: "10.0.0.1:8443",
* x509CaId: tls.id,
* sshCaId: ssh.id,
* });
* // Gateway with only X.509 CA (ssh_ca_id is optional)
* const minimal = new twingate.TwingateGateway("minimal", {
* remoteNetworkId: gcp.id,
* address: "10.0.0.2:9001",
* x509CaId: tls.id,
* });
* ```
*/
class TwingateGateway extends pulumi.CustomResource {
/**
* Get an existing TwingateGateway 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 TwingateGateway(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of TwingateGateway. 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'] === TwingateGateway.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["address"] = state?.address;
resourceInputs["remoteNetworkId"] = state?.remoteNetworkId;
resourceInputs["sshCaId"] = state?.sshCaId;
resourceInputs["x509CaId"] = state?.x509CaId;
}
else {
const args = argsOrState;
if (args?.address === undefined && !opts.urn) {
throw new Error("Missing required property 'address'");
}
if (args?.remoteNetworkId === undefined && !opts.urn) {
throw new Error("Missing required property 'remoteNetworkId'");
}
if (args?.x509CaId === undefined && !opts.urn) {
throw new Error("Missing required property 'x509CaId'");
}
resourceInputs["address"] = args?.address;
resourceInputs["remoteNetworkId"] = args?.remoteNetworkId;
resourceInputs["sshCaId"] = args?.sshCaId;
resourceInputs["x509CaId"] = args?.x509CaId;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(TwingateGateway.__pulumiType, name, resourceInputs, opts);
}
}
exports.TwingateGateway = TwingateGateway;
/** @internal */
TwingateGateway.__pulumiType = 'twingate:index/twingateGateway:TwingateGateway';
//# sourceMappingURL=twingateGateway.js.map