UNPKG

@pulumi/gcp

Version:

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

153 lines 6.39 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.AccessPolicy = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * AccessPolicy is a container for AccessLevels (which define the necessary * attributes to use GCP services) and ServicePerimeters (which define * regions of services able to freely pass data within a perimeter). An * access policy is globally visible within an organization, and the * restrictions it specifies apply to all projects within an organization. * * To get more information about AccessPolicy, see: * * * [API documentation](https://cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies) * * How-to Guides * * [Access Policy Quickstart](https://cloud.google.com/access-context-manager/docs/quickstart) * * > **Warning:** If you are using User ADCs (Application Default Credentials) with this resource, * you must specify a `billingProject` and set `userProjectOverride` to true * in the provider configuration. Otherwise the ACM API will return a 403 error. * Your account must have the `serviceusage.services.use` permission on the * `billingProject` you defined. * * ## Example Usage * * ### Access Context Manager Access Policy Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const access_policy = new gcp.accesscontextmanager.AccessPolicy("access-policy", { * parent: "organizations/123456789", * title: "Org Access Policy", * }); * ``` * ### Access Context Manager Access Policy Scoped * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = new gcp.organizations.Project("project", { * projectId: "my-project-name", * name: "my-project-name", * orgId: "123456789", * deletionPolicy: "DELETE", * }); * const access_policy = new gcp.accesscontextmanager.AccessPolicy("access-policy", { * parent: "organizations/123456789", * title: "Scoped Access Policy", * scopes: pulumi.interpolate`projects/${project.number}`, * }); * ``` * * ## Import * * AccessPolicy can be imported using any of these accepted formats: * * * `{{name}}` * * When using the `pulumi import` command, AccessPolicy can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:accesscontextmanager/accessPolicy:AccessPolicy default {{name}} * ``` */ class AccessPolicy extends pulumi.CustomResource { /** * Get an existing AccessPolicy 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 AccessPolicy(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:accesscontextmanager/accessPolicy:AccessPolicy'; /** * Returns true if the given object is an instance of AccessPolicy. 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'] === AccessPolicy.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["createTime"] = state?.createTime; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["name"] = state?.name; resourceInputs["parent"] = state?.parent; resourceInputs["scopes"] = state?.scopes; resourceInputs["title"] = state?.title; resourceInputs["updateTime"] = state?.updateTime; } else { const args = argsOrState; if (args?.parent === undefined && !opts.urn) { throw new Error("Missing required property 'parent'"); } if (args?.title === undefined && !opts.urn) { throw new Error("Missing required property 'title'"); } resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["parent"] = args?.parent; resourceInputs["scopes"] = args?.scopes; resourceInputs["title"] = args?.title; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; resourceInputs["updateTime"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(AccessPolicy.__pulumiType, name, resourceInputs, opts); } } exports.AccessPolicy = AccessPolicy; //# sourceMappingURL=accessPolicy.js.map