Skip to content

Commit 99a9df6

Browse files
authored
refactor!: rename cloudevent to cloud_event (GoogleCloudPlatform#167)
1 parent 85b7e43 commit 99a9df6

24 files changed

+171
-171
lines changed

.github/workflows/conformance.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
validateMapping: true
4242
cmd: "'functions-framework --source tests/conformance/main.py --target write_legacy_event --signature-type event'"
4343

44-
- name: Run cloudevent conformance tests
44+
- name: Run CloudEvents conformance tests
4545
uses: GoogleCloudPlatform/functions-framework-conformance/action@v1.1.0
4646
with:
4747
version: 'v1.1.0'
@@ -59,11 +59,11 @@ jobs:
5959
validateMapping: false
6060
cmd: "'functions-framework --source tests/conformance/main.py --target write_http_declarative'"
6161

62-
- name: Run cloudevent conformance tests declarative
62+
- name: Run CloudEvents conformance tests declarative
6363
uses: GoogleCloudPlatform/functions-framework-conformance/action@v1.1.0
6464
with:
6565
version: 'v1.1.0'
6666
functionType: 'cloudevent'
6767
useBuildpacks: false
6868
validateMapping: true
69-
cmd: "'functions-framework --source tests/conformance/main.py --target write_cloudevent_declarative'"
69+
cmd: "'functions-framework --source tests/conformance/main.py --target write_cloud_event_declarative'"

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ Create an `main.py` file with the following contents:
118118
```python
119119
import functions_framework
120120

121-
@functions_framework.cloudevent
122-
def hello_cloudevent(cloudevent):
123-
return f"Received event with ID: {cloudevent['id']} and data {cloudevent.data}"
121+
@functions_framework.cloud_event
122+
def hello_cloud_event(cloud_event):
123+
return f"Received event with ID: {cloud_event['id']} and data {cloud_event.data}"
124124

125125
@functions_framework.http
126126
def hello_http(request):
@@ -136,13 +136,13 @@ functions-framework --target=hello_http
136136

137137
Open http://localhost:8080/ in your browser and see *Hello world!*.
138138

139-
Run the following command to run `hello_cloudevent` target locally:
139+
Run the following command to run `hello_cloud_event` target locally:
140140

141141
```sh
142-
functions-framework --target=hello_cloudevent
142+
functions-framework --target=hello_cloud_event
143143
```
144144

145-
More info on sending [CloudEvents](http://cloudevents.io) payloads, see [`examples/cloud_run_cloudevents`](examples/cloud_run_cloudevents/) instruction.
145+
More info on sending [CloudEvents](http://cloudevents.io) payloads, see [`examples/cloud_run_cloud_events`](examples/cloud_run_cloud_events/) instruction.
146146

147147

148148
### Quickstart: Error handling
@@ -358,11 +358,11 @@ See the [running example](examples/cloud_run_event).
358358

359359
## Enable CloudEvents
360360

361-
The Functions framework can also unmarshall incoming [CloudEvents](http://cloudevents.io) payloads to the `cloudevent` object. This will be passed as a [cloudevent](https://github.com/cloudevents/sdk-python) to your function when it receives a request. Note that your function must use the `cloudevents`-style function signature:
361+
The Functions framework can also unmarshall incoming [CloudEvents](http://cloudevents.io) payloads to the `cloud_event` object. This will be passed as a [CloudEvent](https://github.com/cloudevents/sdk-python) to your function when it receives a request. Note that your function must use the `CloudEvents`-style function signature:
362362

363363
```python
364-
def hello(cloudevent):
365-
print(f"Received event with ID: {cloudevent['id']}")
364+
def hello(cloud_event):
365+
print(f"Received event with ID: {cloud_event['id']}")
366366
```
367367

368368
To enable automatic unmarshalling, set the function signature type to `cloudevent` using the `--signature-type` command-line flag or the `FUNCTION_SIGNATURE_TYPE` environment variable. By default, the HTTP signature type will be used and automatic event unmarshalling will be disabled.

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
### Cloud Run
55
* [`cloud_run_http`](./cloud_run_http/) - Deploying an HTTP function to [Cloud Run](http://cloud.google.com/run) with the Functions Framework
66
* [`cloud_run_event`](./cloud_run_event/) - Deploying a CloudEvent function to [Cloud Run](http://cloud.google.com/run) with the Functions Framework
7-
* [`cloud_run_cloudevents`](./cloud_run_cloudevents/) - Deploying a [CloudEvent](https://github.com/cloudevents/sdk-python) function to [Cloud Run](http://cloud.google.com/run) with the Functions Framework
7+
* [`cloud_run_cloud_events`](cloud_run_cloud_events/) - Deploying a [CloudEvent](https://github.com/cloudevents/sdk-python) function to [Cloud Run](http://cloud.google.com/run) with the Functions Framework
88

99
## Development Tools
1010
* [`docker-compose`](./docker-compose) -

examples/cloud_run_cloudevents/README.md renamed to examples/cloud_run_cloud_events/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ This sample uses the [CloudEvents SDK](https://github.com/cloudevents/sdk-python
77
Build the Docker image:
88

99
```commandline
10-
docker build -t cloudevent_example .
10+
docker build -t cloud_event_example .
1111
```
1212

1313
Run the image and bind the correct ports:
1414

1515
```commandline
16-
docker run --rm -p 8080:8080 -e PORT=8080 cloudevent_example
16+
docker run --rm -p 8080:8080 -e PORT=8080 cloud_event_example
1717
```
1818

1919
Send an event to the container:
2020

2121
```python
22-
docker run -t cloudevent_example send_cloudevent.py
22+
docker run -t cloud_event_example send_cloud_event.py
2323
```

examples/cloud_run_cloudevents/main.py renamed to examples/cloud_run_cloud_events/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
# (https://github.com/cloudevents/sdk-python)
1717

1818

19-
def hello(cloudevent):
20-
print(f"Received event with ID: {cloudevent['id']} and data {cloudevent.data}")
19+
def hello(cloud_event):
20+
print(f"Received event with ID: {cloud_event['id']} and data {cloud_event.data}")

examples/cloud_run_decorator/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## How to run this locally
22

33
This guide shows how to run `hello_http` target locally.
4-
To test with `hello_cloudevent`, change the target accordingly in Dockerfile.
4+
To test with `hello_cloud_event`, change the target accordingly in Dockerfile.
55

66
Build the Docker image:
77

examples/cloud_run_decorator/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
import functions_framework
1818

1919

20-
@functions_framework.cloudevent
21-
def hello_cloudevent(cloudevent):
22-
return f"Received event with ID: {cloudevent['id']} and data {cloudevent.data}"
20+
@functions_framework.cloud_event
21+
def hello_cloud_event(cloud_event):
22+
return f"Received event with ID: {cloud_event['id']} and data {cloud_event.data}"
2323

2424

2525
@functions_framework.http

0 commit comments

Comments
 (0)