@ediri/vultr
Version:
A Pulumi package for creating and managing Vultr cloud resources.
98 lines • 3.95 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.DnsRecord = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides a Vultr DNS Record resource. This can be used to create, read, modify, and delete DNS Records.
*
* ## Example Usage
*
* Create a new DNS Record
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vultr from "@ediri/vultr";
*
* const myDomain = new vultr.DnsDomain("myDomain", {
* domain: "domain.com",
* ip: "66.42.94.227",
* });
* const myRecord = new vultr.DnsRecord("myRecord", {
* data: "66.42.94.227",
* domain: myDomain.id,
* type: "A",
* });
* ```
*
* ## Import
*
* DNS Records can be imported using the Dns Domain `domain` and DNS Record `ID` e.g.
*
* ```sh
* $ pulumi import vultr:index/dnsRecord:DnsRecord rec domain.com,1a0019bd-7645-4310-81bd-03bc5906940f
* ```
*/
class DnsRecord extends pulumi.CustomResource {
/**
* Get an existing DnsRecord 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 DnsRecord(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of DnsRecord. 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'] === DnsRecord.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["data"] = state ? state.data : undefined;
resourceInputs["domain"] = state ? state.domain : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["priority"] = state ? state.priority : undefined;
resourceInputs["ttl"] = state ? state.ttl : undefined;
resourceInputs["type"] = state ? state.type : undefined;
}
else {
const args = argsOrState;
if ((!args || args.data === undefined) && !opts.urn) {
throw new Error("Missing required property 'data'");
}
if ((!args || args.domain === undefined) && !opts.urn) {
throw new Error("Missing required property 'domain'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["data"] = args ? args.data : undefined;
resourceInputs["domain"] = args ? args.domain : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["priority"] = args ? args.priority : undefined;
resourceInputs["ttl"] = args ? args.ttl : undefined;
resourceInputs["type"] = args ? args.type : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(DnsRecord.__pulumiType, name, resourceInputs, opts);
}
}
exports.DnsRecord = DnsRecord;
/** @internal */
DnsRecord.__pulumiType = 'vultr:index/dnsRecord:DnsRecord';
//# sourceMappingURL=dnsRecord.js.map