@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
156 lines • 6.24 kB
JavaScript
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.FolderFeed = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Describes a Cloud Asset Inventory feed used to to listen to asset updates.
*
* To get more information about FolderFeed, see:
*
* * [API documentation](https://cloud.google.com/asset-inventory/docs/reference/rest/)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/asset-inventory/docs)
*
* ## Example Usage
*
* ### Cloud Asset Folder Feed
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* // The topic where the resource change notifications will be sent.
* const feedOutput = new gcp.pubsub.Topic("feed_output", {
* project: "my-project-name",
* name: "network-updates",
* });
* // The folder that will be monitored for resource updates.
* const myFolder = new gcp.organizations.Folder("my_folder", {
* displayName: "Networking",
* parent: "organizations/123456789",
* deletionProtection: false,
* });
* // Create a feed that sends notifications about network resource updates under a
* // particular folder.
* const folderFeed = new gcp.cloudasset.FolderFeed("folder_feed", {
* billingProject: "my-project-name",
* folder: myFolder.folderId,
* feedId: "network-updates",
* contentType: "RESOURCE",
* assetTypes: [
* "compute.googleapis.com/Subnetwork",
* "compute.googleapis.com/Network",
* ],
* feedOutputConfig: {
* pubsubDestination: {
* topic: feedOutput.id,
* },
* },
* condition: {
* expression: `!temporal_asset.deleted &&
* temporal_asset.prior_asset_state == google.cloud.asset.v1.TemporalAsset.PriorAssetState.DOES_NOT_EXIST
* `,
* title: "created",
* description: "Send notifications on creation events",
* },
* });
* // Find the project number of the project whose identity will be used for sending
* // the asset change notifications.
* const project = gcp.organizations.getProject({
* projectId: "my-project-name",
* });
* ```
*
* ## Import
*
* FolderFeed can be imported using any of these accepted formats:
*
* * `folders/{{folder_id}}/feeds/{{name}}`
*
* * `{{folder_id}}/{{name}}`
*
* When using the `pulumi import` command, FolderFeed can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:cloudasset/folderFeed:FolderFeed default folders/{{folder_id}}/feeds/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:cloudasset/folderFeed:FolderFeed default {{folder_id}}/{{name}}
* ```
*/
class FolderFeed extends pulumi.CustomResource {
/**
* Get an existing FolderFeed 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 FolderFeed(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of FolderFeed. 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'] === FolderFeed.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["assetNames"] = state?.assetNames;
resourceInputs["assetTypes"] = state?.assetTypes;
resourceInputs["billingProject"] = state?.billingProject;
resourceInputs["condition"] = state?.condition;
resourceInputs["contentType"] = state?.contentType;
resourceInputs["feedId"] = state?.feedId;
resourceInputs["feedOutputConfig"] = state?.feedOutputConfig;
resourceInputs["folder"] = state?.folder;
resourceInputs["folderId"] = state?.folderId;
resourceInputs["name"] = state?.name;
}
else {
const args = argsOrState;
if (args?.billingProject === undefined && !opts.urn) {
throw new Error("Missing required property 'billingProject'");
}
if (args?.feedId === undefined && !opts.urn) {
throw new Error("Missing required property 'feedId'");
}
if (args?.feedOutputConfig === undefined && !opts.urn) {
throw new Error("Missing required property 'feedOutputConfig'");
}
if (args?.folder === undefined && !opts.urn) {
throw new Error("Missing required property 'folder'");
}
resourceInputs["assetNames"] = args?.assetNames;
resourceInputs["assetTypes"] = args?.assetTypes;
resourceInputs["billingProject"] = args?.billingProject;
resourceInputs["condition"] = args?.condition;
resourceInputs["contentType"] = args?.contentType;
resourceInputs["feedId"] = args?.feedId;
resourceInputs["feedOutputConfig"] = args?.feedOutputConfig;
resourceInputs["folder"] = args?.folder;
resourceInputs["folderId"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(FolderFeed.__pulumiType, name, resourceInputs, opts);
}
}
exports.FolderFeed = FolderFeed;
/** @internal */
FolderFeed.__pulumiType = 'gcp:cloudasset/folderFeed:FolderFeed';
//# sourceMappingURL=folderFeed.js.map
;