@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
114 lines • 4.68 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.Permission = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages the usage permissions of those resources: `huaweicloud.Dli.Queue`, `huaweicloud.Dli.Database`,
* `huaweicloud.Dli.Table`, `huaweicloud.Dli.Package`, `huaweicloud.Dli.FlinksqlJob`, `huaweicloud.Dli.FlinkjarJob`
* within HuaweiCloud DLI.
*
* ## Example Usage
* ### Grant a permission of queue
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const userName = config.requireObject("userName");
* const queueName = config.requireObject("queueName");
* const test = new huaweicloud.dli.Permission("test", {
* userName: userName,
* object: `queues.${queueName}`,
* privileges: [
* "SUBMIT_JOB",
* "DROP_QUEUE",
* ],
* });
* ```
* ### Grant a permission of database
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const userName = config.requireObject("userName");
* const databaseName = config.requireObject("databaseName");
* const test = new huaweicloud.dli.Permission("test", {
* userName: userName,
* object: `databases.${databaseName}`,
* privileges: ["SELECT"],
* });
* ```
*
* ## Import
*
* The permission can be imported by `id`, it is composed of `object` and `user_name`, separated by a slash. e.g.bash
*
* ```sh
* $ pulumi import huaweicloud:Dli/permission:Permission test databases.database_name/user_name
* ```
*/
class Permission extends pulumi.CustomResource {
/**
* Get an existing Permission 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 Permission(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Permission. 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'] === Permission.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["isAdmin"] = state ? state.isAdmin : undefined;
resourceInputs["object"] = state ? state.object : undefined;
resourceInputs["privileges"] = state ? state.privileges : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["userName"] = state ? state.userName : undefined;
}
else {
const args = argsOrState;
if ((!args || args.object === undefined) && !opts.urn) {
throw new Error("Missing required property 'object'");
}
if ((!args || args.privileges === undefined) && !opts.urn) {
throw new Error("Missing required property 'privileges'");
}
if ((!args || args.userName === undefined) && !opts.urn) {
throw new Error("Missing required property 'userName'");
}
resourceInputs["object"] = args ? args.object : undefined;
resourceInputs["privileges"] = args ? args.privileges : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["userName"] = args ? args.userName : undefined;
resourceInputs["isAdmin"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Permission.__pulumiType, name, resourceInputs, opts);
}
}
exports.Permission = Permission;
/** @internal */
Permission.__pulumiType = 'huaweicloud:Dli/permission:Permission';
//# sourceMappingURL=permission.js.map