Skip to content

Commit

Permalink
Merge pull request #44594 from loicmathieu/gcf-guides
Browse files Browse the repository at this point in the history
Google Cloud Function gen 2 is now the default
  • Loading branch information
gsmet authored Nov 20, 2024
2 parents a14d4c7 + 194a966 commit b01ea1c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 23 deletions.
10 changes: 1 addition & 9 deletions docs/src/main/asciidoc/funqy-gcp-functions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ In this example, we will create two background functions and a cloud events func
Background functions allow you to react to Google Cloud events like PubSub messages, Cloud Storage events, Firestore events, ...
Cloud events functions allow you to react to supported events using the Cloud Events specification.

NOTE: Quarkus supports Cloud Functions gen 1 and gen 2. For an overview of Cloud Functions gen 2 see https://cloud.google.com/functions/docs/2nd-gen/overview[this page] on the Google Cloud Functions documentation. To use gen 2 you must add the `--gen2` parameter.

[source,java]
----
import jakarta.inject.Inject;
Expand Down Expand Up @@ -231,8 +229,6 @@ You can also simply add a file to Cloud Storage using the command line of the we

=== Cloud Events Functions - Cloud Storage

WARNING: Cloud Events Function is a feature of Cloud Functions gen 2 only.

Before deploying your function, you need to create a bucket.

[source,bash]
Expand All @@ -244,7 +240,7 @@ Then, use this command to deploy to Google Cloud Functions:

[source,bash]
----
gcloud functions deploy quarkus-example-cloud-event --gen2 \
gcloud functions deploy quarkus-example-cloud-event \
--entry-point=io.quarkus.funqy.gcp.functions.FunqyCloudEventsFunction \
--runtime=java21 --trigger-bucket=example-cloud-event --source=target/deployment
----
Expand Down Expand Up @@ -324,8 +320,6 @@ This will call your PubSub background function with a Cloud Storage event `{"nam

=== Cloud Events Functions - Cloud Storage

WARNING: Cloud Events Function is a feature of Cloud Functions gen 2 only.

For cloud events functions, you launch the invoker with a target class of `io.quarkus.funqy.gcp.functions.FunqyCloudEventsFunction``.

[source,bash,subs="attributes"]
Expand Down Expand Up @@ -457,8 +451,6 @@ class GreetingFunctionsStorageTest {

=== Cloud Events Functions - Cloud Storage

WARNING: Cloud Events Function is a feature of Cloud Functions gen 2 only.

[source,java]
----
import static io.restassured.RestAssured.given;
Expand Down
4 changes: 1 addition & 3 deletions docs/src/main/asciidoc/gcp-functions-http.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,11 @@ one for Reactive routes and one for xref:funqy-http.adoc[Funqy HTTP].
[NOTE]
====
These various endpoints are for demonstration purposes.
For real life applications, you should choose one of this technology and stick to it.
For real life applications, you should choose one of these technologies and stick to it.
====

If you don't need endpoints of each type, you can remove the corresponding extensions from your `pom.xml`.

NOTE: Quarkus supports Cloud Functions gen 1 and gen 2. For an overview of Cloud Functions gen 2 see https://cloud.google.com/functions/docs/2nd-gen/overview[this page] on the Google Cloud Functions documentation. To use gen 2 you must and add the `--gen2` parameter.

=== The Jakarta REST endpoint

[source,java]
Expand Down
12 changes: 1 addition & 11 deletions docs/src/main/asciidoc/gcp-functions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ gcloud auth login
For this example project, we will create four functions, one `HttpFunction`, one `BackgroundFunction` (Storage event),
one `RawBackgroundFunction` (PubSub event) and one `CloudEventsFunction` (storage event using the Cloud Events specification).

NOTE: Quarkus supports Cloud Functions gen 1 and gen 2. For an overview of Cloud Functions gen 2 see https://cloud.google.com/functions/docs/2nd-gen/overview[this page] on the Google Cloud Functions documentation. To use gen 2 you must add the `--gen2` parameter.

== Choose Your Function

The `quarkus-google-cloud-functions` extension scans your project for a class that directly implements the Google Cloud `HttpFunction`, `BackgroundFunction`, `RawBackgroundFunction` or `CloudEventsFunction` interface.
Expand Down Expand Up @@ -193,8 +191,6 @@ public class RawBackgroundFunctionPubSubTest implements RawBackgroundFunction {

=== The CloudEventsFunction

WARNING: `CloudEventsFunction` is a feature of Cloud Functions gen 2 only.

This `CloudEventsFunction` is triggered by a Cloud Events Storage event, you can use any Cloud Events supported by Google Cloud instead.

[source,java]
Expand Down Expand Up @@ -332,14 +328,12 @@ gcloud functions call quarkus-example-pubsub --data '{"data":{"greeting":"world"

=== The CloudEventsFunction

WARNING: `CloudEventsFunction` is a feature of Cloud Functions gen 2 only.

This is an example command to deploy your `CloudEventsFunction` to Google Cloud, as the function is triggered by a Storage event,
it needs to use `--trigger-bucket` parameter with the name of a previously created bucket:

[source,bash]
----
gcloud functions deploy quarkus-example-cloud-event --gen2 \
gcloud functions deploy quarkus-example-cloud-event \
--entry-point=io.quarkus.gcp.functions.QuarkusCloudEventsFunction \
--runtime=java21 --trigger-bucket=example-cloud-event --source=target/deployment
----
Expand Down Expand Up @@ -429,8 +423,6 @@ This will call your PubSub background function with a PubSubMessage `{"greeting"

=== The CloudEventsFunction

IMPORTANT: `CloudEventsFunction` is a feature of Cloud Function gen 2 only.

For cloud events functions, you launch the invoker with a target class of `io.quarkus.gcp.functions.QuarkusCloudEventsFunction`.

[source,bash,subs="attributes"]
Expand Down Expand Up @@ -592,8 +584,6 @@ class RawBackgroundFunctionPubSubTestCase {

=== The CloudEventsFunction

WARNING: Cloud Events Function is a feature of Cloud Functions gen 2 only.

[source,java]
----
import static io.restassured.RestAssured.given;
Expand Down

0 comments on commit b01ea1c

Please sign in to comment.