Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 839eb0f

Browse files
authored
Eventarc Quickstart Brushup (GoogleCloudPlatform#4762)
## Eventarc Quickstart Brushup - Region tag fixes
1 parent bb8b268 commit 839eb0f

File tree

5 files changed

+18
-15
lines changed

5 files changed

+18
-15
lines changed

eventarc/audit-storage/Dockerfile

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

15-
# [START run_events_gcs_dockerfile]
15+
# [START eventarc_gcs_dockerfile]
1616

1717
# Use the official Python image.
1818
# https://hub.docker.com/_/python
@@ -38,4 +38,4 @@ COPY . ./
3838
# For environments with multiple CPU cores, increase the number of workers
3939
# to be equal to the cores available.
4040
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app
41-
# [END run_events_gcs_dockerfile]
41+
# [END eventarc_gcs_dockerfile]

eventarc/audit-storage/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Cloud Eventarc – GCS tutorial
1+
# Cloud Eventarc - Cloud Storage via Audit Logs tutorial
22

33
This sample shows how to create a service that processes GCS using [the CloudEvents SDK](https://github.com/cloudevents/sdk-python).
44

eventarc/audit-storage/main.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
# [START run_events_gcs_handler]
14+
15+
# [START eventarc_gcs_server]
1516
import os
1617

1718
import cloudevents.exceptions as cloud_exceptions
@@ -22,8 +23,10 @@
2223

2324
required_fields = ['Ce-Id', 'Ce-Source', 'Ce-Type', 'Ce-Specversion']
2425
app = Flask(__name__)
26+
# [END eventarc_gcs_server]
2527

2628

29+
# [START eventarc_gcs_handler]
2730
@app.route('/', methods=['POST'])
2831
def index():
2932
# Create CloudEvent from HTTP headers and body
@@ -49,10 +52,10 @@ def index():
4952

5053
print(f"Detected change in GCS bucket: {event['subject']}")
5154
return (f"Detected change in GCS bucket: {event['subject']}", 200)
52-
# [END run_events_gcs_handler]
55+
# [END eventarc_gcs_handler]
5356

5457

55-
# [START run_events_gcs_server]
58+
# [START eventarc_gcs_server]
5659
if __name__ == "__main__":
5760
app.run(debug=True, host='0.0.0.0', port=int(os.environ.get('PORT', 8080)))
58-
# [END run_events_gcs_server]
61+
# [END eventarc_gcs_server]

eventarc/pubsub/Dockerfile

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

15-
# [START run_events_pubsub_dockerfile]
15+
# [START eventarc_pubsub_dockerfile]
1616

1717
# Use the official Python image.
1818
# https://hub.docker.com/_/python
@@ -38,4 +38,4 @@ COPY . ./
3838
# For environments with multiple CPU cores, increase the number of workers
3939
# to be equal to the cores available.
4040
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app
41-
# [END run_events_pubsub_dockerfile]
41+
# [END eventarc_pubsub_dockerfile]

eventarc/pubsub/main.py

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

15-
# [START run_events_pubsub_server_setup]
15+
# [START eventarc_pubsub_server]
1616
import base64
1717

1818
import os
@@ -26,10 +26,10 @@
2626
required_fields = ['Ce-Id', 'Ce-Source', 'Ce-Type', 'Ce-Specversion']
2727

2828
app = Flask(__name__)
29-
# [END run_events_pubsub_server_setup]
29+
# [END eventarc_pubsub_server]
3030

3131

32-
# [START run_events_pubsub_handler]
32+
# [START eventarc_pubsub_handler]
3333
@app.route('/', methods=['POST'])
3434
def index():
3535
# Create CloudEvent from HTTP headers and body
@@ -69,10 +69,10 @@ def index():
6969
resp = f"Hello, {name}! ID: {event['id']}"
7070
print(resp)
7171
return (resp, 200)
72-
# [END run_events_pubsub_handler]
72+
# [END eventarc_pubsub_handler]
7373

7474

75-
# [START run_events_pubsub_server]
75+
# [START eventarc_pubsub_server]
7676
if __name__ == "__main__":
7777
app.run(debug=True, host='0.0.0.0', port=int(os.environ.get('PORT', 8080)))
78-
# [END run_events_pubsub_server]
78+
# [END eventarc_pubsub_server]

0 commit comments

Comments
 (0)