UNPKG

@pulumi/gcp

Version:

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

178 lines 7.3 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.FolderSettings = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Manages Cloud Observability settings for a folder. * * > **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. * See Provider Versions for more details on beta resources. * * ## Example Usage * * ### Observability Folder Settings Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * import * as time from "@pulumiverse/time"; * * const testFolder = new gcp.organizations.Folder("test_folder", { * displayName: "tf-test-_76273", * parent: "organizations/123456789", * deletionProtection: false, * }); * // Wait for the folder to be created and recognized by the Observability API * const waitForSettingsPropagation = new time.Sleep("wait_for_settings_propagation", {createDuration: "90s"}, { * dependsOn: [testFolder], * }); * const settingsData = gcp.observability.getFolderSettingsOutput({ * folder: testFolder.folderId, * location: "us", * }); * // Add a delay to allow the service account to propagate * const waitForSaPropagation = new time.Sleep("wait_for_sa_propagation", {createDuration: "90s"}, { * dependsOn: [settingsData], * }); * const iam = new gcp.kms.CryptoKeyIAMMember("iam", { * cryptoKeyId: "example-key", * role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", * member: settingsData.apply(settingsData => `serviceAccount:${settingsData.serviceAccountId}`), * }, { * dependsOn: [waitForSaPropagation], * }); * const primary = new gcp.observability.FolderSettings("primary", { * location: "us", * folder: testFolder.folderId, * kmsKeyName: "example-key", * }, { * dependsOn: [iam], * }); * ``` * ### Observability Folder Settings Basic Global * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * import * as time from "@pulumiverse/time"; * * const testFolder = new gcp.organizations.Folder("test_folder", { * displayName: "tf-test-_25601", * parent: "organizations/123456789", * deletionProtection: false, * }); * // Wait for the folder to be created and recognized by the Observability API * const waitForFolder = new time.Sleep("wait_for_folder", {createDuration: "90s"}, { * dependsOn: [testFolder], * }); * const settingsData = gcp.observability.getFolderSettingsOutput({ * folder: testFolder.folderId, * location: "global", * }); * const primaryGlobal = new gcp.observability.FolderSettings("primary_global", { * location: "global", * folder: testFolder.folderId, * defaultStorageLocation: "us", * }, { * dependsOn: [settingsData], * }); * ``` * * ## Import * * FolderSettings can be imported using any of these accepted formats: * * * `folders/{{folder}}/locations/{{location}}/settings` * * `{{folder}}/{{location}}` * * When using the `pulumi import` command, FolderSettings can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:observability/folderSettings:FolderSettings default folders/{{folder}}/locations/{{location}}/settings * $ pulumi import gcp:observability/folderSettings:FolderSettings default {{folder}}/{{location}} * ``` */ class FolderSettings extends pulumi.CustomResource { /** * Get an existing FolderSettings 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 FolderSettings(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:observability/folderSettings:FolderSettings'; /** * Returns true if the given object is an instance of FolderSettings. 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'] === FolderSettings.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["defaultStorageLocation"] = state?.defaultStorageLocation; resourceInputs["folder"] = state?.folder; resourceInputs["kmsKeyName"] = state?.kmsKeyName; resourceInputs["location"] = state?.location; resourceInputs["name"] = state?.name; resourceInputs["serviceAccountId"] = state?.serviceAccountId; } else { const args = argsOrState; if (args?.folder === undefined && !opts.urn) { throw new Error("Missing required property 'folder'"); } if (args?.location === undefined && !opts.urn) { throw new Error("Missing required property 'location'"); } resourceInputs["defaultStorageLocation"] = args?.defaultStorageLocation; resourceInputs["folder"] = args?.folder; resourceInputs["kmsKeyName"] = args?.kmsKeyName; resourceInputs["location"] = args?.location; resourceInputs["name"] = undefined /*out*/; resourceInputs["serviceAccountId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(FolderSettings.__pulumiType, name, resourceInputs, opts); } } exports.FolderSettings = FolderSettings; //# sourceMappingURL=folderSettings.js.map