@mapped/pulumi-astra
Version:
A Pulumi package for creating and managing astra cloud resources.
122 lines • 5.58 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.Role = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* `astra.Role` resource represents custom roles for a particular Astra Org. Custom roles can be assigned to an Astra user is to grant them granular permissions when the default roles in the UI are not specific enough. Roles are composed of policies which are granted to resources.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as astra from "@pulumi/astra";
*
* const example = new astra.Role("example", {
* description: "test role",
* effect: "allow",
* policies: ["db-all-keyspace-create"],
* resources: ["drn:astra:org:f9f4b1e0-4c05-451e-9bba-d631295a7f73"],
* roleName: "puppies",
* });
* const example2 = new astra.Role("example2", {
* description: "complex role",
* effect: "allow",
* policies: [
* "accesslist-read",
* "db-all-keyspace-describe",
* "db-keyspace-describe",
* "db-table-select",
* "db-table-describe",
* "db-graphql",
* "db-rest",
* "db-cql",
* ],
* resources: [
* "drn:astra:org:f9f4b1e0-4c05-451e-9bba-d631295a7f73",
* "drn:astra:org:f9f4b1e0-4c05-451e-9bba-d631295a7f73:db:5b70892f-e01a-4595-98e6-19ecc9985d50",
* "drn:astra:org:f9f4b1e0-4c05-451e-9bba-d631295a7f73:db:5b70892f-e01a-4595-98e6-19ecc9985d50:keyspace:system_schema:table:*",
* "drn:astra:org:f9f4b1e0-4c05-451e-9bba-d631295a7f73:db:5b70892f-e01a-4595-98e6-19ecc9985d50:keyspace:system:table:*",
* "drn:astra:org:f9f4b1e0-4c05-451e-9bba-d631295a7f73:db:5b70892f-e01a-4595-98e6-19ecc9985d50:keyspace:system_virtual_schema:table:*",
* "drn:astra:org:f9f4b1e0-4c05-451e-9bba-d631295a7f73:db:5b70892f-e01a-4595-98e6-19ecc9985d50:keyspace:*",
* "drn:astra:org:f9f4b1e0-4c05-451e-9bba-d631295a7f73:db:5b70892f-e01a-4595-98e6-19ecc9985d50:keyspace:*:table:*",
* ],
* roleName: "puppies",
* });
* ```
*
* ## Import
*
* ```sh
* $ pulumi import astra:index/role:Role example role-id
* ```
*/
class Role extends pulumi.CustomResource {
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["effect"] = state ? state.effect : undefined;
resourceInputs["policies"] = state ? state.policies : undefined;
resourceInputs["resources"] = state ? state.resources : undefined;
resourceInputs["roleId"] = state ? state.roleId : undefined;
resourceInputs["roleName"] = state ? state.roleName : undefined;
}
else {
const args = argsOrState;
if ((!args || args.description === undefined) && !opts.urn) {
throw new Error("Missing required property 'description'");
}
if ((!args || args.effect === undefined) && !opts.urn) {
throw new Error("Missing required property 'effect'");
}
if ((!args || args.policies === undefined) && !opts.urn) {
throw new Error("Missing required property 'policies'");
}
if ((!args || args.resources === undefined) && !opts.urn) {
throw new Error("Missing required property 'resources'");
}
if ((!args || args.roleName === undefined) && !opts.urn) {
throw new Error("Missing required property 'roleName'");
}
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["effect"] = args ? args.effect : undefined;
resourceInputs["policies"] = args ? args.policies : undefined;
resourceInputs["resources"] = args ? args.resources : undefined;
resourceInputs["roleName"] = args ? args.roleName : undefined;
resourceInputs["roleId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Role.__pulumiType, name, resourceInputs, opts);
}
/**
* Get an existing Role 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 Role(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Role. 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'] === Role.__pulumiType;
}
}
exports.Role = Role;
/** @internal */
Role.__pulumiType = 'astra:index/role:Role';
//# sourceMappingURL=role.js.map