@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
104 lines • 5.11 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.Folder = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Allows management of a Google Cloud Platform folder. For more information see
* [the official documentation](https://cloud.google.com/resource-manager/docs/creating-managing-folders)
* and
* [API](https://cloud.google.com/resource-manager/reference/rest/v2/folders).
*
* A folder can contain projects, other folders, or a combination of both. You can use folders to group projects under an organization in a hierarchy. For example, your organization might contain multiple departments, each with its own set of Cloud Platform resources. Folders allows you to group these resources on a per-department basis. Folders are used to group resources that share common IAM policies.
*
* Folders created live inside an Organization. See the [Organization documentation](https://cloud.google.com/resource-manager/docs/quickstarts) for more details.
*
* The service account used to run the provider when creating a `gcp.organizations.Folder`
* resource must have `roles/resourcemanager.folderCreator`. See the
* [Access Control for Folders Using IAM](https://cloud.google.com/resource-manager/docs/access-control-folders)
* doc for more information.
*
* > It may take a while for the attached tag bindings to be deleted after the folder is scheduled to be deleted.
*
* ## Import
*
* Folders can be imported using the folder's id, e.g.
*
* * `folders/{{folder_id}}`
*
* * `{{folder_id}}`
*
* When using the `pulumi import` command, Folders can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:organizations/folder:Folder default {{folder_id}}
* ```
*
* ```sh
* $ pulumi import gcp:organizations/folder:Folder default folders/{{folder_id}}
* ```
*/
class Folder extends pulumi.CustomResource {
/**
* Get an existing Folder 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 Folder(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Folder. 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'] === Folder.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["createTime"] = state ? state.createTime : undefined;
resourceInputs["deletionProtection"] = state ? state.deletionProtection : undefined;
resourceInputs["displayName"] = state ? state.displayName : undefined;
resourceInputs["folderId"] = state ? state.folderId : undefined;
resourceInputs["lifecycleState"] = state ? state.lifecycleState : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["parent"] = state ? state.parent : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
}
else {
const args = argsOrState;
if ((!args || args.displayName === undefined) && !opts.urn) {
throw new Error("Missing required property 'displayName'");
}
if ((!args || args.parent === undefined) && !opts.urn) {
throw new Error("Missing required property 'parent'");
}
resourceInputs["deletionProtection"] = args ? args.deletionProtection : undefined;
resourceInputs["displayName"] = args ? args.displayName : undefined;
resourceInputs["parent"] = args ? args.parent : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["folderId"] = undefined /*out*/;
resourceInputs["lifecycleState"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Folder.__pulumiType, name, resourceInputs, opts);
}
}
exports.Folder = Folder;
/** @internal */
Folder.__pulumiType = 'gcp:organizations/folder:Folder';
//# sourceMappingURL=folder.js.map