@pulumi/openstack
Version:
A Pulumi package for creating and managing OpenStack cloud resources.
112 lines • 4.97 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.RbacPolicyV2 = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* The RBAC policy resource contains functionality for working with Neutron RBAC
* Policies. Role-Based Access Control (RBAC) policy framework enables both
* operators and users to grant access to resources for specific projects.
*
* Sharing an object with a specific project is accomplished by creating a
* policy entry that permits the target project the `accessAsShared` action
* on that object.
*
* To make a network available as an external network for specific projects
* rather than all projects, use the `accessAsExternal` action.
* If a network is marked as external during creation, it now implicitly creates
* a wildcard RBAC policy granting everyone access to preserve previous behavior
* before this feature was added.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* const network1 = new openstack.networking.Network("network_1", {
* name: "network_1",
* adminStateUp: true,
* });
* const rbacPolicy1 = new openstack.networking.RbacPolicyV2("rbac_policy_1", {
* action: "access_as_shared",
* objectId: network1.id,
* objectType: "network",
* targetTenant: "20415a973c9e45d3917f078950644697",
* });
* ```
*
* ## Import
*
* RBAC policies can be imported using the `id`, e.g.
*
* ```sh
* $ pulumi import openstack:networking/rbacPolicyV2:RbacPolicyV2 rbac_policy_1 eae26a3e-1c33-4cc1-9c31-0cd729c438a1
* ```
*/
class RbacPolicyV2 extends pulumi.CustomResource {
/**
* Get an existing RbacPolicyV2 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 RbacPolicyV2(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of RbacPolicyV2. 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'] === RbacPolicyV2.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["action"] = state ? state.action : undefined;
resourceInputs["objectId"] = state ? state.objectId : undefined;
resourceInputs["objectType"] = state ? state.objectType : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["targetTenant"] = state ? state.targetTenant : undefined;
}
else {
const args = argsOrState;
if ((!args || args.action === undefined) && !opts.urn) {
throw new Error("Missing required property 'action'");
}
if ((!args || args.objectId === undefined) && !opts.urn) {
throw new Error("Missing required property 'objectId'");
}
if ((!args || args.objectType === undefined) && !opts.urn) {
throw new Error("Missing required property 'objectType'");
}
if ((!args || args.targetTenant === undefined) && !opts.urn) {
throw new Error("Missing required property 'targetTenant'");
}
resourceInputs["action"] = args ? args.action : undefined;
resourceInputs["objectId"] = args ? args.objectId : undefined;
resourceInputs["objectType"] = args ? args.objectType : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["targetTenant"] = args ? args.targetTenant : undefined;
resourceInputs["projectId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(RbacPolicyV2.__pulumiType, name, resourceInputs, opts);
}
}
exports.RbacPolicyV2 = RbacPolicyV2;
/** @internal */
RbacPolicyV2.__pulumiType = 'openstack:networking/rbacPolicyV2:RbacPolicyV2';
//# sourceMappingURL=rbacPolicyV2.js.map