Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove quarkiverse-google-cloud-services dependencies #3188

Merged
merged 1 commit into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ Check the xref:user-guide/index.adoc[User guide] for more information about writ

== Usage

This extension leverages the Quarkiverse Google Cloud Services extension.
The https://github.com/quarkiverse/quarkiverse-google-cloud-services[documentation] describes how to configure authentication for Google cloud services.

For convenience, a `GoogleBigQueryConnectionFactory` for use by the `google-bigquery` & `google-bigquery-sql` component is automatically configured.

If you want to read SQL scripts from the classpath with `google-bigquery-sql` in native mode,
then you will need to ensure that they are added to the native image via the `quarkus.native.resources.includes` configuration property.
Please check https://quarkus.io/guides/building-native-image#quarkus-native-pkg-native-config_quarkus.native.resources.includes[Quarkus documentation] for more details.
Expand Down
15 changes: 0 additions & 15 deletions docs/modules/ROOT/pages/reference/extensions/google-storage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,3 @@ Check the xref:user-guide/index.adoc[User guide] for more information about writ
This extension auto-enables SSL support in native mode. Hence you do not need to add
`quarkus.ssl.native=true` to your `application.properties` yourself. See also
https://quarkus.io/guides/native-and-ssl[Quarkus SSL guide].

== Additional Camel Quarkus configuration

There are two different configuration approaches:

* Google storage client can be defined via quarkus properties leveraging the Quarkiverse - Google Cloud Services - Storage (see https://github.com/quarkiverse/quarkus-google-cloud-services/blob/main/storage[extension git page]).
Camel will autowire client into the Google-storage component.
This configuration allows definition of only one storage client, therefore it isn't possible to define several different endpoints, which run together.

* When multiple storage clients are needed, one or more storage client bean need to be registered in the registry (e.g. via a CDI bean producer). Each storage client bean could then be referenced from distinct endpoints.
[source,properties]
----
google-storage://bucket?storageClient=#my_client
----

4 changes: 0 additions & 4 deletions extensions/google-bigquery/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
<name>Camel Quarkus :: Google BigQuery :: Deployment</name>

<dependencies>
<dependency>
<groupId>io.quarkiverse.googlecloudservices</groupId>
<artifactId>quarkus-google-cloud-bigquery-deployment</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-core-deployment</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
*/
package org.apache.camel.quarkus.component.google.bigquery.deployment;

import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import org.apache.camel.quarkus.component.google.bigquery.GoogleBigQueryConnectionFactoryProducer;

class GoogleBigqueryProcessor {
private static final String FEATURE = "camel-google-bigquery";
Expand All @@ -28,9 +26,4 @@ class GoogleBigqueryProcessor {
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}

@BuildStep
public AdditionalBeanBuildItem connectionFactoryProducerBean() {
return new AdditionalBeanBuildItem(GoogleBigQueryConnectionFactoryProducer.class);
}
}
4 changes: 2 additions & 2 deletions extensions/google-bigquery/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@

<dependencies>
<dependency>
<groupId>io.quarkiverse.googlecloudservices</groupId>
<artifactId>quarkus-google-cloud-bigquery</artifactId>
<groupId>com.google.cloud</groupId>
<artifactId>native-image-support</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
Expand Down
5 changes: 0 additions & 5 deletions extensions/google-bigquery/runtime/src/main/doc/usage.adoc
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
This extension leverages the Quarkiverse Google Cloud Services extension.
The https://github.com/quarkiverse/quarkiverse-google-cloud-services[documentation] describes how to configure authentication for Google cloud services.

For convenience, a `GoogleBigQueryConnectionFactory` for use by the `google-bigquery` & `google-bigquery-sql` component is automatically configured.

If you want to read SQL scripts from the classpath with `google-bigquery-sql` in native mode,
then you will need to ensure that they are added to the native image via the `quarkus.native.resources.includes` configuration property.
Please check https://quarkus.io/guides/building-native-image#quarkus-native-pkg-native-config_quarkus.native.resources.includes[Quarkus documentation] for more details.

This file was deleted.

4 changes: 2 additions & 2 deletions extensions/google-pubsub/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
<artifactId>quarkus-jackson-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.googlecloudservices</groupId>
<artifactId>quarkus-google-cloud-pubsub-deployment</artifactId>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-grpc-common-deployment</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
Expand Down
8 changes: 6 additions & 2 deletions extensions/google-pubsub/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@
<artifactId>quarkus-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.googlecloudservices</groupId>
<artifactId>quarkus-google-cloud-pubsub</artifactId>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-grpc-common</artifactId>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>native-image-support</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
Expand Down
5 changes: 0 additions & 5 deletions extensions/google-storage/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-google-storage</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.googlecloudservices</groupId>
<artifactId>quarkus-google-cloud-storage-deployment</artifactId>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
*/
package org.apache.camel.quarkus.component.google.storage.deployment;

import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import org.apache.camel.quarkus.component.google.storage.GoogleStorageEnforcer;

class GoogleStorageProcessor {

Expand All @@ -35,9 +33,4 @@ FeatureBuildItem feature() {
ExtensionSslNativeSupportBuildItem activateSslNativeSupport() {
return new ExtensionSslNativeSupportBuildItem(FEATURE);
}

@BuildStep
public AdditionalBeanBuildItem storageEnforcer() {
return new AdditionalBeanBuildItem(GoogleStorageEnforcer.class);
}
}
15 changes: 4 additions & 11 deletions extensions/google-storage/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,18 @@
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>native-image-support</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-google-storage</artifactId>
<exclusions>
<exclusion>
<artifactId>google-cloud-storage</artifactId>
<groupId>com.google.cloud</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkiverse.googlecloudservices</groupId>
<artifactId>quarkus-google-cloud-storage</artifactId>
</dependency>

</dependencies>

<build>
Expand Down
11 changes: 0 additions & 11 deletions extensions/google-storage/runtime/src/main/doc/configuration.adoc

This file was deleted.

This file was deleted.

5 changes: 2 additions & 3 deletions integration-tests/google-bigquery/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ mode does not provide the required capabilities (streaming inserts & queries) th
The simplest means of setting up authentication is via a https://cloud.google.com/docs/authentication/getting-started[service account]. Use the GCP UI to export
a JSON representation of your credentials.

You should now set the following environment variable:
You should now set the following environment variables:

[source,shell]
----
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
export GOOGLE_PROJECT_ID=your-gcloud-project-id
----

You should also modify `application.properties` so that `quarkus.google.cloud.project-id` is correct for your GCP project.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import com.google.cloud.bigquery.BigQuery;
import org.apache.camel.ProducerTemplate;
import org.eclipse.microprofile.config.inject.ConfigProperty;

@Path("/google-bigquery")
public class GoogleBigqueryResource {
Expand All @@ -42,26 +42,27 @@ public class GoogleBigqueryResource {
public static final String TABLE_NAME = "camel_quarkus_basic";

@Inject
BigQuery bigQuery;
ProducerTemplate producerTemplate;

@Inject
ProducerTemplate producerTemplate;
@ConfigProperty(name = "google.project.id", defaultValue = "test")
String projectId;

String tableId = DATASET_ID + "." + TABLE_NAME;

@Path("/table")
@POST
public Response createTable() {
String sql = "CREATE TABLE `" + tableId + "` (id NUMERIC, col1 STRING, col2 STRING)";
producerTemplate.requestBody("google-bigquery-sql:" + getProjectId() + ":" + sql, null,
producerTemplate.requestBody("google-bigquery-sql:" + projectId + ":" + sql, null,
Long.class);
return Response.created(URI.create("https://camel.apache.org")).build();
}

@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response insertRow(Map<String, String> tableData) {
producerTemplate.requestBody("google-bigquery:" + getProjectId() + ":" + DATASET_ID + ":" + TABLE_NAME, tableData);
producerTemplate.requestBody("google-bigquery:" + projectId + ":" + DATASET_ID + ":" + TABLE_NAME, tableData);
return Response.created(URI.create("https://camel.apache.org")).build();
}

Expand All @@ -70,7 +71,7 @@ public Response insertRow(Map<String, String> tableData) {
@Produces(MediaType.APPLICATION_JSON)
public Response getRow() {
String sql = "SELECT * FROM `" + tableId + "`";
Long rowCount = producerTemplate.requestBody("google-bigquery-sql:" + getProjectId() + ":" + sql, null, Long.class);
Long rowCount = producerTemplate.requestBody("google-bigquery-sql:" + projectId + ":" + sql, null, Long.class);
return Response.ok(rowCount).build();
}

Expand All @@ -85,7 +86,7 @@ public Response getRowUsingQueryResource() throws IOException {
Files.write(sqlFile, sql.getBytes(StandardCharsets.UTF_8));

Long rowCount = producerTemplate.requestBody(
"google-bigquery-sql:" + getProjectId() + ":file:" + sqlFile.toAbsolutePath().toString(),
"google-bigquery-sql:" + projectId + ":file:" + sqlFile.toAbsolutePath().toString(),
null, Long.class);
return Response.ok(rowCount).build();
}
Expand All @@ -95,11 +96,7 @@ public Response getRowUsingQueryResource() throws IOException {
@Produces(MediaType.TEXT_PLAIN)
public Response dropTable() {
String sql = "DROP TABLE `" + tableId + "`";
producerTemplate.requestBody("google-bigquery-sql:" + getProjectId() + ":" + sql, null, Long.class);
producerTemplate.requestBody("google-bigquery-sql:" + projectId + ":" + sql, null, Long.class);
return Response.ok().build();
}

private String getProjectId() {
return bigQuery.getOptions().getProjectId();
}
}
10 changes: 3 additions & 7 deletions integration-tests/google-storage/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ You can find more info in the https://cloud.google.com/storage/docs/reference/li

When you have the **service account key** you can provide authentication credentials to your application code by setting the environment variable:

`export GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/my-key.json"`
`export GOOGLE_PROJECT_ID="#name of project"`

or for windows:

`$Env:GOOGLE_APPLICATION_CREDENTIALS = "/home/user/Downloads/my-key.json"`
`$Env:GOOGLE_PROJECT_ID="#name of project"`
```
export GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/my-key.json"
```