@pulumi/openstack
Version:
A Pulumi package for creating and managing OpenStack cloud resources.
107 lines • 4.68 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.InheritRoleAssignment = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a V3 Inherit Role assignment within OpenStack Keystone. This uses the
* Openstack keystone `OS-INHERIT` api to created inherit roles within domains
* and parent projects for users and groups.
*
* > **Note:** You _must_ have admin privileges in your OpenStack cloud to use
* this resource.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* const user1 = new openstack.identity.User("user_1", {
* name: "user_1",
* domainId: "default",
* });
* const role1 = new openstack.identity.Role("role_1", {
* name: "role_1",
* domainId: "default",
* });
* const roleAssignment1 = new openstack.identity.InheritRoleAssignment("role_assignment_1", {
* userId: user1.id,
* domainId: "default",
* roleId: role1.id,
* });
* ```
*
* ## Import
*
* Inherit role assignments can be imported using a constructed id. The id should
* have the form of `domainID/projectID/groupID/userID/roleID`. When something is
* not used then leave blank.
*
* For example this will import the inherit role assignment for:
* projectID: 014395cd-89fc-4c9b-96b7-13d1ee79dad2,
* userID: 4142e64b-1b35-44a0-9b1e-5affc7af1106,
* roleID: ea257959-eeb1-4c10-8d33-26f0409a755d
* ( domainID and groupID are left blank)
*
* ```sh
* $ pulumi import openstack:identity/inheritRoleAssignment:InheritRoleAssignment role_assignment_1 /014395cd-89fc-4c9b-96b7-13d1ee79dad2//4142e64b-1b35-44a0-9b1e-5affc7af1106/ea257959-eeb1-4c10-8d33-26f0409a755d
* ```
*/
class InheritRoleAssignment extends pulumi.CustomResource {
/**
* Get an existing InheritRoleAssignment 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 InheritRoleAssignment(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of InheritRoleAssignment. 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'] === InheritRoleAssignment.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["domainId"] = state ? state.domainId : undefined;
resourceInputs["groupId"] = state ? state.groupId : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["roleId"] = state ? state.roleId : undefined;
resourceInputs["userId"] = state ? state.userId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.roleId === undefined) && !opts.urn) {
throw new Error("Missing required property 'roleId'");
}
resourceInputs["domainId"] = args ? args.domainId : undefined;
resourceInputs["groupId"] = args ? args.groupId : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["roleId"] = args ? args.roleId : undefined;
resourceInputs["userId"] = args ? args.userId : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(InheritRoleAssignment.__pulumiType, name, resourceInputs, opts);
}
}
exports.InheritRoleAssignment = InheritRoleAssignment;
/** @internal */
InheritRoleAssignment.__pulumiType = 'openstack:identity/inheritRoleAssignment:InheritRoleAssignment';
//# sourceMappingURL=inheritRoleAssignment.js.map