diff --git a/.github/generated-files-bot.yml b/.github/generated-files-bot.yml new file mode 100644 index 00000000..20f3acc2 --- /dev/null +++ b/.github/generated-files-bot.yml @@ -0,0 +1,7 @@ +externalManifests: +- type: json + file: 'synth.metadata' + jsonpath: '$.generatedFiles[*]' +- type: json + file: '.github/readme/synth.metadata/synth.metadata' + jsonpath: '$.generatedFiles[*]' diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata index b834a70b..7a0182ab 100644 --- a/.github/readme/synth.metadata/synth.metadata +++ b/.github/readme/synth.metadata/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigqueryconnection.git", - "sha": "d61bb123ba452e14e87e9b38b0d09010bfc32542" + "sha": "3ffe6f4aace3297265a82cb767b53928e3bebd54" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "ea52b8a0bd560f72f376efcf45197fb7c8869120" + "sha": "b19b401571e77192f8dd38eab5fb2300a0de9324" } } ] diff --git a/.kokoro/build.sh b/.kokoro/build.sh index bed3431f..f9909c61 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -59,6 +59,10 @@ javadoc) RETURN_CODE=$? ;; integration) + if [ -f "${KOKORO_GFILE_DIR}/secret_manager/java-bigqueryconnection-samples-secrets" ] + then + source "${KOKORO_GFILE_DIR}/secret_manager/java-bigqueryconnection-samples-secrets" + fi mvn -B ${INTEGRATION_TEST_ARGS} \ -Penable-integration-tests \ -DtrimStackTrace=false \ diff --git a/.kokoro/readme.sh b/.kokoro/readme.sh index 9a18cafd..4c92e2b8 100755 --- a/.kokoro/readme.sh +++ b/.kokoro/readme.sh @@ -28,9 +28,18 @@ echo "https://${GITHUB_TOKEN}:@github.com" >> ~/.git-credentials git config --global credential.helper 'store --file ~/.git-credentials' python3.6 -m pip install git+https://github.com/googleapis/synthtool.git#egg=gcp-synthtool + +set +e python3.6 -m autosynth.synth \ --repository=googleapis/java-bigqueryconnection \ --synth-file-name=.github/readme/synth.py \ --metadata-path=.github/readme/synth.metadata \ --pr-title="chore: regenerate README" \ - --branch-suffix="readme" \ No newline at end of file + --branch-suffix="readme" + +# autosynth returns 28 to signal there are no changes +RETURN_CODE=$? +if [[ ${RETURN_CODE} -ne 0 && ${RETURN_CODE} -ne 28 ]] +then + exit ${RETURN_CODE} +fi diff --git a/.kokoro/release/publish_javadoc.cfg b/.kokoro/release/publish_javadoc.cfg index d1fabe32..0f6e481b 100644 --- a/.kokoro/release/publish_javadoc.cfg +++ b/.kokoro/release/publish_javadoc.cfg @@ -9,7 +9,7 @@ env_vars: { env_vars: { key: "STAGING_BUCKET_V2" - value: "docs-staging-v2-staging" + value: "docs-staging-v2" # Production will be at: docs-staging-v2 } diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ef7fb59..c0e41713 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.0.2](https://www.github.com/googleapis/java-bigqueryconnection/compare/v1.0.1...v1.0.2) (2020-11-11) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.15.0 ([#225](https://www.github.com/googleapis/java-bigqueryconnection/issues/225)) ([7c8fe54](https://www.github.com/googleapis/java-bigqueryconnection/commit/7c8fe5493378e3aea952259cd2bfafa8b87fbcd3)) + ### [1.0.1](https://www.github.com/googleapis/java-bigqueryconnection/compare/v1.0.0...v1.0.1) (2020-10-31) diff --git a/README.md b/README.md index dbca9410..ef5e556b 100644 --- a/README.md +++ b/README.md @@ -17,18 +17,18 @@ If you are using Maven, add this to your pom.xml file: com.google.cloud google-cloud-bigqueryconnection - 1.0.0 + 1.0.1 ``` If you are using Gradle, add this to your dependencies ```Groovy -compile 'com.google.cloud:google-cloud-bigqueryconnection:1.0.0' +compile 'com.google.cloud:google-cloud-bigqueryconnection:1.0.1' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigqueryconnection" % "1.0.0" +libraryDependencies += "com.google.cloud" % "google-cloud-bigqueryconnection" % "1.0.1" ``` ## Authentication diff --git a/google-cloud-bigqueryconnection-bom/pom.xml b/google-cloud-bigqueryconnection-bom/pom.xml index a6f90ee2..b116c49c 100644 --- a/google-cloud-bigqueryconnection-bom/pom.xml +++ b/google-cloud-bigqueryconnection-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-bigqueryconnection-bom - 1.0.1 + 1.0.2 pom com.google.cloud @@ -64,27 +64,27 @@ com.google.cloud google-cloud-bigqueryconnection - 1.0.1 + 1.0.2 com.google.api.grpc proto-google-cloud-bigqueryconnection-v1 - 1.0.1 + 1.0.2 com.google.api.grpc grpc-google-cloud-bigqueryconnection-v1 - 1.0.1 + 1.0.2 com.google.api.grpc proto-google-cloud-bigqueryconnection-v1beta1 - 0.5.1 + 0.5.2 com.google.api.grpc grpc-google-cloud-bigqueryconnection-v1beta1 - 0.5.1 + 0.5.2 diff --git a/google-cloud-bigqueryconnection/pom.xml b/google-cloud-bigqueryconnection/pom.xml index b56ba0d4..ab104d7c 100644 --- a/google-cloud-bigqueryconnection/pom.xml +++ b/google-cloud-bigqueryconnection/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-bigqueryconnection - 1.0.1 + 1.0.2 jar Google Cloud BigQuery Connections https://github.com/googleapis/java-bigqueryconnection @@ -11,7 +11,7 @@ com.google.cloud google-cloud-bigqueryconnection-parent - 1.0.1 + 1.0.2 google-cloud-bigqueryconnection @@ -70,6 +70,12 @@ org.threeten threetenbp + + + com.google.protobuf + protobuf-java-util + runtime + @@ -77,7 +83,11 @@ junit test - + + com.google.cloud + google-cloud-core + test + com.google.api.grpc grpc-google-cloud-bigqueryconnection-v1 diff --git a/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigqueryconnection/v1/it/ITSystemTest.java b/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigqueryconnection/v1/it/ITSystemTest.java new file mode 100644 index 00000000..ae3e906b --- /dev/null +++ b/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigqueryconnection/v1/it/ITSystemTest.java @@ -0,0 +1,159 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ + +package com.google.cloud.bigqueryconnection.v1.it; + +import static junit.framework.TestCase.assertEquals; +import static junit.framework.TestCase.assertNotNull; + +import com.google.api.resourcenames.ResourceName; +import com.google.cloud.ServiceOptions; +import com.google.cloud.bigquery.connection.v1.CloudSqlCredential; +import com.google.cloud.bigquery.connection.v1.CloudSqlProperties; +import com.google.cloud.bigquery.connection.v1.Connection; +import com.google.cloud.bigquery.connection.v1.ConnectionName; +import com.google.cloud.bigquery.connection.v1.CreateConnectionRequest; +import com.google.cloud.bigquery.connection.v1.DeleteConnectionRequest; +import com.google.cloud.bigquery.connection.v1.GetConnectionRequest; +import com.google.cloud.bigquery.connection.v1.ListConnectionsRequest; +import com.google.cloud.bigquery.connection.v1.LocationName; +import com.google.cloud.bigquery.connection.v1.UpdateConnectionRequest; +import com.google.cloud.bigqueryconnection.v1.ConnectionServiceClient; +import com.google.common.collect.ImmutableList; +import com.google.iam.v1.Binding; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; +import com.google.protobuf.util.FieldMaskUtil; +import java.io.IOException; +import java.util.UUID; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class ITSystemTest { + + private static final String ID = UUID.randomUUID().toString().substring(0, 8); + private static final String PROJECT_ID = ServiceOptions.getDefaultProjectId(); + private static final String CONNECTION_ID = "test-connectin-id-" + ID; + private static final String LOCATION = "US"; + private static final String PARENT = LocationName.of(PROJECT_ID, LOCATION).toString(); + private static final String REGION = "us-central1"; + private static final String MY_SQL_DATABASE = requireEnvVar("MY_SQL_DATABASE"); + private static final String MY_SQL_INSTANCE = requireEnvVar("MY_SQL_INSTANCE"); + private static final String DB_USER = requireEnvVar("DB_USER"); + private static final String DB_PWD = requireEnvVar("DB_PWD"); + private static ConnectionServiceClient client; + private static Connection connection; + + private static String requireEnvVar(String varName) { + String value = System.getenv(varName); + assertNotNull( + "Environment variable " + varName + " is required to perform these tests.", + System.getenv(varName)); + return value; + } + + @BeforeClass + public static void checkRequirements() { + requireEnvVar("MY_SQL_DATABASE"); + requireEnvVar("MY_SQL_INSTANCE"); + requireEnvVar("DB_USER"); + requireEnvVar("DB_PWD"); + } + + @Before + public void setUp() throws IOException { + client = ConnectionServiceClient.create(); + // create a temporary connection to be deleted + String instanceId = String.format("%s:%s:%s", PROJECT_ID, REGION, MY_SQL_INSTANCE); + CloudSqlCredential cloudSqlCredential = + CloudSqlCredential.newBuilder().setUsername(DB_USER).setPassword(DB_PWD).build(); + CloudSqlProperties cloudSqlProperties = + CloudSqlProperties.newBuilder() + .setType(CloudSqlProperties.DatabaseType.MYSQL) + .setDatabase(MY_SQL_DATABASE) + .setInstanceId(instanceId) + .setCredential(cloudSqlCredential) + .build(); + CreateConnectionRequest request = + CreateConnectionRequest.newBuilder() + .setParent(PARENT) + .setConnection(Connection.newBuilder().setCloudSql(cloudSqlProperties).build()) + .setConnectionId(CONNECTION_ID) + .build(); + connection = client.createConnection(request); + } + + @After + public void tearDown() { + // delete a connection + DeleteConnectionRequest request = + DeleteConnectionRequest.newBuilder().setName(connection.getName()).build(); + client.deleteConnection(request); + client.close(); + } + + @Test + public void testGetConnection() { + GetConnectionRequest request = + GetConnectionRequest.newBuilder().setName(connection.getName()).build(); + Connection actualConnection = client.getConnection(request); + assertEquals(connection, actualConnection); + } + + @Test + public void testListConnections() { + int pageSize = 10; + ListConnectionsRequest request = + ListConnectionsRequest.newBuilder().setParent(PARENT).setPageSize(pageSize).build(); + for (Connection actualConnection : client.listConnections(request).iterateAll()) { + if (connection.getName().equals(actualConnection.getName())) { + assertEquals(connection, actualConnection); + } + } + } + + @Test + public void testUpdateConnection() { + String description = "MY_DESCRIPTION"; + FieldMask updateMask = FieldMaskUtil.fromString("description"); + UpdateConnectionRequest request = + UpdateConnectionRequest.newBuilder() + .setName(connection.getName()) + .setConnection(Connection.newBuilder().setDescription(description).build()) + .setUpdateMask(updateMask) + .build(); + Connection actualConnection = client.updateConnection(request); + assertEquals(description, actualConnection.getDescription()); + } + + @Test + public void testShareConnection() { + ResourceName resource = ConnectionName.of(PROJECT_ID, LOCATION, CONNECTION_ID); + Binding binding = + Binding.newBuilder() + .addMembers("group:example-analyst-group@google.com") + .setRole("roles/bigquery.connectionUser") + .build(); + Policy policy = Policy.newBuilder().addBindings(binding).build(); + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder().setResource(resource.toString()).setPolicy(policy).build(); + Policy actualPolicy = client.setIamPolicy(request); + assertEquals(ImmutableList.of(binding), actualPolicy.getBindingsList()); + } +} diff --git a/grpc-google-cloud-bigqueryconnection-v1/pom.xml b/grpc-google-cloud-bigqueryconnection-v1/pom.xml index 9b87ac36..23bcaaf6 100644 --- a/grpc-google-cloud-bigqueryconnection-v1/pom.xml +++ b/grpc-google-cloud-bigqueryconnection-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-bigqueryconnection-v1 - 1.0.1 + 1.0.2 grpc-google-cloud-bigqueryconnection-v1 GRPC library for grpc-google-cloud-bigqueryconnection-v1 com.google.cloud google-cloud-bigqueryconnection-parent - 1.0.1 + 1.0.2 diff --git a/grpc-google-cloud-bigqueryconnection-v1beta1/pom.xml b/grpc-google-cloud-bigqueryconnection-v1beta1/pom.xml index 0d69d51a..816fd160 100644 --- a/grpc-google-cloud-bigqueryconnection-v1beta1/pom.xml +++ b/grpc-google-cloud-bigqueryconnection-v1beta1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-bigqueryconnection-v1beta1 - 0.5.1 + 0.5.2 grpc-google-cloud-bigqueryconnection-v1beta1 GRPC library for grpc-google-cloud-bigqueryconnection-v1beta1 com.google.cloud google-cloud-bigqueryconnection-parent - 1.0.1 + 1.0.2 diff --git a/pom.xml b/pom.xml index c8cea042..de5d3420 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-bigqueryconnection-parent pom - 1.0.1 + 1.0.2 Google Cloud BigQuery Connections Parent https://github.com/googleapis/java-bigqueryconnection @@ -63,7 +63,7 @@ UTF-8 github google-cloud-bigqueryconnection-parent - 0.14.1 + 0.15.0 @@ -71,27 +71,27 @@ com.google.cloud google-cloud-bigqueryconnection - 1.0.1 + 1.0.2 com.google.api.grpc proto-google-cloud-bigqueryconnection-v1 - 1.0.1 + 1.0.2 com.google.api.grpc grpc-google-cloud-bigqueryconnection-v1 - 1.0.1 + 1.0.2 com.google.api.grpc proto-google-cloud-bigqueryconnection-v1beta1 - 0.5.1 + 0.5.2 com.google.api.grpc grpc-google-cloud-bigqueryconnection-v1beta1 - 0.5.1 + 0.5.2 diff --git a/proto-google-cloud-bigqueryconnection-v1/pom.xml b/proto-google-cloud-bigqueryconnection-v1/pom.xml index d1d42585..3ef5e30f 100644 --- a/proto-google-cloud-bigqueryconnection-v1/pom.xml +++ b/proto-google-cloud-bigqueryconnection-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-bigqueryconnection-v1 - 1.0.1 + 1.0.2 proto-google-cloud-bigqueryconnection-v1 PROTO library for proto-google-cloud-bigqueryconnection-v1 com.google.cloud google-cloud-bigqueryconnection-parent - 1.0.1 + 1.0.2 diff --git a/proto-google-cloud-bigqueryconnection-v1beta1/pom.xml b/proto-google-cloud-bigqueryconnection-v1beta1/pom.xml index 3f80f746..498a0871 100644 --- a/proto-google-cloud-bigqueryconnection-v1beta1/pom.xml +++ b/proto-google-cloud-bigqueryconnection-v1beta1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-bigqueryconnection-v1beta1 - 0.5.1 + 0.5.2 proto-google-cloud-bigqueryconnection-v1beta1 PROTO library for proto-google-cloud-bigqueryconnection-v1beta1 com.google.cloud google-cloud-bigqueryconnection-parent - 1.0.1 + 1.0.2 diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 6fb42c20..936c938d 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -29,7 +29,7 @@ com.google.cloud google-cloud-bigqueryconnection - 1.0.0 + 1.0.1 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 63f29034..a3b663d7 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-bigqueryconnection - 1.0.1 + 1.0.2 diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index b607bd75..b5d55522 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -28,7 +28,7 @@ com.google.cloud libraries-bom - 13.4.0 + 15.0.0 pom import @@ -40,7 +40,7 @@ com.google.cloud google-cloud-bigqueryconnection - 1.0.0 + 1.0.1 diff --git a/synth.metadata b/synth.metadata index c91bea06..c3bf4d1b 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigqueryconnection.git", - "sha": "56b20ddbb1daf49380fb1be73c1248ae28bd6268" + "sha": "49c5b1d811468dfd4b2e180ff1a270dfc72537c9" } }, { @@ -27,7 +27,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "5f6ef0ec5501d33c4667885b37a7685a30d41a76" + "sha": "7db8a6c5ffb12a6e4c2f799c18f00f7f3d60e279" } } ], @@ -57,6 +57,7 @@ ".github/ISSUE_TEMPLATE/feature_request.md", ".github/ISSUE_TEMPLATE/support_request.md", ".github/PULL_REQUEST_TEMPLATE.md", + ".github/generated-files-bot.yml", ".github/readme/synth.py", ".github/release-please.yml", ".github/snippet-bot.yml", @@ -76,7 +77,6 @@ ".kokoro/dependencies.sh", ".kokoro/linkage-monitor.sh", ".kokoro/nightly/common.cfg", - ".kokoro/nightly/integration.cfg", ".kokoro/nightly/java11.cfg", ".kokoro/nightly/java7.cfg", ".kokoro/nightly/java8-osx.cfg", @@ -86,7 +86,6 @@ ".kokoro/presubmit/clirr.cfg", ".kokoro/presubmit/common.cfg", ".kokoro/presubmit/dependencies.cfg", - ".kokoro/presubmit/integration.cfg", ".kokoro/presubmit/java11.cfg", ".kokoro/presubmit/java7.cfg", ".kokoro/presubmit/java8-osx.cfg", diff --git a/versions.txt b/versions.txt index 61a2b081..15f4185a 100644 --- a/versions.txt +++ b/versions.txt @@ -1,8 +1,8 @@ # Format: # module:released-version:current-version -google-cloud-bigqueryconnection:1.0.1:1.0.1 -proto-google-cloud-bigqueryconnection-v1:1.0.1:1.0.1 -grpc-google-cloud-bigqueryconnection-v1:1.0.1:1.0.1 -proto-google-cloud-bigqueryconnection-v1beta1:0.5.1:0.5.1 -grpc-google-cloud-bigqueryconnection-v1beta1:0.5.1:0.5.1 +google-cloud-bigqueryconnection:1.0.2:1.0.2 +proto-google-cloud-bigqueryconnection-v1:1.0.2:1.0.2 +grpc-google-cloud-bigqueryconnection-v1:1.0.2:1.0.2 +proto-google-cloud-bigqueryconnection-v1beta1:0.5.2:0.5.2 +grpc-google-cloud-bigqueryconnection-v1beta1:0.5.2:0.5.2