@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
146 lines • 6.02 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.ProjectFeed = 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 ProjectFeed, 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 Project 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",
* });
* // Create a feed that sends notifications about network resource updates.
* const projectFeed = new gcp.cloudasset.ProjectFeed("project_feed", {
* project: "my-project-name",
* 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
*
* ProjectFeed can be imported using any of these accepted formats:
*
* * `projects/{{project}}/feeds/{{name}}`
*
* * `{{project}}/{{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, ProjectFeed can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:cloudasset/projectFeed:ProjectFeed default projects/{{project}}/feeds/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:cloudasset/projectFeed:ProjectFeed default {{project}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:cloudasset/projectFeed:ProjectFeed default {{name}}
* ```
*/
class ProjectFeed extends pulumi.CustomResource {
/**
* Get an existing ProjectFeed 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 ProjectFeed(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of ProjectFeed. 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'] === ProjectFeed.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["assetNames"] = state ? state.assetNames : undefined;
resourceInputs["assetTypes"] = state ? state.assetTypes : undefined;
resourceInputs["billingProject"] = state ? state.billingProject : undefined;
resourceInputs["condition"] = state ? state.condition : undefined;
resourceInputs["contentType"] = state ? state.contentType : undefined;
resourceInputs["feedId"] = state ? state.feedId : undefined;
resourceInputs["feedOutputConfig"] = state ? state.feedOutputConfig : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["project"] = state ? state.project : undefined;
}
else {
const args = argsOrState;
if ((!args || args.feedId === undefined) && !opts.urn) {
throw new Error("Missing required property 'feedId'");
}
if ((!args || args.feedOutputConfig === undefined) && !opts.urn) {
throw new Error("Missing required property 'feedOutputConfig'");
}
resourceInputs["assetNames"] = args ? args.assetNames : undefined;
resourceInputs["assetTypes"] = args ? args.assetTypes : undefined;
resourceInputs["billingProject"] = args ? args.billingProject : undefined;
resourceInputs["condition"] = args ? args.condition : undefined;
resourceInputs["contentType"] = args ? args.contentType : undefined;
resourceInputs["feedId"] = args ? args.feedId : undefined;
resourceInputs["feedOutputConfig"] = args ? args.feedOutputConfig : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["name"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ProjectFeed.__pulumiType, name, resourceInputs, opts);
}
}
exports.ProjectFeed = ProjectFeed;
/** @internal */
ProjectFeed.__pulumiType = 'gcp:cloudasset/projectFeed:ProjectFeed';
//# sourceMappingURL=projectFeed.js.map