forked from rominirani/googlecloudfunctions-training
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommands.txt
More file actions
77 lines (62 loc) · 2.26 KB
/
commands.txt
File metadata and controls
77 lines (62 loc) · 2.26 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
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
# Clear up all the functions deployed
gcloud auth login
gcloud config set project gcf-live-training
gcloud beta functions list
# repeat for each of the functions listed above that you want to delete
gcloud beta functions delete fname
gcloud commands
---------------
gcloud beta functions event-types list
gcloud beta functions regions list
gcloud beta functions logs read
gcloud beta functions deploy helloGET --trigger-http
gcloud beta functions list
gcloud beta functions describe helloGET
gcloud beta functions call helloGET
gcloud beta functions deploy helloGreeting --trigger-http
gcloud beta functions call helloGreeting --data '{"name":"Hello"}'
gcloud beta functions logs read
gcloud beta functions logs read --execution-id <id>
# pub/sub command in gcloud
gcloud beta pubsub topics list
gcloud beta pubsub topics publish projects/gcf-live-training/topics/pubsubtopic1 --message Hello
gcloud functions logs read --limit=10
gcloud beta functions call pubsubfunction1 --data '{"data":"R29vZ2xlIENsb3VkIEZ1bmN0aW9ucw=="}'
# gcs commands in gcloud
gsutil ls
gsutil cp package.json gs://gcs-function-bucket1/
gcloud beta functions logs read --limit=20
# deploying pub/sub trigger based function
gcloud beta functions deploy FUNCTION_NAME \
--trigger-resource [YOUR_TRIGGER_PUBSUB_TOPIC_NAME] \
--trigger-event google.pubsub.topic.publish
# deploying gcs trigger based function
gcloud beta functions deploy FUNCTION_NAME \
--trigger-resource [YOUR_TRIGGER_BUCKET_NAME] \
--trigger-event google.storage.object.finalize
Local Emulator
--------------
functions config set projectId <projectid>
functions start
functions list
cd helloworld-http
functions deploy helloGET --trigger-http
functions list
functions call helloGET
functions logs read
cd ..\hellogreeting-http
functions deploy helloGreeting --trigger-http
functions list
functions call helloGreeting --data '{"name":"Local Emulator"}'
functions logs read
#other commands
functions reset <fname>
functions logs clear
functions delete <fname>
functions stop
# Local Debugging using functions Emulator
cd hello-localfunctions
functions deploy localfunction --trigger-http
functions inspect localfunction
# Launch the browser and chrome://inspect and go to target and then sources , place breakpoints
functions call localfunction