UNPKG

@lbrlabs/pulumi-harness

Version:

A Pulumi package for creating and managing Harness resources.

166 lines 6.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.RoleAssignments = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Resource for creating role assignments in Harness. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as harness from "@lbrlabs/pulumi-harness"; * * //To create a role binding in service account * const example1RoleAssignments = new harness.platform.RoleAssignments("example1RoleAssignments", { * orgId: "org_id", * projectId: "project_id", * resourceGroupIdentifier: "_all_project_level_resources", * roleIdentifier: "_project_viewer", * principals: [{ * identifier: harness_platform_service_account.test.id, * type: "SERVICE_ACCOUNT", * }], * disabled: false, * managed: false, * }); * //To create a role binding in user group * const example1Platform_roleAssignmentsRoleAssignments = new harness.platform.RoleAssignments("example1Platform/roleAssignmentsRoleAssignments", { * orgId: "org_id", * projectId: "project_id", * resourceGroupIdentifier: "_all_project_level_resources", * roleIdentifier: "_project_viewer", * principals: [{ * identifier: harness_platform_usergroup.test.id, * type: "USER_GROUP", * }], * disabled: false, * managed: false, * }); * const example2RoleAssignments = new harness.platform.RoleAssignments("example2RoleAssignments", { * identifier: "identifier", * orgId: "org_id", * projectId: "project_id", * resourceGroupIdentifier: "_all_project_level_resources", * roleIdentifier: "_project_viewer", * principals: [{ * identifier: "user_id", * type: "USER", * }], * disabled: false, * managed: false, * }); * const example2Platform_roleAssignmentsRoleAssignments = new harness.platform.RoleAssignments("example2Platform/roleAssignmentsRoleAssignments", { * orgId: "org_id", * projectId: "project_id", * resourceGroupIdentifier: "_all_project_level_resources", * roleIdentifier: "_project_viewer", * principals: [{ * identifier: "service_id", * type: "SERVICE", * }], * disabled: false, * managed: false, * }); * const example2HarnessPlatform_roleAssignmentsRoleAssignments = new harness.platform.RoleAssignments("example2HarnessPlatform/roleAssignmentsRoleAssignments", { * orgId: "org_id", * projectId: "project_id", * resourceGroupIdentifier: "_all_project_level_resources", * roleIdentifier: "_project_viewer", * principals: [{ * identifier: "api_key_id", * type: "API_KEY", * }], * disabled: false, * managed: false, * }); * ``` * * ## Import * * Import account level role assignments * * ```sh * $ pulumi import harness:platform/roleAssignments:RoleAssignments example <role_assignments_id> * ``` * * Import org level role assignments * * ```sh * $ pulumi import harness:platform/roleAssignments:RoleAssignments example <ord_id>/<role_assignments_id> * ``` * * Import project level role assignments * * ```sh * $ pulumi import harness:platform/roleAssignments:RoleAssignments example <org_id>/<project_id>/<role_assignments_id> * ``` */ class RoleAssignments extends pulumi.CustomResource { /** * Get an existing RoleAssignments 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 RoleAssignments(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of RoleAssignments. 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'] === RoleAssignments.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["disabled"] = state ? state.disabled : undefined; resourceInputs["identifier"] = state ? state.identifier : undefined; resourceInputs["managed"] = state ? state.managed : undefined; resourceInputs["orgId"] = state ? state.orgId : undefined; resourceInputs["principals"] = state ? state.principals : undefined; resourceInputs["projectId"] = state ? state.projectId : undefined; resourceInputs["resourceGroupIdentifier"] = state ? state.resourceGroupIdentifier : undefined; resourceInputs["roleIdentifier"] = state ? state.roleIdentifier : undefined; } else { const args = argsOrState; if ((!args || args.principals === undefined) && !opts.urn) { throw new Error("Missing required property 'principals'"); } if ((!args || args.resourceGroupIdentifier === undefined) && !opts.urn) { throw new Error("Missing required property 'resourceGroupIdentifier'"); } if ((!args || args.roleIdentifier === undefined) && !opts.urn) { throw new Error("Missing required property 'roleIdentifier'"); } resourceInputs["disabled"] = args ? args.disabled : undefined; resourceInputs["identifier"] = args ? args.identifier : undefined; resourceInputs["managed"] = args ? args.managed : undefined; resourceInputs["orgId"] = args ? args.orgId : undefined; resourceInputs["principals"] = args ? args.principals : undefined; resourceInputs["projectId"] = args ? args.projectId : undefined; resourceInputs["resourceGroupIdentifier"] = args ? args.resourceGroupIdentifier : undefined; resourceInputs["roleIdentifier"] = args ? args.roleIdentifier : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(RoleAssignments.__pulumiType, name, resourceInputs, opts); } } exports.RoleAssignments = RoleAssignments; /** @internal */ RoleAssignments.__pulumiType = 'harness:platform/roleAssignments:RoleAssignments'; //# sourceMappingURL=roleAssignments.js.map