UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

191 lines • 8.69 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Entitlement = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * An Entitlement defines the eligibility of a set of users to obtain a predefined access for some time possibly after going through an approval workflow. * * To get more information about Entitlement, see: * * * [API documentation](https://cloud.google.com/iam/docs/reference/pam/rest) * * How-to Guides * * [How to create an Entitlement](https://cloud.google.com/iam/docs/pam-create-entitlements) * * [Official Documentation](https://cloud.google.com/iam/docs/pam-overview) * * ## Example Usage * * ### Privileged Access Manager Entitlement Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const tfentitlement = new gcp.privilegedaccessmanager.Entitlement("tfentitlement", { * entitlementId: "example-entitlement", * location: "global", * maxRequestDuration: "43200s", * parent: "projects/my-project-name", * requesterJustificationConfig: { * unstructured: {}, * }, * eligibleUsers: [{ * principals: ["group:test@google.com"], * }], * privilegedAccess: { * gcpIamAccess: { * roleBindings: [{ * role: "roles/storage.admin", * conditionExpression: "request.time < timestamp(\"2024-04-23T18:30:00.000Z\")", * }], * resource: "//cloudresourcemanager.googleapis.com/projects/my-project-name", * resourceType: "cloudresourcemanager.googleapis.com/Project", * }, * }, * additionalNotificationTargets: { * adminEmailRecipients: ["user@example.com"], * requesterEmailRecipients: ["user@example.com"], * }, * approvalWorkflow: { * manualApprovals: { * requireApproverJustification: true, * steps: [{ * approvalsNeeded: 1, * approverEmailRecipients: ["user@example.com"], * approvers: { * principals: ["group:test@google.com"], * }, * }], * }, * }, * }); * ``` * * ## Import * * Entitlement can be imported using any of these accepted formats: * * * `{{parent}}/locations/{{location}}/entitlements/{{entitlement_id}}` * * When using the `pulumi import` command, Entitlement can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:privilegedaccessmanager/entitlement:entitlement default {{parent}}/locations/{{location}}/entitlements/{{entitlement_id}} * ``` */ class Entitlement extends pulumi.CustomResource { /** * Get an existing Entitlement 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 Entitlement(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:privilegedaccessmanager/entitlement:entitlement'; /** * Returns true if the given object is an instance of Entitlement. 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'] === Entitlement.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["additionalNotificationTargets"] = state?.additionalNotificationTargets; resourceInputs["approvalWorkflow"] = state?.approvalWorkflow; resourceInputs["createTime"] = state?.createTime; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["eligibleUsers"] = state?.eligibleUsers; resourceInputs["entitlementId"] = state?.entitlementId; resourceInputs["etag"] = state?.etag; resourceInputs["location"] = state?.location; resourceInputs["maxRequestDuration"] = state?.maxRequestDuration; resourceInputs["name"] = state?.name; resourceInputs["parent"] = state?.parent; resourceInputs["privilegedAccess"] = state?.privilegedAccess; resourceInputs["requesterJustificationConfig"] = state?.requesterJustificationConfig; resourceInputs["state"] = state?.state; resourceInputs["updateTime"] = state?.updateTime; } else { const args = argsOrState; if (args?.eligibleUsers === undefined && !opts.urn) { throw new Error("Missing required property 'eligibleUsers'"); } if (args?.entitlementId === undefined && !opts.urn) { throw new Error("Missing required property 'entitlementId'"); } if (args?.location === undefined && !opts.urn) { throw new Error("Missing required property 'location'"); } if (args?.maxRequestDuration === undefined && !opts.urn) { throw new Error("Missing required property 'maxRequestDuration'"); } if (args?.parent === undefined && !opts.urn) { throw new Error("Missing required property 'parent'"); } if (args?.privilegedAccess === undefined && !opts.urn) { throw new Error("Missing required property 'privilegedAccess'"); } if (args?.requesterJustificationConfig === undefined && !opts.urn) { throw new Error("Missing required property 'requesterJustificationConfig'"); } resourceInputs["additionalNotificationTargets"] = args?.additionalNotificationTargets; resourceInputs["approvalWorkflow"] = args?.approvalWorkflow; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["eligibleUsers"] = args?.eligibleUsers; resourceInputs["entitlementId"] = args?.entitlementId; resourceInputs["location"] = args?.location; resourceInputs["maxRequestDuration"] = args?.maxRequestDuration; resourceInputs["parent"] = args?.parent; resourceInputs["privilegedAccess"] = args?.privilegedAccess; resourceInputs["requesterJustificationConfig"] = args?.requesterJustificationConfig; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["etag"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; resourceInputs["state"] = undefined /*out*/; resourceInputs["updateTime"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Entitlement.__pulumiType, name, resourceInputs, opts); } } exports.Entitlement = Entitlement; //# sourceMappingURL=entitlement.js.map