Notification

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 have the IAM permission “projects.topics.publish” for a Cloud Pub/Sub topic in the project. To get the service account’s email address, 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.

Create a Notification Resource

def Notification(resource_name, opts=None, bucket=None, custom_attributes=None, event_types=None, object_name_prefix=None, payload_format=None, topic=None, __props__=None);
func NewNotification(ctx *Context, name string, args NotificationArgs, opts ...ResourceOption) (*Notification, error)
name string
The unique name of the resource.
args NotificationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args NotificationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args NotificationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Notification Resource Properties

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

Inputs

The Notification resource accepts the following input properties:

Bucket string

The name of the bucket.

PayloadFormat string

The desired content of the Payload. One of "JSON_API_V1" or "NONE".

Topic 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 Dictionary<string, string>

A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription

EventTypes 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 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 string

The name of the bucket.

PayloadFormat string

The desired content of the Payload. One of "JSON_API_V1" or "NONE".

Topic 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 map[string]string

A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription

EventTypes []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 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 string

The name of the bucket.

payloadFormat string

The desired content of the Payload. One of "JSON_API_V1" or "NONE".

topic 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 {[key: string]: string}

A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription

eventTypes 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 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 str

The name of the bucket.

payload_format str

The desired content of the Payload. One of "JSON_API_V1" or "NONE".

topic 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 Dict[str, str]

A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription

event_types List[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 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.

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 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.

Look up an 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
static get(resource_name, id, opts=None, bucket=None, custom_attributes=None, event_types=None, notification_id=None, object_name_prefix=None, payload_format=None, self_link=None, topic=None, __props__=None);
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)
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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 string

The name of the bucket.

CustomAttributes Dictionary<string, string>

A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription

EventTypes 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 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 string

The desired content of the Payload. One of "JSON_API_V1" or "NONE".

SelfLink string

The URI of the created resource.

Topic 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 string

The name of the bucket.

CustomAttributes map[string]string

A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription

EventTypes []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 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 string

The desired content of the Payload. One of "JSON_API_V1" or "NONE".

SelfLink string

The URI of the created resource.

Topic 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 string

The name of the bucket.

customAttributes {[key: string]: string}

A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription

eventTypes 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 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 string

The desired content of the Payload. One of "JSON_API_V1" or "NONE".

selfLink string

The URI of the created resource.

topic 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 str

The name of the bucket.

custom_attributes Dict[str, str]

A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription

event_types List[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 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 str

The desired content of the Payload. One of "JSON_API_V1" or "NONE".

self_link str

The URI of the created resource.

topic 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.

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes
This Pulumi package is based on the google-beta Terraform Provider.