UNPKG

@pulumi/digitalocean

Version:

A Pulumi package for creating and managing DigitalOcean cloud resources.

117 lines 5.28 kB
"use strict"; // *** 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, 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["domain"] = state ? state.domain : undefined; resourceInputs["flags"] = state ? state.flags : undefined; resourceInputs["fqdn"] = state ? state.fqdn : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["port"] = state ? state.port : undefined; resourceInputs["priority"] = state ? state.priority : undefined; resourceInputs["tag"] = state ? state.tag : undefined; resourceInputs["ttl"] = state ? state.ttl : undefined; resourceInputs["type"] = state ? state.type : undefined; resourceInputs["value"] = state ? state.value : undefined; resourceInputs["weight"] = state ? state.weight : undefined; } else { const args = argsOrState; 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'"); } if ((!args || args.value === undefined) && !opts.urn) { throw new Error("Missing required property 'value'"); } resourceInputs["domain"] = args ? args.domain : undefined; resourceInputs["flags"] = args ? args.flags : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["port"] = args ? args.port : undefined; resourceInputs["priority"] = args ? args.priority : undefined; resourceInputs["tag"] = args ? args.tag : undefined; resourceInputs["ttl"] = args ? args.ttl : undefined; resourceInputs["type"] = args ? args.type : undefined; resourceInputs["value"] = args ? args.value : undefined; resourceInputs["weight"] = args ? args.weight : undefined; 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