@pulumi/linode
Version:
A Pulumi package for creating and managing linode cloud resources.
93 lines • 4.18 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.DatabaseAccessControls = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages the access control for a Linode Database. Only one `linode.DatabaseAccessControls` resource should be defined per-database.
* For more information, see the Linode APIv4 docs for [MySQL](https://techdocs.akamai.com/linode-api/reference/put-databases-mysql-instance) and [PostgreSQL](https://techdocs.akamai.com/linode-api/reference/put-databases-postgre-sql-instance).
*
* ## Example Usage
*
* Grant a Linode access to a database:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const my_instance = new linode.Instance("my-instance", {
* label: "myinstance",
* region: "us-southeast",
* type: "g6-nanode-1",
* image: "linode/alpine3.19",
* });
* const my_db = new linode.DatabaseMysql("my-db", {
* label: "mydatabase",
* engineId: "mysql/8.0.30",
* region: "us-southeast",
* type: "g6-nanode-1",
* });
* const my_access = new linode.DatabaseAccessControls("my-access", {
* databaseId: my_db.id,
* databaseType: "mysql",
* allowLists: [my_instance.ipAddress],
* });
* ```
*/
class DatabaseAccessControls extends pulumi.CustomResource {
/**
* Get an existing DatabaseAccessControls 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 DatabaseAccessControls(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of DatabaseAccessControls. 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'] === DatabaseAccessControls.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["allowLists"] = state ? state.allowLists : undefined;
resourceInputs["databaseId"] = state ? state.databaseId : undefined;
resourceInputs["databaseType"] = state ? state.databaseType : undefined;
}
else {
const args = argsOrState;
if ((!args || args.allowLists === undefined) && !opts.urn) {
throw new Error("Missing required property 'allowLists'");
}
if ((!args || args.databaseId === undefined) && !opts.urn) {
throw new Error("Missing required property 'databaseId'");
}
if ((!args || args.databaseType === undefined) && !opts.urn) {
throw new Error("Missing required property 'databaseType'");
}
resourceInputs["allowLists"] = args ? args.allowLists : undefined;
resourceInputs["databaseId"] = args ? args.databaseId : undefined;
resourceInputs["databaseType"] = args ? args.databaseType : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(DatabaseAccessControls.__pulumiType, name, resourceInputs, opts);
}
}
exports.DatabaseAccessControls = DatabaseAccessControls;
/** @internal */
DatabaseAccessControls.__pulumiType = 'linode:index/databaseAccessControls:DatabaseAccessControls';
//# sourceMappingURL=databaseAccessControls.js.map
;