UNPKG

@pulumi/hcloud

Version:

A Pulumi package for creating and managing hcloud cloud resources.

121 lines 5.2 kB
"use strict"; // *** 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.PrimaryIp = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Provides a Hetzner Cloud Primary IP to represent a publicly-accessible static IP address that can be mapped to one of your servers. * * If a server is getting created, it has to have a primary ip. If a server is getting created without defining primary ips, two of them (one ipv4 and one ipv6) getting created & attached. * Currently, Primary IPs can be only attached to servers. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as hcloud from "@pulumi/hcloud"; * * const main = new hcloud.PrimaryIp("main", { * name: "primary_ip_test", * datacenter: "fsn1-dc14", * type: "ipv4", * assigneeType: "server", * autoDelete: true, * labels: { * hallo: "welt", * }, * }); * // Link a server to a primary IP * const serverTest = new hcloud.Server("server_test", { * name: "test-server", * image: "ubuntu-20.04", * serverType: "cx22", * datacenter: "fsn1-dc14", * labels: { * test: "tessst1", * }, * publicNets: [{ * ipv4: main.id, * }], * }); * ``` * * ## Import * * Primary IPs can be imported using its `id`: * * ```sh * $ pulumi import hcloud:index/primaryIp:PrimaryIp example "$PRIMARY_IP_ID" * ``` */ class PrimaryIp extends pulumi.CustomResource { /** * Get an existing PrimaryIp 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 PrimaryIp(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of PrimaryIp. 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'] === PrimaryIp.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["assigneeId"] = state ? state.assigneeId : undefined; resourceInputs["assigneeType"] = state ? state.assigneeType : undefined; resourceInputs["autoDelete"] = state ? state.autoDelete : undefined; resourceInputs["datacenter"] = state ? state.datacenter : undefined; resourceInputs["deleteProtection"] = state ? state.deleteProtection : undefined; resourceInputs["ipAddress"] = state ? state.ipAddress : undefined; resourceInputs["ipNetwork"] = state ? state.ipNetwork : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["type"] = state ? state.type : undefined; } else { const args = argsOrState; if ((!args || args.assigneeType === undefined) && !opts.urn) { throw new Error("Missing required property 'assigneeType'"); } if ((!args || args.autoDelete === undefined) && !opts.urn) { throw new Error("Missing required property 'autoDelete'"); } if ((!args || args.type === undefined) && !opts.urn) { throw new Error("Missing required property 'type'"); } resourceInputs["assigneeId"] = args ? args.assigneeId : undefined; resourceInputs["assigneeType"] = args ? args.assigneeType : undefined; resourceInputs["autoDelete"] = args ? args.autoDelete : undefined; resourceInputs["datacenter"] = args ? args.datacenter : undefined; resourceInputs["deleteProtection"] = args ? args.deleteProtection : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["type"] = args ? args.type : undefined; resourceInputs["ipAddress"] = undefined /*out*/; resourceInputs["ipNetwork"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(PrimaryIp.__pulumiType, name, resourceInputs, opts); } } exports.PrimaryIp = PrimaryIp; /** @internal */ PrimaryIp.__pulumiType = 'hcloud:index/primaryIp:PrimaryIp'; //# sourceMappingURL=primaryIp.js.map