diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index dc3e8c50d63..ab0db3f3060 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -84,7 +84,6 @@ # Self-service # ---* Shared with DEE Teams /functions/**/* @GoogleCloudPlatform/functions-framework-google @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers -/codelabs/**/* @GoogleCloudPlatform/codelabs-contributors @GoogleCloudPlatform/python-samples-reviewers /composer/**/* @GoogleCloudPlatform/cloud-dpes-composer @GoogleCloudPlatform/python-samples-reviewers /pubsub/**/* @GoogleCloudPlatform/api-pubsub-and-pubsublite @GoogleCloudPlatform/python-samples-reviewers /pubsublite/**/* @GoogleCloudPlatform/api-pubsub-and-pubsublite @GoogleCloudPlatform/python-samples-reviewers diff --git a/codelabs/README.md b/codelabs/README.md deleted file mode 100644 index 41ec54a42b1..00000000000 --- a/codelabs/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Resources in this folder - -- This folder contains resources used in Google Cloud codelabs on [Google Developers Codelabs](https://codelabs.developers.google.com/?category=cloud). -- Each folder is named after the codelab ID. Example: - - Folder: `cloud-functions-python-http` - - Codelab: diff --git a/codelabs/cloud-functions-python-http/.gcloudignore b/codelabs/cloud-functions-python-http/.gcloudignore deleted file mode 100644 index 07d5a187ad4..00000000000 --- a/codelabs/cloud-functions-python-http/.gcloudignore +++ /dev/null @@ -1,12 +0,0 @@ -# This file specifies files that are *not* uploaded to Google Cloud -# using gcloud. It follows the same syntax as .gitignore, with the addition of -# "#!include" directives (which insert the entries of the given .gitignore-style -# file at that point). -# -# For more information, run: -# $ gcloud topic gcloudignore -# -__pycache__/** -.gcloudignore -test_*.py -web_app.py diff --git a/codelabs/cloud-functions-python-http/main.py b/codelabs/cloud-functions-python-http/main.py deleted file mode 100644 index 957509f93da..00000000000 --- a/codelabs/cloud-functions-python-http/main.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import flask - - -def hello_world(request: flask.Request) -> flask.Response: - """HTTP Cloud Function. - - Returns: - - "Hello World! 👋" - """ - response = "Hello World! 👋" - - return flask.Response(response, mimetype="text/plain") - - -def hello_name(request: flask.Request) -> flask.Response: - """HTTP Cloud Function. - - Returns: - - "Hello {NAME}! 🚀" if "name=NAME" is defined in the GET request - - "Hello World! 🚀" otherwise - """ - name = request.args.get("name", "World") - response = f"Hello {name}! 🚀" - - return flask.Response(response, mimetype="text/plain") - - -def python_powered(request: flask.Request) -> flask.Response: - """HTTP Cloud Function. - - Returns: - - The official "Python Powered" logo - """ - return flask.send_file("python-powered.png") diff --git a/codelabs/cloud-functions-python-http/python-powered.png b/codelabs/cloud-functions-python-http/python-powered.png deleted file mode 100644 index 17715a3ac7d..00000000000 Binary files a/codelabs/cloud-functions-python-http/python-powered.png and /dev/null differ diff --git a/codelabs/cloud-functions-python-http/test_main.py b/codelabs/cloud-functions-python-http/test_main.py deleted file mode 100644 index 933c4eddcdb..00000000000 --- a/codelabs/cloud-functions-python-http/test_main.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import unittest -import unittest.mock - -import main - - -class TestHello(unittest.TestCase): - def test_hello_world(self): - request = unittest.mock.Mock() - - response = main.hello_world(request) - assert response.status_code == 200 - assert response.get_data(as_text=True) == "Hello World! 👋" - - def test_hello_name_no_name(self): - request = unittest.mock.Mock(args={}) - - response = main.hello_name(request) - assert response.status_code == 200 - assert response.get_data(as_text=True) == "Hello World! 🚀" - - def test_hello_name_with_name(self): - name = "FirstName LastName" - request = unittest.mock.Mock(args={"name": name}) - - response = main.hello_name(request) - assert response.status_code == 200 - assert response.get_data(as_text=True) == f"Hello {name}! 🚀" diff --git a/codelabs/cloud-functions-python-http/web_app.py b/codelabs/cloud-functions-python-http/web_app.py deleted file mode 100644 index 85ca70e5ab6..00000000000 --- a/codelabs/cloud-functions-python-http/web_app.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import flask - -import main - -app = flask.Flask(__name__) - - -@app.get("/") -def index(): - return main.python_powered(flask.request) - - -if __name__ == "__main__": - # Local development only - # Run "python web_app.py" and open http://localhost:8080 - app.run(host="localhost", port=8080, debug=True)