@@ -5,44 +5,30 @@ to a [Google Cloud Pub/Sub][gc-storage-events] topic.
55
66## Prerequisite(s)
77
8+ - Event Source for Google Cloud Pub/Sub
89- Storage Bucket
9- - Pub/Sub Topic and Subscription
1010- Notification Configuration
11- - Service Account
1211
13- ### Storage Bucket
14-
15- The storage bucket is expected to exist prior to running this event source. If you haven't already done so, create a
16- bucket by following the instructions from the [ Cloud Storage How-To Guides] [ gc-storage-howto ] .
17-
18- ### Pub/Sub Topic and Subscription
19-
20- A Pub/Sub topic is required to be able to consume change notifications from Cloud Storage.
12+ ### Event Source for Google Cloud Pub/Sub
2113
22- You can either create this topic manually by following the instructions at [ Managing topics and
23- subscriptions] [ gc-pubsub-adm ] , or instead use the [ ` gsutil ` ] [ gsutil ] command-line tool to create the Pub/Sub topic and
24- add a notification configuration to the bucket in a single step, as described at [ Using Pub/Sub notifications for Cloud
25- Storage] [ gc-storage-setup ] .
14+ Change notifications from Cloud Storage buckets can not be consumed directly, but are instead sent to a Google Cloud
15+ Pub/Sub topic. Follow the instructions at [ Event Source for Google Cloud Storage] ( ./googlecloudpubsub.md ) for setting up
16+ a Pub/Sub topic and running an instance of the Pub/Sub event source.
2617
27- ![ Topic] ( ../images/googlecloudstorage-source/topic-1.png )
28-
29- Once a topic exists, it is necessary to create a _ subscription_ in order to allow the TriggerMesh event source for
30- Google Cloud Storage to pull events from this topic. The documentation page [ Managing topics and
31- subscriptions] [ gc-pubsub-adm ] explains this procedure in details.
18+ !!! note
19+ As an alternative to a manual creation, the Pub/Sub topic will be created automatically while enabling the
20+ [ Notification Configuration] ( #notification-configuration ) if it doesn't already exist.
3221
33- Take note of the name of this subscription, it is a required input to be able to run an instance of the Google Cloud
34- Storage event source.
22+ ### Storage Bucket
3523
36- ![ Subscription] ( ../images/googlecloudstorage-source/subscription-1.png )
24+ You can create a Cloud Storage bucket by following the instructions from the [ Cloud Storage How-To
25+ Guides] [ gc-storage-howto ] .
3726
3827### Notification Configuration
3928
40- Change notifications need to be enabled in the selected bucket by applying a _ notification configuration_ .
41-
42- If you have already followed the instructions from the previous section and applied a notification configuration at the
43- same time as you created the Pub/Sub topic using ` gsutil ` , your bucket is already configured for sending events.
44- Otherwise, follow the instructions at [ Using Pub/Sub notifications for Cloud Storage] [ gc-storage-setup ] and add a new
45- notification configuration.
29+ Change notifications need to be enabled in the selected bucket by applying a _ notification configuration_ . Follow the
30+ instructions at [ Using Pub/Sub notifications for Cloud Storage] [ gc-storage-setup ] to add a new notification
31+ configuration using the [ ` gsutil ` ] [ gsutil ] command-line tool.
4632
4733Below is an example of command which applies a notification configuration to a bucket called ` eventsource-dev ` , with a
4834Pub/Sub topic called ` triggermesh-storage-source ` set as event destination.
@@ -62,62 +48,9 @@ projects/_/buckets/eventsource-dev/notificationConfigs/1
6248!!! note
6349 It is currently not possible to manage Pub/Sub notifications via the Cloud Console.
6450
65- ### Service Account
66-
67- A [ Service Account] [ gc-storage-svcacc ] is required to authenticate the event source and allow it to interact with Google
68- Cloud Pub/Sub. You can create a service account by following the instructions at [ Creating and managing service
69- accounts] [ gc-iam-svcacc ] .
70-
71- The service account must be granted an [ IAM Role] [ gc-iam-roles ] with at least the following permission:
72-
73- - ` pubsub.subscriptions.consume `
74-
75- The predefined ` roles/pubsub.subscriber ` role is one example of role that is suitable for use with the TriggerMesh event
76- source for Google Cloud Storage.
77-
78- ![ Service account] ( ../images/googlecloudstorage-source/iam-1.png )
79-
80- Create a [ key] [ gc-iam-key ] for this service account and save it. This key must be in JSON format. It is required to be
81- able to run an instance of the Google Cloud Storage event source.
82-
83- ## Deploying an Instance of the Source
84-
85- Open the Bridge creation screen and add a source of type ` Google Cloud Storage ` .
86-
87- ![ Adding a Google Cloud Storage source] ( ../images/googlecloudstorage-source/create-bridge-1.png )
88-
89- In the Source creation form, give a name to the event source and add the following information:
90-
91- - [ ** Secret** ] [ gc-iam-key ] : Service account key in JSON format, as described in the previous sections.
92- - ** Google Cloud project name** : Name of the Google Cloud project containing the storage bucket.
93- - ** Pub/Sub Subscription name** : Name of a Pub/Sub subscription which pulls messages from the topic where the Cloud
94- Storage bucket sends its change notifications.
95-
96- ![ Google Cloud Storage source form] ( ../images/googlecloudstorage-source/create-bridge-2.png )
97-
98- After clicking the ` Save ` button, you will be taken back to the Bridge editor. Proceed to adding the remaining
99- components to the Bridge, then submit it.
100-
101- ![ Bridge overview] ( ../images/googlecloudstorage-source/create-bridge-3.png )
102-
103- A ready status on the main _ Bridges_ page indicates that the event source is ready to consume Cloud Storage
104- notifications from the Pub/Sub topic.
105-
106- ![ Bridge status] ( ../images/googlecloudstorage-source/create-bridge-4.png )
107-
108- ## Event Types
109-
110- The TriggerMesh event source for Google Cloud Storage emits events of the following type:
111-
112- - ` com.triggermesh.googlecloudstorage.event `
113-
11451[ gc-storage ] : https://cloud.google.com/storage/docs/introduction
11552[ gc-storage-events ] : https://cloud.google.com/storage/docs/pubsub-notifications
11653[ gc-storage-howto ] : https://cloud.google.com/storage/docs/how-to
11754[ gc-storage-svcacc ] : https://cloud.google.com/storage/docs/projects#service-accounts
11855[ gc-storage-setup ] : https://cloud.google.com/storage/docs/reporting-changes
119- [ gc-iam-svcacc ] : https://cloud.google.com/iam/docs/creating-managing-service-accounts
120- [ gc-iam-key ] : https://cloud.google.com/iam/docs/creating-managing-service-account-keys
121- [ gc-iam-roles ] : https://cloud.google.com/iam/docs/understanding-roles
122- [ gc-pubsub-adm ] : https://cloud.google.com/pubsub/docs/admin
12356[ gsutil ] : https://cloud.google.com/storage/docs/gsutil
0 commit comments