UNPKG

@pulumi/gcp

Version:

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

166 lines • 8.04 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.Entitlement = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = 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, Object.assign(Object.assign({}, opts), { id: id })); } /** * 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 ? state.additionalNotificationTargets : undefined; resourceInputs["approvalWorkflow"] = state ? state.approvalWorkflow : undefined; resourceInputs["createTime"] = state ? state.createTime : undefined; resourceInputs["eligibleUsers"] = state ? state.eligibleUsers : undefined; resourceInputs["entitlementId"] = state ? state.entitlementId : undefined; resourceInputs["etag"] = state ? state.etag : undefined; resourceInputs["location"] = state ? state.location : undefined; resourceInputs["maxRequestDuration"] = state ? state.maxRequestDuration : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["parent"] = state ? state.parent : undefined; resourceInputs["privilegedAccess"] = state ? state.privilegedAccess : undefined; resourceInputs["requesterJustificationConfig"] = state ? state.requesterJustificationConfig : undefined; resourceInputs["state"] = state ? state.state : undefined; resourceInputs["updateTime"] = state ? state.updateTime : undefined; } else { const args = argsOrState; if ((!args || args.eligibleUsers === undefined) && !opts.urn) { throw new Error("Missing required property 'eligibleUsers'"); } if ((!args || args.entitlementId === undefined) && !opts.urn) { throw new Error("Missing required property 'entitlementId'"); } if ((!args || args.location === undefined) && !opts.urn) { throw new Error("Missing required property 'location'"); } if ((!args || args.maxRequestDuration === undefined) && !opts.urn) { throw new Error("Missing required property 'maxRequestDuration'"); } if ((!args || args.parent === undefined) && !opts.urn) { throw new Error("Missing required property 'parent'"); } if ((!args || args.privilegedAccess === undefined) && !opts.urn) { throw new Error("Missing required property 'privilegedAccess'"); } if ((!args || args.requesterJustificationConfig === undefined) && !opts.urn) { throw new Error("Missing required property 'requesterJustificationConfig'"); } resourceInputs["additionalNotificationTargets"] = args ? args.additionalNotificationTargets : undefined; resourceInputs["approvalWorkflow"] = args ? args.approvalWorkflow : undefined; resourceInputs["eligibleUsers"] = args ? args.eligibleUsers : undefined; resourceInputs["entitlementId"] = args ? args.entitlementId : undefined; resourceInputs["location"] = args ? args.location : undefined; resourceInputs["maxRequestDuration"] = args ? args.maxRequestDuration : undefined; resourceInputs["parent"] = args ? args.parent : undefined; resourceInputs["privilegedAccess"] = args ? args.privilegedAccess : undefined; resourceInputs["requesterJustificationConfig"] = args ? args.requesterJustificationConfig : undefined; 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; /** @internal */ Entitlement.__pulumiType = 'gcp:privilegedaccessmanager/entitlement:entitlement'; //# sourceMappingURL=entitlement.js.map