@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
151 lines • 7.38 kB
JavaScript
;
// *** 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.FoldersPolicyBinding = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* ## Example Usage
*
* ### Iam Folders Policy Binding
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as time from "@pulumi/time";
*
* const pabPolicy = new gcp.iam.PrincipalAccessBoundaryPolicy("pab_policy", {
* organization: "123456789",
* location: "global",
* displayName: "binding for all principals in the folder",
* principalAccessBoundaryPolicyId: "my-pab-policy",
* });
* const folder = new gcp.organizations.Folder("folder", {
* displayName: "my folder",
* parent: "organizations/123456789",
* deletionProtection: false,
* });
* const wait120s = new time.index.Sleep("wait_120s", {createDuration: "120s"}, {
* dependsOn: [folder],
* });
* const binding_for_all_folder_principals = new gcp.iam.FoldersPolicyBinding("binding-for-all-folder-principals", {
* folder: folder.folderId,
* location: "global",
* displayName: "binding for all principals in the folder",
* policyKind: "PRINCIPAL_ACCESS_BOUNDARY",
* policyBindingId: "binding-for-all-folder-principals",
* policy: pulumi.interpolate`organizations/123456789/locations/global/principalAccessBoundaryPolicies/${pabPolicy.principalAccessBoundaryPolicyId}`,
* target: {
* principalSet: pulumi.interpolate`//cloudresourcemanager.googleapis.com/folders/${folder.folderId}`,
* },
* }, {
* dependsOn: [wait120s],
* });
* ```
*
* ## Import
*
* FoldersPolicyBinding can be imported using any of these accepted formats:
*
* * `folders/{{folder}}/locations/{{location}}/policyBindings/{{policy_binding_id}}`
*
* * `{{folder}}/{{location}}/{{policy_binding_id}}`
*
* When using the `pulumi import` command, FoldersPolicyBinding can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:iam/foldersPolicyBinding:FoldersPolicyBinding default folders/{{folder}}/locations/{{location}}/policyBindings/{{policy_binding_id}}
* ```
*
* ```sh
* $ pulumi import gcp:iam/foldersPolicyBinding:FoldersPolicyBinding default {{folder}}/{{location}}/{{policy_binding_id}}
* ```
*/
class FoldersPolicyBinding extends pulumi.CustomResource {
/**
* Get an existing FoldersPolicyBinding 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 FoldersPolicyBinding(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of FoldersPolicyBinding. 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'] === FoldersPolicyBinding.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["annotations"] = state ? state.annotations : undefined;
resourceInputs["condition"] = state ? state.condition : undefined;
resourceInputs["createTime"] = state ? state.createTime : undefined;
resourceInputs["displayName"] = state ? state.displayName : undefined;
resourceInputs["effectiveAnnotations"] = state ? state.effectiveAnnotations : undefined;
resourceInputs["etag"] = state ? state.etag : undefined;
resourceInputs["folder"] = state ? state.folder : undefined;
resourceInputs["location"] = state ? state.location : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["policy"] = state ? state.policy : undefined;
resourceInputs["policyBindingId"] = state ? state.policyBindingId : undefined;
resourceInputs["policyKind"] = state ? state.policyKind : undefined;
resourceInputs["policyUid"] = state ? state.policyUid : undefined;
resourceInputs["target"] = state ? state.target : undefined;
resourceInputs["uid"] = state ? state.uid : undefined;
resourceInputs["updateTime"] = state ? state.updateTime : undefined;
}
else {
const args = argsOrState;
if ((!args || args.folder === undefined) && !opts.urn) {
throw new Error("Missing required property 'folder'");
}
if ((!args || args.location === undefined) && !opts.urn) {
throw new Error("Missing required property 'location'");
}
if ((!args || args.policy === undefined) && !opts.urn) {
throw new Error("Missing required property 'policy'");
}
if ((!args || args.policyBindingId === undefined) && !opts.urn) {
throw new Error("Missing required property 'policyBindingId'");
}
if ((!args || args.target === undefined) && !opts.urn) {
throw new Error("Missing required property 'target'");
}
resourceInputs["annotations"] = args ? args.annotations : undefined;
resourceInputs["condition"] = args ? args.condition : undefined;
resourceInputs["displayName"] = args ? args.displayName : undefined;
resourceInputs["folder"] = args ? args.folder : undefined;
resourceInputs["location"] = args ? args.location : undefined;
resourceInputs["policy"] = args ? args.policy : undefined;
resourceInputs["policyBindingId"] = args ? args.policyBindingId : undefined;
resourceInputs["policyKind"] = args ? args.policyKind : undefined;
resourceInputs["target"] = args ? args.target : undefined;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["effectiveAnnotations"] = undefined /*out*/;
resourceInputs["etag"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["policyUid"] = undefined /*out*/;
resourceInputs["uid"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(FoldersPolicyBinding.__pulumiType, name, resourceInputs, opts);
}
}
exports.FoldersPolicyBinding = FoldersPolicyBinding;
/** @internal */
FoldersPolicyBinding.__pulumiType = 'gcp:iam/foldersPolicyBinding:FoldersPolicyBinding';
//# sourceMappingURL=foldersPolicyBinding.js.map