UNPKG

@lbrlabs/pulumi-scaleway

Version:

A Pulumi package for creating and managing scaleway cloud resources.

114 lines 4.98 kB
"use strict"; // *** 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.DatabasePrivilege = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Create and manage Scaleway RDB database privilege. * For more information, see [the documentation](https://developers.scaleway.com/en/products/rdb/api/#user-and-permissions). * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@lbrlabs/pulumi-scaleway"; * * const mainDatabaseInstance = new scaleway.DatabaseInstance("mainDatabaseInstance", { * nodeType: "DB-DEV-S", * engine: "PostgreSQL-11", * isHaCluster: true, * disableBackup: true, * userName: "my_initial_user", * password: "thiZ_is_v&ry_s3cret", * }); * const mainDatabase = new scaleway.Database("mainDatabase", {instanceId: mainDatabaseInstance.id}); * const mainDatabaseUser = new scaleway.DatabaseUser("mainDatabaseUser", { * instanceId: mainDatabaseInstance.id, * password: "thiZ_is_v&ry_s3cret", * isAdmin: false, * }); * const mainDatabasePrivilege = new scaleway.DatabasePrivilege("mainDatabasePrivilege", { * instanceId: mainDatabaseInstance.id, * userName: "my-db-user", * databaseName: "my-db-name", * permission: "all", * }, { * dependsOn: [ * mainDatabaseUser, * mainDatabase, * ], * }); * ``` * * ## Import * * The user privileges can be imported using the `{region}/{instance_id}/{database_name}/{user_name}`, e.g. bash * * ```sh * $ pulumi import scaleway:index/databasePrivilege:DatabasePrivilege o fr-par/11111111-1111-1111-1111-111111111111/database_name/foo * ``` */ class DatabasePrivilege extends pulumi.CustomResource { /** * Get an existing DatabasePrivilege 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 DatabasePrivilege(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of DatabasePrivilege. 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'] === DatabasePrivilege.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["databaseName"] = state ? state.databaseName : undefined; resourceInputs["instanceId"] = state ? state.instanceId : undefined; resourceInputs["permission"] = state ? state.permission : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["userName"] = state ? state.userName : undefined; } else { const args = argsOrState; if ((!args || args.databaseName === undefined) && !opts.urn) { throw new Error("Missing required property 'databaseName'"); } if ((!args || args.instanceId === undefined) && !opts.urn) { throw new Error("Missing required property 'instanceId'"); } if ((!args || args.permission === undefined) && !opts.urn) { throw new Error("Missing required property 'permission'"); } if ((!args || args.userName === undefined) && !opts.urn) { throw new Error("Missing required property 'userName'"); } resourceInputs["databaseName"] = args ? args.databaseName : undefined; resourceInputs["instanceId"] = args ? args.instanceId : undefined; resourceInputs["permission"] = args ? args.permission : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["userName"] = args ? args.userName : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(DatabasePrivilege.__pulumiType, name, resourceInputs, opts); } } exports.DatabasePrivilege = DatabasePrivilege; /** @internal */ DatabasePrivilege.__pulumiType = 'scaleway:index/databasePrivilege:DatabasePrivilege'; //# sourceMappingURL=databasePrivilege.js.map