This repository was archived by the owner on Nov 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.yaml
More file actions
40 lines (40 loc) · 1.62 KB
/
template.yaml
File metadata and controls
40 lines (40 loc) · 1.62 KB
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
parameters:
- name: STORE
description: "The store to watch to trigger the function and save the GCP Video intelligence result."
type: STORE_REF
required: true
- name: GCP_KEY
description: "The name of the secret in which the GCP service account will be stored."
type: SECRET_REF
required: true
- name: VIDEO_INTELLIGENCE_FILE_PREFIX
description: "The file prefix used to store the GCP Video intelligence response."
type: "STRING"
default: "gcp-video-intelligence"
- name: VIDEO_INTELLIGENCE_FEATURE
description: "The name of the video intelligence feature to perform: LABEL_DETECTION, FACE_DETECTION, PERSON_DETECTION, SPEECH_TRANSCRIPTION or LOGO_RECOGNITION."
type: "STRING"
default: "LABEL_DETECTION"
template: |
env:
GOOGLE_APPLICATION_CREDENTIALS: /credentials/gcp-key
{{ if .VIDEO_INTELLIGENCE_FILE_REFIX }}
VIDEO_INTELLIGENCE_FILE_REFIX: {{ .VIDEO_INTELLIGENCE_FILE_PREFIX }}
{{ end }}
{{ if .VIDEO_INTELLIGENCE_FEATURE }}
VIDEO_INTELLIGENCE_FEATURE: {{ .VIDEO_INTELLIGENCE_FEATURE }}
{{ end }}
volumes:
- name: {{ .STORE }}
store: {{ .STORE }}
- secret: {{ .GCP_KEY }}
name: "gcp-key"
path: /credentials
events:
- cloudevent:
expression: |
event.source == "koyeb.com/gateway" &&
event.subject == "{{ .STORE }}" &&
event.type.matches("s3:ObjectCreated:.*") &&
!data.object.key.startsWith("{{ .VIDEO_INTELLIGENCE_FILE_PREFIX }}") &&
data.object.key.matches("([^\\s]+(\\.(?i)(avi|mp4|mpeg4|mov))$)")