@pulumi/linode
Version:
A Pulumi package for creating and managing linode cloud resources.
111 lines • 5.21 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** 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, Object.assign(Object.assign({}, 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 ? state.domainId : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["port"] = state ? state.port : undefined;
resourceInputs["priority"] = state ? state.priority : undefined;
resourceInputs["protocol"] = state ? state.protocol : undefined;
resourceInputs["recordType"] = state ? state.recordType : undefined;
resourceInputs["service"] = state ? state.service : undefined;
resourceInputs["tag"] = state ? state.tag : undefined;
resourceInputs["target"] = state ? state.target : undefined;
resourceInputs["ttlSec"] = state ? state.ttlSec : undefined;
resourceInputs["weight"] = state ? state.weight : undefined;
}
else {
const args = argsOrState;
if ((!args || args.domainId === undefined) && !opts.urn) {
throw new Error("Missing required property 'domainId'");
}
if ((!args || args.recordType === undefined) && !opts.urn) {
throw new Error("Missing required property 'recordType'");
}
if ((!args || args.target === undefined) && !opts.urn) {
throw new Error("Missing required property 'target'");
}
resourceInputs["domainId"] = args ? args.domainId : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["port"] = args ? args.port : undefined;
resourceInputs["priority"] = args ? args.priority : undefined;
resourceInputs["protocol"] = args ? args.protocol : undefined;
resourceInputs["recordType"] = args ? args.recordType : undefined;
resourceInputs["service"] = args ? args.service : undefined;
resourceInputs["tag"] = args ? args.tag : undefined;
resourceInputs["target"] = args ? args.target : undefined;
resourceInputs["ttlSec"] = args ? args.ttlSec : undefined;
resourceInputs["weight"] = args ? args.weight : undefined;
}
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