GoogleStorageNotification class final

Factory wrapper for google_storage_notification.

Creates a new notification configuration on a specified bucket, establishing a flow of event notifications from GCS to a Cloud Pub/Sub topic.

IAM precondition

Before applying this resource, the GCS service account (service-{PROJECT_NUMBER}@gs-project-accounts.iam.gserviceaccount.com) MUST hold the roles/pubsub.publisher role on the destination topic. The provider does NOT manage this binding for you — wire it up via a sibling google_pubsub_topic_iam_member (or the google_storage_project_service_account data source feeding into the IAM binding) and add it to the resource's dependsOn.

topic must be a fully-qualified Pub/Sub topic resource path 'projects/{project_id}/topics/{topic_name}'. The provider rejects a bare topic name. Pass topic.ref against a sibling GooglePubsubTopic (it emits the topic id, the full path), or build the literal yourself.

Example — full-fidelity notifications on a sibling bucket,

scoped to object writes under incoming/:

final ingestTopic = GooglePubsubTopic(
  'ingest',
  name: TfArg.literal('gcs-ingest'),
);
final assets = GoogleStorageBucket(
  'assets',
  name: TfArg.literal('my-app-assets-prod'),
  location: TfArg.literal('ASIA-NORTHEAST1'),
);
final notif = GoogleStorageNotification(
  'assets_ingest',
  bucket: assets.ref,
  // Emits the topic `id`, `projects/{project}/topics/gcs-ingest` —
  // the full path the API expects.
  topic: ingestTopic.ref,
  payloadFormat: StorageNotificationPayloadFormat.jsonApiV1,
  eventTypes: .literal([.objectFinalize, .objectMetadataUpdate]),
  objectNamePrefix: TfArg.literal('incoming/'),
  customAttributes: TfArg.literal(const {'source': 'gcs-ingest'}),
);

Example — pre-built literal topic path (e.g. when the topic

lives in another project / is provisioned outside Terraform):

final notif = GoogleStorageNotification(
  'audit',
  bucket: RefTo.literal('my-bucket'),
  topic: RefTo.literal('projects/my-proj/topics/my-topic'),
  payloadFormat: StorageNotificationPayloadFormat.jsonApiV1,
);
Inheritance

Constructors

GoogleStorageNotification(String localName, {required RefTo<GoogleStorageBucket> bucket, required RefTo<GooglePubsubTopic> topic, required StorageNotificationPayloadFormat payloadFormat, EnumList<StorageNotificationEventType>? eventTypes, TfArg<String>? objectNamePrefix, TfArg<Map<String, String>>? customAttributes, LifecycleOptions? lifecycle, List<TfAddressed>? dependsOn, StackProvider? provider, TfTimeouts? timeouts})

Properties

argMap → Map<String, TfArg?>
Argument-name → TfArg map. Keys are snake_case (Terraform JSON name). Synth emits these keys directly; the factory is responsible for the camelCase → snake_case translation at construction time.
finalinherited
bucket → TfRef<String>
Reference to bucket attribute.
no setter
customAttributes → TfRef<Map<String, String>>
Reference to custom_attributes attribute.
no setter
defaultProvider → String
The provider name a block without provider uses: by default the prefix of terraformType (google for google_pubsub_topic).
no setterinherited
dependsOn → List<TfAddressed>?
Optional depends_on = [...]: the resources, data sources and module calls this block waits for, e.g. [api, ...apiDeps]. Terraform takes whole blocks only, so an entry is never an attribute.
finalinherited
eventTypes → TfRef<List<String>>
Reference to event_types attribute.
no setter
hashCode → int
The hash code for this object.
no setterinherited
id → TfRef<String>
Reference to id attribute.
no setter
kind → ResourceKind
Always ResourceKind.resource. Overridden by Data.
no setterinherited
lifecycle → LifecycleOptions?
Optional lifecycle { ... } block.
finalinherited
localName → String
User-supplied local name within a Stack.
finalinherited
notificationId → TfRef<String>
Reference to notification_id attribute.
no setter
objectNamePrefix → TfRef<String>
Reference to object_name_prefix attribute.
no setter
payloadFormat → TfRef<String>
Reference to payload_format attribute.
no setter
provider → StackProvider?
Optional Terraform provider meta-argument: the provider configuration this block uses, e.g. a GoogleProvider with an alias the Stack registered with addProvider.
finalinherited
ref → RefTo<GoogleStorageNotification>
A reference to this resource, for arguments typed RefTo<GoogleStorageNotification>.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
Reference to self_link attribute.
no setter
sensitiveFields → Set<String>
Field names that are @Sensitive per the IR-derived per-resource constant. Curated factories override with a baked-in static const Set<String> (file-private in v0.5+).
no setteroverride
supportsDeletionProtection → bool
Capability flag: true when this resource's underlying Terraform schema has a deletion_protection boolean attribute that the synth-time devMode flow can flip to false. Defaults to false; the codegen emitter overrides this to true for wrappers whose schema includes the attribute.
no setterinherited
terraformType → String
Terraform resource type, e.g. google_pubsub_topic.
finalinherited
tfAddress → String
Terraform address <terraformType>.<localName>, e.g. google_pubsub_topic.orders.
no setterinherited
timeouts → TfTimeouts?
Optional timeouts { ... } block: how long Terraform waits for each operation. Provider-neutral like lifecycle — synth copies the duration strings verbatim, and terraform validate decides whether this resource's schema declares the operations set here.
finalinherited
topic → TfRef<String>
Reference to topic attribute.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

tfType → const String