UNPKG

@pulumi/gcp

Version:

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

255 lines • 11.5 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.Feed = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * The FeedsService is responsible for configuring and managing the ingestion of third-party security data and logs into Google Security Operations through various feed creation, updates, and lifecycle management, and schema validation. * * > **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. * * To get more information about Feed, see: * * * [API documentation](https://docs.cloud.google.com/chronicle/docs/reference/rest/v1beta/projects.locations.instances.feeds) * * How-to Guides * * [Feed management overview](https://docs.cloud.google.com/chronicle/docs/administration/feed-management-overview) * * ## Example Usage * * ### Chronicle Feed Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * // This is a basic example for Terraform support in Chronicle feeds APIs. * const exampleFeed = new gcp.chronicle.Feed("example_feed", { * location: "us", * instance: "00000000-0000-0000-0000-000000000000", * displayName: "test-feeds", * details: { * feedSourceType: "HTTPS_PUSH_GOOGLE_CLOUD_PUBSUB", * logType: "projects/my-project-name/locations/us/instances/00000000-0000-0000-0000-000000000000/logTypes/GCP_CLOUDAUDIT", * httpsPushGoogleCloudPubsubSettings: { * splitDelimiter: "\n", * }, * }, * }); * ``` * ### Chronicle Feed Gcs * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * // This is an example of a Chronicle feed using the pre_create hook to fetch the service account. * // Valid for source type: GOOGLE_CLOUD_STORAGE_EVENT_DRIVEN and GOOGLE_CLOUD_STORAGE. * // 0. Get the project's GCS service account (for Storage Notifications) * const gcsAccount = gcp.storage.getProjectServiceAccount({ * project: "my-project-name", * }); * // 1. Create the Pub/Sub Topic * const testTopic = new gcp.pubsub.Topic("test_topic", { * name: "chronicle-test-topic-my-project-name-_85840", * project: "my-project-name", * }); * // 2. Grant GCS permission to publish to the topic * // This must remain so GCS can send file notifications to Pub/Sub * const gcsPublisher = new gcp.pubsub.TopicIAMMember("gcs_publisher", { * topic: testTopic.name, * role: "roles/pubsub.publisher", * member: gcsAccount.then(gcsAccount => `serviceAccount:${gcsAccount.emailAddress}`), * }); * // 3. Create the Pub/Sub Subscription * const testSubscription = new gcp.pubsub.Subscription("test_subscription", { * name: "chronicle-test-sub-my-project-name-_60302", * project: "my-project-name", * topic: testTopic.name, * messageRetentionDuration: "1200s", * }); * // 4. Define the GCS Bucket * const testBucket = new gcp.storage.Bucket("test_bucket", { * name: "chronicle-test-bucket-my-project-name-_22811", * project: "my-project-name", * location: "US", * forceDestroy: true, * }); * // 5. Link GCS bucket to Pub/Sub Topic * const notification = new gcp.storage.Notification("notification", { * bucket: testBucket.name, * payloadFormat: "JSON_API_V1", * topic: testTopic.id, * eventTypes: ["OBJECT_FINALIZE"], * }, { * dependsOn: [gcsPublisher], * }); * // 6. The Chronicle Feed Resource * // The required permissions (Storage Admin and Pub/Sub Subscriber) are assumed to be * // granted manually at the project level prior to running this test. * const exampleFeed = new gcp.chronicle.Feed("example_feed", { * location: "us", * instance: "00000000-0000-0000-0000-000000000000", * displayName: "test-feeds", * details: { * feedSourceType: "GOOGLE_CLOUD_STORAGE_EVENT_DRIVEN", * logType: "projects/my-project-name/locations/us/instances/00000000-0000-0000-0000-000000000000/logTypes/GCP_CLOUDAUDIT", * googleCloudStorageEventDrivenSettings: { * bucketUri: pulumi.interpolate`gs://${testBucket.name}`, * pubsubSubscription: pulumi.interpolate`projects/my-project-name/subscriptions/${testSubscription.name}`, * maxLookbackDays: 90, * }, * }, * }, { * dependsOn: [notification], * }); * export const fetchedFeedServiceAccount = exampleFeed.feedServiceAccount; * ``` * ### Chronicle Feed Https Push * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * // This is an example of a Chronicle feed using the post_create hook to fetch the secret. * // Valid for source type: HTTPS_PUSH_AMAZON_KINESIS_FIREHOSE. * const exampleFeed = new gcp.chronicle.Feed("example_feed", { * location: "us", * instance: "00000000-0000-0000-0000-000000000000", * displayName: "test-feeds", * details: { * feedSourceType: "HTTPS_PUSH_AMAZON_KINESIS_FIREHOSE", * logType: "projects/my-project-name/locations/us/instances/00000000-0000-0000-0000-000000000000/logTypes/GCP_CLOUDAUDIT", * httpsPushAmazonKinesisFirehoseSettings: { * splitDelimiter: "\n", * }, * }, * }); * export const feedSecret = exampleFeed.secret; * ``` * * ## Import * * Feed can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/instances/{{instance}}/feeds/{{feed}}` * * `{{project}}/{{location}}/{{instance}}/{{feed}}` * * `{{location}}/{{instance}}/{{feed}}` * * When using the `pulumi import` command, Feed can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:chronicle/feed:Feed default projects/{{project}}/locations/{{location}}/instances/{{instance}}/feeds/{{feed}} * $ pulumi import gcp:chronicle/feed:Feed default {{project}}/{{location}}/{{instance}}/{{feed}} * $ pulumi import gcp:chronicle/feed:Feed default {{location}}/{{instance}}/{{feed}} * ``` */ class Feed extends pulumi.CustomResource { /** * Get an existing Feed 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 Feed(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:chronicle/feed:Feed'; /** * Returns true if the given object is an instance of Feed. 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'] === Feed.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["details"] = state?.details; resourceInputs["displayName"] = state?.displayName; resourceInputs["enabled"] = state?.enabled; resourceInputs["failureDetails"] = state?.failureDetails; resourceInputs["failureMsg"] = state?.failureMsg; resourceInputs["feed"] = state?.feed; resourceInputs["feedServiceAccount"] = state?.feedServiceAccount; resourceInputs["instance"] = state?.instance; resourceInputs["lastFeedInitiationTime"] = state?.lastFeedInitiationTime; resourceInputs["location"] = state?.location; resourceInputs["name"] = state?.name; resourceInputs["project"] = state?.project; resourceInputs["readOnly"] = state?.readOnly; resourceInputs["referenceId"] = state?.referenceId; resourceInputs["secret"] = state?.secret; resourceInputs["state"] = state?.state; resourceInputs["uid"] = state?.uid; } else { const args = argsOrState; if (args?.instance === undefined && !opts.urn) { throw new Error("Missing required property 'instance'"); } if (args?.location === undefined && !opts.urn) { throw new Error("Missing required property 'location'"); } resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["details"] = args?.details; resourceInputs["displayName"] = args?.displayName; resourceInputs["enabled"] = args?.enabled; resourceInputs["failureDetails"] = args?.failureDetails; resourceInputs["feed"] = args?.feed; resourceInputs["instance"] = args?.instance; resourceInputs["location"] = args?.location; resourceInputs["project"] = args?.project; resourceInputs["failureMsg"] = undefined /*out*/; resourceInputs["feedServiceAccount"] = undefined /*out*/; resourceInputs["lastFeedInitiationTime"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; resourceInputs["readOnly"] = undefined /*out*/; resourceInputs["referenceId"] = undefined /*out*/; resourceInputs["secret"] = undefined /*out*/; resourceInputs["state"] = undefined /*out*/; resourceInputs["uid"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["secret"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Feed.__pulumiType, name, resourceInputs, opts); } } exports.Feed = Feed; //# sourceMappingURL=feed.js.map