@pulumi/hcloud
Version:
A Pulumi package for creating and managing hcloud cloud resources.
165 lines • 6.21 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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Rdns = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("./utilities"));
/**
* Provides Hetzner Cloud reverse DNS (rDNS) entries for Servers, Primary IPs, Floating IPs or Load Balancers.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as hcloud from "@pulumi/hcloud";
*
* // For Servers
* const server1 = new hcloud.Server("server1", {name: "server1"});
* const server1Rdns = new hcloud.Rdns("server1", {
* serverId: server1.id.apply(x =>Number(x)),
* ipAddress: server1.ipv4Address,
* dnsPtr: "example.com",
* });
* // For Primary IPs
* const primaryIp1 = new hcloud.PrimaryIp("primary_ip1", {
* name: "primary_ip1",
* type: "ipv4",
* });
* const primaryIp1Rdns = new hcloud.Rdns("primary_ip1", {
* primaryIpId: primaryIp1.id.apply(x =>Number(x)),
* ipAddress: primaryIp1.ipAddress,
* dnsPtr: "example.com",
* });
* // For Floating IPs
* const floatingIp1 = new hcloud.FloatingIp("floating_ip1", {
* name: "floating_ip1",
* type: "ipv4",
* });
* const floatingIp1Rdns = new hcloud.Rdns("floating_ip1", {
* floatingIpId: floatingIp1.id.apply(x =>Number(x)),
* ipAddress: floatingIp1.ipAddress,
* dnsPtr: "example.com",
* });
* // For Load Balancers
* const loadBalancer1 = new hcloud.LoadBalancer("load_balancer1", {name: "load_balancer1"});
* const loadBalancer1Rdns = new hcloud.Rdns("load_balancer1", {
* loadBalancerId: loadBalancer1.id.apply(x =>Number(x)),
* ipAddress: loadBalancer1.ipv4,
* dnsPtr: "example.com",
* });
* ```
*
* ## Import
*
* The `pulumi import` command can be used, for example:
*
* ```sh
* $ pulumi import hcloud:index/rdns:Rdns example "$RESOURCE_PREFIX-$ID-$IP"
* ```
*
* A Server with id 132022102 and ip 203.0.113.10
*
* ```sh
* $ pulumi import hcloud:index/rdns:Rdns server1 "s-132022102-203.0.113.10"
* ```
*
* A Primary IP with id 582026301 and ip 2001:db8::1
*
* ```sh
* $ pulumi import hcloud:index/rdns:Rdns primary_ip1 "p-582026301-2001:db8::1"
* ```
*
* A Floating IP with id 912300308 and ip 2001:db8::1
*
* ```sh
* $ pulumi import hcloud:index/rdns:Rdns floating_ip1 "f-912300308-2001:db8::1"
* ```
*
* A Load Balancer with id 747590326 and ip 203.0.113.25
*
* ```sh
* $ pulumi import hcloud:index/rdns:Rdns load_balancer1 "l-747590326-203.0.113.25"
* ```
*/
class Rdns extends pulumi.CustomResource {
/**
* Get an existing Rdns 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 Rdns(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'hcloud:index/rdns:Rdns';
/**
* Returns true if the given object is an instance of Rdns. 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'] === Rdns.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["dnsPtr"] = state?.dnsPtr;
resourceInputs["floatingIpId"] = state?.floatingIpId;
resourceInputs["ipAddress"] = state?.ipAddress;
resourceInputs["loadBalancerId"] = state?.loadBalancerId;
resourceInputs["primaryIpId"] = state?.primaryIpId;
resourceInputs["serverId"] = state?.serverId;
}
else {
const args = argsOrState;
if (args?.dnsPtr === undefined && !opts.urn) {
throw new Error("Missing required property 'dnsPtr'");
}
if (args?.ipAddress === undefined && !opts.urn) {
throw new Error("Missing required property 'ipAddress'");
}
resourceInputs["dnsPtr"] = args?.dnsPtr;
resourceInputs["floatingIpId"] = args?.floatingIpId;
resourceInputs["ipAddress"] = args?.ipAddress;
resourceInputs["loadBalancerId"] = args?.loadBalancerId;
resourceInputs["primaryIpId"] = args?.primaryIpId;
resourceInputs["serverId"] = args?.serverId;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Rdns.__pulumiType, name, resourceInputs, opts);
}
}
exports.Rdns = Rdns;
//# sourceMappingURL=rdns.js.map