@pulumi/digitalocean
Version:
A Pulumi package for creating and managing DigitalOcean cloud resources.
117 lines • 4.83 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 DigitalOcean DNS record resource.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const _default = new digitalocean.Domain("default", {name: "example.com"});
* // Add an A record to the domain for www.example.com.
* const www = new digitalocean.DnsRecord("www", {
* domain: _default.id,
* type: digitalocean.RecordType.A,
* name: "www",
* value: "192.168.0.11",
* });
* // Add a MX record for the example.com domain itself.
* const mx = new digitalocean.DnsRecord("mx", {
* domain: _default.id,
* type: digitalocean.RecordType.MX,
* name: "@",
* priority: 10,
* value: "mail.example.com.",
* });
* export const wwwFqdn = www.fqdn;
* export const mxFqdn = mx.fqdn;
* ```
*
* ## Import
*
* Records can be imported using the domain name and record `id` when joined with a comma. See the following example:
*
* ```sh
* $ pulumi import digitalocean:index/dnsRecord:DnsRecord example_record example.com,12345678
* ```
*
* ~> You find the `id` of the records [using the DigitalOcean API](https://docs.digitalocean.com/reference/api/digitalocean/#tag/Domain-Records/operation/domains_list_records) or CLI. Run the follow command to list the IDs for all DNS records on a domain: `doctl compute domain records list <domain.name>`
*/
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, { ...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["domain"] = state?.domain;
resourceInputs["flags"] = state?.flags;
resourceInputs["fqdn"] = state?.fqdn;
resourceInputs["name"] = state?.name;
resourceInputs["port"] = state?.port;
resourceInputs["priority"] = state?.priority;
resourceInputs["tag"] = state?.tag;
resourceInputs["ttl"] = state?.ttl;
resourceInputs["type"] = state?.type;
resourceInputs["value"] = state?.value;
resourceInputs["weight"] = state?.weight;
}
else {
const args = argsOrState;
if (args?.domain === undefined && !opts.urn) {
throw new Error("Missing required property 'domain'");
}
if (args?.type === undefined && !opts.urn) {
throw new Error("Missing required property 'type'");
}
if (args?.value === undefined && !opts.urn) {
throw new Error("Missing required property 'value'");
}
resourceInputs["domain"] = args?.domain;
resourceInputs["flags"] = args?.flags;
resourceInputs["name"] = args?.name;
resourceInputs["port"] = args?.port;
resourceInputs["priority"] = args?.priority;
resourceInputs["tag"] = args?.tag;
resourceInputs["ttl"] = args?.ttl;
resourceInputs["type"] = args?.type;
resourceInputs["value"] = args?.value;
resourceInputs["weight"] = args?.weight;
resourceInputs["fqdn"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(DnsRecord.__pulumiType, name, resourceInputs, opts);
}
}
exports.DnsRecord = DnsRecord;
/** @internal */
DnsRecord.__pulumiType = 'digitalocean:index/dnsRecord:DnsRecord';
//# sourceMappingURL=dnsRecord.js.map