-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathextension.yaml
192 lines (173 loc) · 5.8 KB
/
extension.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: storage-mirror-firestore
version: 0.1.1
specVersion: v1beta
displayName: Store links to GCS files in Firestore
description:
Writes Firestore Documents for GCS Objects with it's Metadata as Document
fields.
license: Apache-2.0
sourceUrl: https://github.com/FirebaseExtended/experimental-extensions/tree/main/storage-mirror-firestore
author:
authorName: Firebase
url: https://firebase.google.com
contributors:
- authorName: Kevin Leung
url: https://github.com/kevinleung987
- authorName: Jeffrey Dallatezza
url: https://github.com/jsdt
billingRequired: true
apis:
- apiName: storage-component.googleapis.com
reason: Needed to use Cloud Storage
- apiName: firestore.googleapis.com
reason: Needed to use Cloud Firestore
roles:
- role: storage.objectViewer
reason: Allows the extension to read from Cloud Storage.
- role: datastore.user
reason: Allows the extension to read & write to Cloud Firestore.
resources:
- name: mirrorObjectPathHttp
type: firebaseextensions.v1beta.function
description:
Mirrors the GCS state of an object path to Firestore.
properties:
location: ${LOCATION}
runtime: nodejs10
httpsTrigger: {}
- name: mirrorFinalize
type: firebaseextensions.v1beta.function
description:
Listens for changes in your specified Cloud Storage bucket, and updates
Firestore appropriately.
properties:
location: ${LOCATION}
runtime: nodejs10
eventTrigger:
eventType: google.storage.object.finalize
resource: projects/_/buckets/${BUCKET}
- name: mirrorDelete
type: firebaseextensions.v1beta.function
description:
Listens for changes in your specified Cloud Storage bucket, and updates
Firestore appropriately.
properties:
location: ${LOCATION}
runtime: nodejs10
eventTrigger:
eventType: google.storage.object.delete
resource: projects/_/buckets/${BUCKET}
- name: mirrorArchive
type: firebaseextensions.v1beta.function
description:
Listens for changes in your specified Cloud Storage bucket, and updates
Firestore appropriately.
properties:
location: ${LOCATION}
runtime: nodejs10
eventTrigger:
eventType: google.storage.object.archive
resource: projects/_/buckets/${BUCKET}
- name: mirrorMetadataUpdate
type: firebaseextensions.v1beta.function
description:
Listens for changes in your specified Cloud Storage bucket, and updates
Firestore appropriately.
properties:
location: ${LOCATION}
runtime: nodejs10
eventTrigger:
eventType: google.storage.object.metadataUpdate
resource: projects/_/buckets/${BUCKET}
params:
- param: LOCATION
type: select
label: Cloud Functions location
description: >-
Where do you want to deploy the functions created for this extension?
You usually want a location close to your database. For help selecting a
location, refer to the [location selection
guide](https://firebase.google.com/docs/functions/locations).
options:
- label: Iowa (us-central1)
value: us-central1
- label: South Carolina (us-east1)
value: us-east1
- label: Northern Virginia (us-east4)
value: us-east4
- label: Belgium (europe-west1)
value: europe-west1
- label: London (europe-west2)
value: europe-west2
- label: Hong Kong (asia-east2)
value: asia-east2
- label: Tokyo (asia-northeast1)
value: asia-northeast1
default: us-central1
required: true
immutable: true
- param: BUCKET
type: string
label: Cloud Storage bucket to mirror
description: >
Which Cloud Storage bucket should we mirror?
default: ${STORAGE_BUCKET}
# validationRegex: (.)+\.(.)+\.(.)+
validationErrorMessage: Invalid storage bucket
example: my-project-12345.appspot.com
required: true
- param: FIRESTORE_ROOT
label: Root Document path
description: >
What is the path to the collection where documents references should be
stored?
validationRegex: "^[^/]+/[^/]+(/[^/]+/[^/]+)*$"
default: gcs-mirror/${STORAGE_BUCKET}
example: mybucket
required: true
- param: ITEMS_SUBCOLLECTION_NAME
label: Items Subcollection Name
description: >
What should we call subcollections representing GCS Objects?
default: items
example: items
required: true
- param: ITEMS_TOMBSTONES_NAME
label: Item Tombstones Subcollection Name
description: >
What should we call subcollections representing deleted GCS Objects?
default: items-tombstones
example: items-tombstones
required: true
- param: PREFIXES_SUBCOLLECTION_NAME
label: Prefixes Subcollection Name
description: >
What should we call subcollections representing Object Prefixes?
default: prefixes
example: prefixes
required: true
- param: PREFIXES_TOMBSTONES_NAME
label: Prefix Tombstones Subcollection Name
description: >
What should we call subcollections representing deleted Object Prefixes?
default: prefixes-tombstones
example: prefixes-tombstones
required: true
- param: CUSTOM_METADATA_FILTER
label: Custom Metadata Field filter
description: >
Regex describing which custom metadata fields should be mirrored.
default: ".*" # Make this filter out download tokens by default?
example: "^(?!firebaseStorageDownloadTokens).*"
- param: METADATA_FIELD_FILTER
label: Metadata Field filter
description: >
Regex describing which object metadata fields should be mirrored.
default: ".*"
example: "^(?!mediaLink).*"
- param: OBJECT_NAME_FILTER
label: Object Name filter
description: >
Regex describing which objects should be mirrored.
default: ".*"
example: "^specialPath/.*"