GCP.StorageInsights reference
ReportConfig
Section titled “ReportConfig”Source:
packages/gcp/src/StorageInsights/ReportConfig.ts
A scheduled Cloud Storage object inventory report configuration.
The API assigns the UUID. Alchemy recovers configurations by ownership labels if local state is lost. Schedule, format, destination, metadata fields, display name, and labels update in place; location or source bucket changes replace the configuration. Deletion removes report details but preserves exported objects in the destination bucket.
Enable storageinsights.googleapis.com before deployment. Both buckets
must be in the same project and location. Alchemy grants the Storage
Insights service agent roles/storage.insightsCollectorService on the
source bucket and roles/storage.objectCreator on the destination, and
revokes each role when the configuration is deleted or its destination
moves. A role stays while another inventory configuration in the location
still uses that bucket, since every configuration in the project shares
the agent.
ReportConfig: Creating an Inventory Report
Section titled “ReportConfig: Creating an Inventory Report”const inventory = yield* GCP.StorageInsights.ReportConfig("Inventory", { location: "us-central1", frequencyOptions: { frequency: "DAILY", startDate: { year: 2030, month: 1, day: 1 }, endDate: { year: 2031, month: 1, day: 1 }, }, parquetOptions: {}, objectMetadataReportOptions: { metadataFields: ["project", "bucket", "name", "size", "generation"], storageFilters: { bucket: "source-bucket" }, storageDestinationOptions: { bucket: "inventory-bucket", destinationPath: "inventory/", }, },});ReportConfig: Choosing a Report Format
Section titled “ReportConfig: Choosing a Report Format”Set exactly one of parquetOptions or csvOptions. Switching between
them updates the configuration in place.
const inventory = yield* GCP.StorageInsights.ReportConfig("Inventory", { frequencyOptions: { frequency: "WEEKLY", startDate: { year: 2030, month: 1, day: 1 }, endDate: { year: 2031, month: 1, day: 1 }, }, csvOptions: { delimiter: ",", headerRequired: true }, objectMetadataReportOptions: { metadataFields: ["project", "bucket", "name", "size"], storageFilters: { bucket: source.bucketName }, storageDestinationOptions: { bucket: destination.bucketName, destinationPath: "inventory/", }, },});