1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. storage
  5. Notification
Google Cloud v8.26.0 published on Thursday, Apr 10, 2025 by Pulumi

gcp.storage.Notification

Explore with Pulumi AI

Creates a new notification configuration on a specified bucket, establishing a flow of event notifications from GCS to a Cloud Pub/Sub topic. For more information see the official documentation and API.

In order to enable notifications, a special Google Cloud Storage service account unique to the project must exist and have the IAM permission “projects.topics.publish” for a Cloud Pub/Sub topic in the project. This service account is not created automatically when a project is created. To ensure the service account exists and obtain its email address for use in granting the correct IAM permission, use the gcp.storage.getProjectServiceAccount datasource’s email_address value, and see below for an example of enabling notifications by granting the correct IAM permission. See the notifications documentation for more details.

NOTE: This resource can affect your storage IAM policy. If you are using this in the same config as your storage IAM policy resources, consider making this resource dependent on those IAM resources via depends_on. This will safeguard against errors due to IAM race conditions.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

// Enable notifications by giving the correct IAM permission to the unique service account.
const gcsAccount = gcp.storage.getProjectServiceAccount({});
const topic = new gcp.pubsub.Topic("topic", {name: "default_topic"});
const binding = new gcp.pubsub.TopicIAMBinding("binding", {
    topic: topic.id,
    role: "roles/pubsub.publisher",
    members: [gcsAccount.then(gcsAccount => `serviceAccount:${gcsAccount.emailAddress}`)],
});
// End enabling notifications
const bucket = new gcp.storage.Bucket("bucket", {
    name: "default_bucket",
    location: "US",
});
const notification = new gcp.storage.Notification("notification", {
    bucket: bucket.name,
    payloadFormat: "JSON_API_V1",
    topic: topic.id,
    eventTypes: [
        "OBJECT_FINALIZE",
        "OBJECT_METADATA_UPDATE",
    ],
    customAttributes: {
        "new-attribute": "new-attribute-value",
    },
}, {
    dependsOn: [binding],
});
Copy
import pulumi
import pulumi_gcp as gcp

# Enable notifications by giving the correct IAM permission to the unique service account.
gcs_account = gcp.storage.get_project_service_account()
topic = gcp.pubsub.Topic("topic", name="default_topic")
binding = gcp.pubsub.TopicIAMBinding("binding",
    topic=topic.id,
    role="roles/pubsub.publisher",
    members=[f"serviceAccount:{gcs_account.email_address}"])
# End enabling notifications
bucket = gcp.storage.Bucket("bucket",
    name="default_bucket",
    location="US")
notification = gcp.storage.Notification("notification",
    bucket=bucket.name,
    payload_format="JSON_API_V1",
    topic=topic.id,
    event_types=[
        "OBJECT_FINALIZE",
        "OBJECT_METADATA_UPDATE",
    ],
    custom_attributes={
        "new-attribute": "new-attribute-value",
    },
    opts = pulumi.ResourceOptions(depends_on=[binding]))
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/pubsub"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/storage"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// Enable notifications by giving the correct IAM permission to the unique service account.
		gcsAccount, err := storage.GetProjectServiceAccount(ctx, &storage.GetProjectServiceAccountArgs{}, nil)
		if err != nil {
			return err
		}
		topic, err := pubsub.NewTopic(ctx, "topic", &pubsub.TopicArgs{
			Name: pulumi.String("default_topic"),
		})
		if err != nil {
			return err
		}
		binding, err := pubsub.NewTopicIAMBinding(ctx, "binding", &pubsub.TopicIAMBindingArgs{
			Topic: topic.ID(),
			Role:  pulumi.String("roles/pubsub.publisher"),
			Members: pulumi.StringArray{
				pulumi.Sprintf("serviceAccount:%v", gcsAccount.EmailAddress),
			},
		})
		if err != nil {
			return err
		}
		// End enabling notifications
		bucket, err := storage.NewBucket(ctx, "bucket", &storage.BucketArgs{
			Name:     pulumi.String("default_bucket"),
			Location: pulumi.String("US"),
		})
		if err != nil {
			return err
		}
		_, err = storage.NewNotification(ctx, "notification", &storage.NotificationArgs{
			Bucket:        bucket.Name,
			PayloadFormat: pulumi.String("JSON_API_V1"),
			Topic:         topic.ID(),
			EventTypes: pulumi.StringArray{
				pulumi.String("OBJECT_FINALIZE"),
				pulumi.String("OBJECT_METADATA_UPDATE"),
			},
			CustomAttributes: pulumi.StringMap{
				"new-attribute": pulumi.String("new-attribute-value"),
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			binding,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    // Enable notifications by giving the correct IAM permission to the unique service account.
    var gcsAccount = Gcp.Storage.GetProjectServiceAccount.Invoke();

    var topic = new Gcp.PubSub.Topic("topic", new()
    {
        Name = "default_topic",
    });

    var binding = new Gcp.PubSub.TopicIAMBinding("binding", new()
    {
        Topic = topic.Id,
        Role = "roles/pubsub.publisher",
        Members = new[]
        {
            $"serviceAccount:{gcsAccount.Apply(getProjectServiceAccountResult => getProjectServiceAccountResult.EmailAddress)}",
        },
    });

    // End enabling notifications
    var bucket = new Gcp.Storage.Bucket("bucket", new()
    {
        Name = "default_bucket",
        Location = "US",
    });

    var notification = new Gcp.Storage.Notification("notification", new()
    {
        Bucket = bucket.Name,
        PayloadFormat = "JSON_API_V1",
        Topic = topic.Id,
        EventTypes = new[]
        {
            "OBJECT_FINALIZE",
            "OBJECT_METADATA_UPDATE",
        },
        CustomAttributes = 
        {
            { "new-attribute", "new-attribute-value" },
        },
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            binding,
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.storage.StorageFunctions;
import com.pulumi.gcp.storage.inputs.GetProjectServiceAccountArgs;
import com.pulumi.gcp.pubsub.Topic;
import com.pulumi.gcp.pubsub.TopicArgs;
import com.pulumi.gcp.pubsub.TopicIAMBinding;
import com.pulumi.gcp.pubsub.TopicIAMBindingArgs;
import com.pulumi.gcp.storage.Bucket;
import com.pulumi.gcp.storage.BucketArgs;
import com.pulumi.gcp.storage.Notification;
import com.pulumi.gcp.storage.NotificationArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        // Enable notifications by giving the correct IAM permission to the unique service account.
        final var gcsAccount = StorageFunctions.getProjectServiceAccount(GetProjectServiceAccountArgs.builder()
            .build());

        var topic = new Topic("topic", TopicArgs.builder()
            .name("default_topic")
            .build());

        var binding = new TopicIAMBinding("binding", TopicIAMBindingArgs.builder()
            .topic(topic.id())
            .role("roles/pubsub.publisher")
            .members(String.format("serviceAccount:%s", gcsAccount.emailAddress()))
            .build());

        // End enabling notifications
        var bucket = new Bucket("bucket", BucketArgs.builder()
            .name("default_bucket")
            .location("US")
            .build());

        var notification = new Notification("notification", NotificationArgs.builder()
            .bucket(bucket.name())
            .payloadFormat("JSON_API_V1")
            .topic(topic.id())
            .eventTypes(            
                "OBJECT_FINALIZE",
                "OBJECT_METADATA_UPDATE")
            .customAttributes(Map.of("new-attribute", "new-attribute-value"))
            .build(), CustomResourceOptions.builder()
                .dependsOn(binding)
                .build());

    }
}
Copy
resources:
  notification:
    type: gcp:storage:Notification
    properties:
      bucket: ${bucket.name}
      payloadFormat: JSON_API_V1
      topic: ${topic.id}
      eventTypes:
        - OBJECT_FINALIZE
        - OBJECT_METADATA_UPDATE
      customAttributes:
        new-attribute: new-attribute-value
    options:
      dependsOn:
        - ${binding}
  binding:
    type: gcp:pubsub:TopicIAMBinding
    properties:
      topic: ${topic.id}
      role: roles/pubsub.publisher
      members:
        - serviceAccount:${gcsAccount.emailAddress}
  # End enabling notifications
  bucket:
    type: gcp:storage:Bucket
    properties:
      name: default_bucket
      location: US
  topic:
    type: gcp:pubsub:Topic
    properties:
      name: default_topic
variables:
  # Enable notifications by giving the correct IAM permission to the unique service account.
  gcsAccount:
    fn::invoke:
      function: gcp:storage:getProjectServiceAccount
      arguments: {}
Copy

Create Notification Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Notification(name: string, args: NotificationArgs, opts?: CustomResourceOptions);
@overload
def Notification(resource_name: str,
                 args: NotificationArgs,
                 opts: Optional[ResourceOptions] = None)

@overload
def Notification(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 bucket: Optional[str] = None,
                 payload_format: Optional[str] = None,
                 topic: Optional[str] = None,
                 custom_attributes: Optional[Mapping[str, str]] = None,
                 event_types: Optional[Sequence[str]] = None,
                 object_name_prefix: Optional[str] = None)
func NewNotification(ctx *Context, name string, args NotificationArgs, opts ...ResourceOption) (*Notification, error)
public Notification(string name, NotificationArgs args, CustomResourceOptions? opts = null)
public Notification(String name, NotificationArgs args)
public Notification(String name, NotificationArgs args, CustomResourceOptions options)
type: gcp:storage:Notification
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. NotificationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. NotificationArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. NotificationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. NotificationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. NotificationArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var notificationResource = new Gcp.Storage.Notification("notificationResource", new()
{
    Bucket = "string",
    PayloadFormat = "string",
    Topic = "string",
    CustomAttributes = 
    {
        { "string", "string" },
    },
    EventTypes = new[]
    {
        "string",
    },
    ObjectNamePrefix = "string",
});
Copy
example, err := storage.NewNotification(ctx, "notificationResource", &storage.NotificationArgs{
	Bucket:        pulumi.String("string"),
	PayloadFormat: pulumi.String("string"),
	Topic:         pulumi.String("string"),
	CustomAttributes: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	EventTypes: pulumi.StringArray{
		pulumi.String("string"),
	},
	ObjectNamePrefix: pulumi.String("string"),
})
Copy
var notificationResource = new Notification("notificationResource", NotificationArgs.builder()
    .bucket("string")
    .payloadFormat("string")
    .topic("string")
    .customAttributes(Map.of("string", "string"))
    .eventTypes("string")
    .objectNamePrefix("string")
    .build());
Copy
notification_resource = gcp.storage.Notification("notificationResource",
    bucket="string",
    payload_format="string",
    topic="string",
    custom_attributes={
        "string": "string",
    },
    event_types=["string"],
    object_name_prefix="string")
Copy
const notificationResource = new gcp.storage.Notification("notificationResource", {
    bucket: "string",
    payloadFormat: "string",
    topic: "string",
    customAttributes: {
        string: "string",
    },
    eventTypes: ["string"],
    objectNamePrefix: "string",
});
Copy
type: gcp:storage:Notification
properties:
    bucket: string
    customAttributes:
        string: string
    eventTypes:
        - string
    objectNamePrefix: string
    payloadFormat: string
    topic: string
Copy

Notification Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Notification resource accepts the following input properties:

Bucket
This property is required.
Changes to this property will trigger replacement.
string
The name of the bucket.
PayloadFormat
This property is required.
Changes to this property will trigger replacement.
string
The desired content of the Payload. One of "JSON_API_V1" or "NONE".
Topic
This property is required.
Changes to this property will trigger replacement.
string
The Cloud PubSub topic to which this subscription publishes. Expects either the topic name, assumed to belong to the default GCP provider project, or the project-level name, i.e. projects/my-gcp-project/topics/my-topic or my-topic. If the project is not set in the provider, you will need to use the project-level name.


CustomAttributes Changes to this property will trigger replacement. Dictionary<string, string>
A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription
EventTypes Changes to this property will trigger replacement. List<string>
List of event type filters for this notification config. If not specified, Cloud Storage will send notifications for all event types. The valid types are: "OBJECT_FINALIZE", "OBJECT_METADATA_UPDATE", "OBJECT_DELETE", "OBJECT_ARCHIVE"
ObjectNamePrefix Changes to this property will trigger replacement. string
Specifies a prefix path filter for this notification config. Cloud Storage will only send notifications for objects in this bucket whose names begin with the specified prefix.
Bucket
This property is required.
Changes to this property will trigger replacement.
string
The name of the bucket.
PayloadFormat
This property is required.
Changes to this property will trigger replacement.
string
The desired content of the Payload. One of "JSON_API_V1" or "NONE".
Topic
This property is required.
Changes to this property will trigger replacement.
string
The Cloud PubSub topic to which this subscription publishes. Expects either the topic name, assumed to belong to the default GCP provider project, or the project-level name, i.e. projects/my-gcp-project/topics/my-topic or my-topic. If the project is not set in the provider, you will need to use the project-level name.


CustomAttributes Changes to this property will trigger replacement. map[string]string
A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription
EventTypes Changes to this property will trigger replacement. []string
List of event type filters for this notification config. If not specified, Cloud Storage will send notifications for all event types. The valid types are: "OBJECT_FINALIZE", "OBJECT_METADATA_UPDATE", "OBJECT_DELETE", "OBJECT_ARCHIVE"
ObjectNamePrefix Changes to this property will trigger replacement. string
Specifies a prefix path filter for this notification config. Cloud Storage will only send notifications for objects in this bucket whose names begin with the specified prefix.
bucket
This property is required.
Changes to this property will trigger replacement.
String
The name of the bucket.
payloadFormat
This property is required.
Changes to this property will trigger replacement.
String
The desired content of the Payload. One of "JSON_API_V1" or "NONE".
topic
This property is required.
Changes to this property will trigger replacement.
String
The Cloud PubSub topic to which this subscription publishes. Expects either the topic name, assumed to belong to the default GCP provider project, or the project-level name, i.e. projects/my-gcp-project/topics/my-topic or my-topic. If the project is not set in the provider, you will need to use the project-level name.


customAttributes Changes to this property will trigger replacement. Map<String,String>
A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription
eventTypes Changes to this property will trigger replacement. List<String>
List of event type filters for this notification config. If not specified, Cloud Storage will send notifications for all event types. The valid types are: "OBJECT_FINALIZE", "OBJECT_METADATA_UPDATE", "OBJECT_DELETE", "OBJECT_ARCHIVE"
objectNamePrefix Changes to this property will trigger replacement. String
Specifies a prefix path filter for this notification config. Cloud Storage will only send notifications for objects in this bucket whose names begin with the specified prefix.
bucket
This property is required.
Changes to this property will trigger replacement.
string
The name of the bucket.
payloadFormat
This property is required.
Changes to this property will trigger replacement.
string
The desired content of the Payload. One of "JSON_API_V1" or "NONE".
topic
This property is required.
Changes to this property will trigger replacement.
string
The Cloud PubSub topic to which this subscription publishes. Expects either the topic name, assumed to belong to the default GCP provider project, or the project-level name, i.e. projects/my-gcp-project/topics/my-topic or my-topic. If the project is not set in the provider, you will need to use the project-level name.


customAttributes Changes to this property will trigger replacement. {[key: string]: string}
A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription
eventTypes Changes to this property will trigger replacement. string[]
List of event type filters for this notification config. If not specified, Cloud Storage will send notifications for all event types. The valid types are: "OBJECT_FINALIZE", "OBJECT_METADATA_UPDATE", "OBJECT_DELETE", "OBJECT_ARCHIVE"
objectNamePrefix Changes to this property will trigger replacement. string
Specifies a prefix path filter for this notification config. Cloud Storage will only send notifications for objects in this bucket whose names begin with the specified prefix.
bucket
This property is required.
Changes to this property will trigger replacement.
str
The name of the bucket.
payload_format
This property is required.
Changes to this property will trigger replacement.
str
The desired content of the Payload. One of "JSON_API_V1" or "NONE".
topic
This property is required.
Changes to this property will trigger replacement.
str
The Cloud PubSub topic to which this subscription publishes. Expects either the topic name, assumed to belong to the default GCP provider project, or the project-level name, i.e. projects/my-gcp-project/topics/my-topic or my-topic. If the project is not set in the provider, you will need to use the project-level name.


custom_attributes Changes to this property will trigger replacement. Mapping[str, str]
A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription
event_types Changes to this property will trigger replacement. Sequence[str]
List of event type filters for this notification config. If not specified, Cloud Storage will send notifications for all event types. The valid types are: "OBJECT_FINALIZE", "OBJECT_METADATA_UPDATE", "OBJECT_DELETE", "OBJECT_ARCHIVE"
object_name_prefix Changes to this property will trigger replacement. str
Specifies a prefix path filter for this notification config. Cloud Storage will only send notifications for objects in this bucket whose names begin with the specified prefix.
bucket
This property is required.
Changes to this property will trigger replacement.
String
The name of the bucket.
payloadFormat
This property is required.
Changes to this property will trigger replacement.
String
The desired content of the Payload. One of "JSON_API_V1" or "NONE".
topic
This property is required.
Changes to this property will trigger replacement.
String
The Cloud PubSub topic to which this subscription publishes. Expects either the topic name, assumed to belong to the default GCP provider project, or the project-level name, i.e. projects/my-gcp-project/topics/my-topic or my-topic. If the project is not set in the provider, you will need to use the project-level name.


customAttributes Changes to this property will trigger replacement. Map<String>
A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription
eventTypes Changes to this property will trigger replacement. List<String>
List of event type filters for this notification config. If not specified, Cloud Storage will send notifications for all event types. The valid types are: "OBJECT_FINALIZE", "OBJECT_METADATA_UPDATE", "OBJECT_DELETE", "OBJECT_ARCHIVE"
objectNamePrefix Changes to this property will trigger replacement. String
Specifies a prefix path filter for this notification config. Cloud Storage will only send notifications for objects in this bucket whose names begin with the specified prefix.

Outputs

All input properties are implicitly available as output properties. Additionally, the Notification resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
NotificationId string
The ID of the created notification.
SelfLink string
The URI of the created resource.
Id string
The provider-assigned unique ID for this managed resource.
NotificationId string
The ID of the created notification.
SelfLink string
The URI of the created resource.
id String
The provider-assigned unique ID for this managed resource.
notificationId String
The ID of the created notification.
selfLink String
The URI of the created resource.
id string
The provider-assigned unique ID for this managed resource.
notificationId string
The ID of the created notification.
selfLink string
The URI of the created resource.
id str
The provider-assigned unique ID for this managed resource.
notification_id str
The ID of the created notification.
self_link str
The URI of the created resource.
id String
The provider-assigned unique ID for this managed resource.
notificationId String
The ID of the created notification.
selfLink String
The URI of the created resource.

Look up Existing Notification Resource

Get an existing Notification resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: NotificationState, opts?: CustomResourceOptions): Notification
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        bucket: Optional[str] = None,
        custom_attributes: Optional[Mapping[str, str]] = None,
        event_types: Optional[Sequence[str]] = None,
        notification_id: Optional[str] = None,
        object_name_prefix: Optional[str] = None,
        payload_format: Optional[str] = None,
        self_link: Optional[str] = None,
        topic: Optional[str] = None) -> Notification
func GetNotification(ctx *Context, name string, id IDInput, state *NotificationState, opts ...ResourceOption) (*Notification, error)
public static Notification Get(string name, Input<string> id, NotificationState? state, CustomResourceOptions? opts = null)
public static Notification get(String name, Output<String> id, NotificationState state, CustomResourceOptions options)
resources:  _:    type: gcp:storage:Notification    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Bucket Changes to this property will trigger replacement. string
The name of the bucket.
CustomAttributes Changes to this property will trigger replacement. Dictionary<string, string>
A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription
EventTypes Changes to this property will trigger replacement. List<string>
List of event type filters for this notification config. If not specified, Cloud Storage will send notifications for all event types. The valid types are: "OBJECT_FINALIZE", "OBJECT_METADATA_UPDATE", "OBJECT_DELETE", "OBJECT_ARCHIVE"
NotificationId string
The ID of the created notification.
ObjectNamePrefix Changes to this property will trigger replacement. string
Specifies a prefix path filter for this notification config. Cloud Storage will only send notifications for objects in this bucket whose names begin with the specified prefix.
PayloadFormat Changes to this property will trigger replacement. string
The desired content of the Payload. One of "JSON_API_V1" or "NONE".
SelfLink string
The URI of the created resource.
Topic Changes to this property will trigger replacement. string
The Cloud PubSub topic to which this subscription publishes. Expects either the topic name, assumed to belong to the default GCP provider project, or the project-level name, i.e. projects/my-gcp-project/topics/my-topic or my-topic. If the project is not set in the provider, you will need to use the project-level name.


Bucket Changes to this property will trigger replacement. string
The name of the bucket.
CustomAttributes Changes to this property will trigger replacement. map[string]string
A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription
EventTypes Changes to this property will trigger replacement. []string
List of event type filters for this notification config. If not specified, Cloud Storage will send notifications for all event types. The valid types are: "OBJECT_FINALIZE", "OBJECT_METADATA_UPDATE", "OBJECT_DELETE", "OBJECT_ARCHIVE"
NotificationId string
The ID of the created notification.
ObjectNamePrefix Changes to this property will trigger replacement. string
Specifies a prefix path filter for this notification config. Cloud Storage will only send notifications for objects in this bucket whose names begin with the specified prefix.
PayloadFormat Changes to this property will trigger replacement. string
The desired content of the Payload. One of "JSON_API_V1" or "NONE".
SelfLink string
The URI of the created resource.
Topic Changes to this property will trigger replacement. string
The Cloud PubSub topic to which this subscription publishes. Expects either the topic name, assumed to belong to the default GCP provider project, or the project-level name, i.e. projects/my-gcp-project/topics/my-topic or my-topic. If the project is not set in the provider, you will need to use the project-level name.


bucket Changes to this property will trigger replacement. String
The name of the bucket.
customAttributes Changes to this property will trigger replacement. Map<String,String>
A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription
eventTypes Changes to this property will trigger replacement. List<String>
List of event type filters for this notification config. If not specified, Cloud Storage will send notifications for all event types. The valid types are: "OBJECT_FINALIZE", "OBJECT_METADATA_UPDATE", "OBJECT_DELETE", "OBJECT_ARCHIVE"
notificationId String
The ID of the created notification.
objectNamePrefix Changes to this property will trigger replacement. String
Specifies a prefix path filter for this notification config. Cloud Storage will only send notifications for objects in this bucket whose names begin with the specified prefix.
payloadFormat Changes to this property will trigger replacement. String
The desired content of the Payload. One of "JSON_API_V1" or "NONE".
selfLink String
The URI of the created resource.
topic Changes to this property will trigger replacement. String
The Cloud PubSub topic to which this subscription publishes. Expects either the topic name, assumed to belong to the default GCP provider project, or the project-level name, i.e. projects/my-gcp-project/topics/my-topic or my-topic. If the project is not set in the provider, you will need to use the project-level name.


bucket Changes to this property will trigger replacement. string
The name of the bucket.
customAttributes Changes to this property will trigger replacement. {[key: string]: string}
A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription
eventTypes Changes to this property will trigger replacement. string[]
List of event type filters for this notification config. If not specified, Cloud Storage will send notifications for all event types. The valid types are: "OBJECT_FINALIZE", "OBJECT_METADATA_UPDATE", "OBJECT_DELETE", "OBJECT_ARCHIVE"
notificationId string
The ID of the created notification.
objectNamePrefix Changes to this property will trigger replacement. string
Specifies a prefix path filter for this notification config. Cloud Storage will only send notifications for objects in this bucket whose names begin with the specified prefix.
payloadFormat Changes to this property will trigger replacement. string
The desired content of the Payload. One of "JSON_API_V1" or "NONE".
selfLink string
The URI of the created resource.
topic Changes to this property will trigger replacement. string
The Cloud PubSub topic to which this subscription publishes. Expects either the topic name, assumed to belong to the default GCP provider project, or the project-level name, i.e. projects/my-gcp-project/topics/my-topic or my-topic. If the project is not set in the provider, you will need to use the project-level name.


bucket Changes to this property will trigger replacement. str
The name of the bucket.
custom_attributes Changes to this property will trigger replacement. Mapping[str, str]
A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription
event_types Changes to this property will trigger replacement. Sequence[str]
List of event type filters for this notification config. If not specified, Cloud Storage will send notifications for all event types. The valid types are: "OBJECT_FINALIZE", "OBJECT_METADATA_UPDATE", "OBJECT_DELETE", "OBJECT_ARCHIVE"
notification_id str
The ID of the created notification.
object_name_prefix Changes to this property will trigger replacement. str
Specifies a prefix path filter for this notification config. Cloud Storage will only send notifications for objects in this bucket whose names begin with the specified prefix.
payload_format Changes to this property will trigger replacement. str
The desired content of the Payload. One of "JSON_API_V1" or "NONE".
self_link str
The URI of the created resource.
topic Changes to this property will trigger replacement. str
The Cloud PubSub topic to which this subscription publishes. Expects either the topic name, assumed to belong to the default GCP provider project, or the project-level name, i.e. projects/my-gcp-project/topics/my-topic or my-topic. If the project is not set in the provider, you will need to use the project-level name.


bucket Changes to this property will trigger replacement. String
The name of the bucket.
customAttributes Changes to this property will trigger replacement. Map<String>
A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription
eventTypes Changes to this property will trigger replacement. List<String>
List of event type filters for this notification config. If not specified, Cloud Storage will send notifications for all event types. The valid types are: "OBJECT_FINALIZE", "OBJECT_METADATA_UPDATE", "OBJECT_DELETE", "OBJECT_ARCHIVE"
notificationId String
The ID of the created notification.
objectNamePrefix Changes to this property will trigger replacement. String
Specifies a prefix path filter for this notification config. Cloud Storage will only send notifications for objects in this bucket whose names begin with the specified prefix.
payloadFormat Changes to this property will trigger replacement. String
The desired content of the Payload. One of "JSON_API_V1" or "NONE".
selfLink String
The URI of the created resource.
topic Changes to this property will trigger replacement. String
The Cloud PubSub topic to which this subscription publishes. Expects either the topic name, assumed to belong to the default GCP provider project, or the project-level name, i.e. projects/my-gcp-project/topics/my-topic or my-topic. If the project is not set in the provider, you will need to use the project-level name.


Import

Storage notifications can be imported using any of these accepted formats:

  • {{bucket_name}}/notificationConfigs/{{id}}

When using the pulumi import command, Storage notifications can be imported using one of the formats above. For example:

$ pulumi import gcp:storage/notification:Notification default {{bucket_name}}/notificationConfigs/{{id}}
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Google Cloud (GCP) Classic pulumi/pulumi-gcp
License
Apache-2.0
Notes
This Pulumi package is based on the google-beta Terraform Provider.