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
new Notification(name: string, args: NotificationArgs, opts?: CustomResourceOptions);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)public Notification(string name, NotificationArgs args, CustomResourceOptions? opts = null)- 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.
- Payload
Format 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-topicormy-topic. If the project is not set in the provider, you will need to use the project-level name.- Custom
Attributes Dictionary<string, string> A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription
- Event
Types 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"- Object
Name stringPrefix 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.
- Payload
Format 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-topicormy-topic. If the project is not set in the provider, you will need to use the project-level name.- Custom
Attributes map[string]string A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription
- Event
Types []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"- Object
Name stringPrefix 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.
- payload
Format 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-topicormy-topic. If the project is not set in the provider, you will need to use the project-level name.- custom
Attributes {[key: string]: string} A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription
- event
Types 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"- object
Name stringPrefix 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-topicormy-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_ strprefix 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:
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): Notificationstatic 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.
- Custom
Attributes Dictionary<string, string> A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription
- Event
Types 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"- Notification
Id string The ID of the created notification.
- Object
Name stringPrefix 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 string The desired content of the Payload. One of
"JSON_API_V1"or"NONE".- Self
Link 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-topicormy-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.
- Custom
Attributes map[string]string A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription
- Event
Types []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"- Notification
Id string The ID of the created notification.
- Object
Name stringPrefix 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 string The desired content of the Payload. One of
"JSON_API_V1"or"NONE".- Self
Link 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-topicormy-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.
- custom
Attributes {[key: string]: string} A set of key/value attribute pairs to attach to each Cloud PubSub message published for this notification subscription
- event
Types 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"- notification
Id string The ID of the created notification.
- object
Name stringPrefix 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 string The desired content of the Payload. One of
"JSON_API_V1"or"NONE".- self
Link 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-topicormy-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_ strprefix 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-topicormy-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-betaTerraform Provider.