8000 refactor: update gcs sample (#7121) · orossini/python-docs-samples@5cbed1b · GitHub
[go: up one dir, main page]

Skip to content

Commit 5cbed1b

Browse files
KaylaNguyenAce Nassridandhleeengelke
authored
refactor: update gcs sample (GoogleCloudPlatform#7121)
* refactor: update gcs sample * fix rebase Co-authored-by: Ace Nassri <anassri@google.com> Co-authored-by: Dan Lee <71398022+dandhlee@users.noreply.github.com> Co-authored-by: Charles Engelke <engelke@google.com>
1 parent 081b19b commit 5cbed1b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

functions/v2/storage/main.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import functions_framework
16+
1517

1618
# [START functions_helloworld_storage]
1719
# Triggered by a change in a storage bucket
18-
def hello_gcs(cloudevent):
19-
data = cloudevent.data
20+
@functions_framework.cloud_event
21+
def hello_gcs(cloud_event):
22+
data = cloud_event.data
2023

21-
event_id = cloudevent["id"]
22-
event_type = cloudevent["type"]
24+
event_id = cloud_event["id"]
25+
event_type = cloud_event["type"]
2326

2427
bucket = data["bucket"]
2528
name = data["name"]

functions/v2/storage/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
functions-framework==3.0.0

0 commit comments

Comments
 (0)
0