@pulumi/linode
Version:
A Pulumi package for creating and managing linode cloud resources.
111 lines • 4.72 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.DomainRecord = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides a Linode Domain Record resource. This can be used to create, modify, and delete Linodes Domain Records.
* For more information, see [DNS Manager](https://www.linode.com/docs/platform/manager/dns-manager/) and the [Linode APIv4 docs](https://techdocs.akamai.com/linode-api/reference/post-domain-record).
*
* ## Example Usage
*
* The following example shows how one might use this resource to configure a Domain Record attached to a Linode Domain.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const foobar = new linode.Domain("foobar", {
* type: "master",
* domain: "foobar.example",
* soaEmail: "example@foobar.example",
* });
* const foobarDomainRecord = new linode.DomainRecord("foobar", {
* domainId: foobar.id,
* name: "www",
* recordType: "CNAME",
* target: "foobar.example",
* });
* ```
*
* ## Import
*
* Linodes Domain Records can be imported using the Linode Domain `id` followed by the Domain Record `id` separated by a comma, e.g.
*
* ```sh
* $ pulumi import linode:index/domainRecord:DomainRecord www-foobar 1234567,7654321
* ```
*/
class DomainRecord extends pulumi.CustomResource {
/**
* Get an existing DomainRecord 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 DomainRecord(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of DomainRecord. 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'] === DomainRecord.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["domainId"] = state?.domainId;
resourceInputs["name"] = state?.name;
resourceInputs["port"] = state?.port;
resourceInputs["priority"] = state?.priority;
resourceInputs["protocol"] = state?.protocol;
resourceInputs["recordType"] = state?.recordType;
resourceInputs["service"] = state?.service;
resourceInputs["tag"] = state?.tag;
resourceInputs["target"] = state?.target;
resourceInputs["ttlSec"] = state?.ttlSec;
resourceInputs["weight"] = state?.weight;
}
else {
const args = argsOrState;
if (args?.domainId === undefined && !opts.urn) {
throw new Error("Missing required property 'domainId'");
}
if (args?.recordType === undefined && !opts.urn) {
throw new Error("Missing required property 'recordType'");
}
if (args?.target === undefined && !opts.urn) {
throw new Error("Missing required property 'target'");
}
resourceInputs["domainId"] = args?.domainId;
resourceInputs["name"] = args?.name;
resourceInputs["port"] = args?.port;
resourceInputs["priority"] = args?.priority;
resourceInputs["protocol"] = args?.protocol;
resourceInputs["recordType"] = args?.recordType;
resourceInputs["service"] = args?.service;
resourceInputs["tag"] = args?.tag;
resourceInputs["target"] = args?.target;
resourceInputs["ttlSec"] = args?.ttlSec;
resourceInputs["weight"] = args?.weight;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(DomainRecord.__pulumiType, name, resourceInputs, opts);
}
}
exports.DomainRecord = DomainRecord;
/** @internal */
DomainRecord.__pulumiType = 'linode:index/domainRecord:DomainRecord';
//# sourceMappingURL=domainRecord.js.map
;