diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata new file mode 100644 index 00000000..cb1d5c46 --- /dev/null +++ b/.github/readme/synth.metadata/synth.metadata @@ -0,0 +1,18 @@ +{ + "sources": [ + { + "git": { + "name": ".", + "remote": "https://github.com/googleapis/java-bigqueryconnection.git", + "sha": "c167ec888021ab0e98130c74290a9649227e4c52" + } + }, + { + "git": { + "name": "synthtool", + "remote": "https://github.com/googleapis/synthtool.git", + "sha": "3c1fd09ba8d1c7b7092662f6f8330f521d4e7739" + } + } + ] +} \ No newline at end of file diff --git a/.github/workflows/approve-readme.yaml b/.github/workflows/approve-readme.yaml new file mode 100644 index 00000000..e2d841d6 --- /dev/null +++ b/.github/workflows/approve-readme.yaml @@ -0,0 +1,54 @@ +on: + pull_request: +name: auto-merge-readme +jobs: + approve: + runs-on: ubuntu-latest + if: github.repository_owner == 'googleapis' && github.head_ref == 'autosynth-readme' + steps: + - uses: actions/github-script@v3.0.0 + with: + github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} + script: | + // only approve PRs from yoshi-automation + if (context.payload.pull_request.user.login !== "yoshi-automation") { + return; + } + + // only approve PRs like "chore: release " + if (!context.payload.pull_request.title === "chore: regenerate README") { + return; + } + + // only approve PRs with README.md and synth.metadata changes + const files = new Set( + ( + await github.paginate( + github.pulls.listFiles.endpoint({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + }) + ) + ).map(file => file.filename) + ); + if (files.size != 2 || !files.has("README.md") || !files.has(".github/readme/synth.metadata/synth.metadata")) { + return; + } + + // approve README regeneration PR + await github.pulls.createReview({ + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Rubber stamped PR!', + pull_number: context.payload.pull_request.number, + event: 'APPROVE' + }); + + // attach automerge label + await github.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + labels: ['automerge'] + }); diff --git a/.github/workflows/formatting.yaml b/.github/workflows/formatting.yaml new file mode 100644 index 00000000..d4d367cf --- /dev/null +++ b/.github/workflows/formatting.yaml @@ -0,0 +1,25 @@ +on: + pull_request_target: + types: [opened, synchronize] + branches: + - master +name: format +jobs: + format-code: + runs-on: ubuntu-latest + env: + ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }} + steps: + - uses: actions/checkout@v2 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + - uses: actions/setup-java@v1 + with: + java-version: 11 + - run: "mvn com.coveo:fmt-maven-plugin:format" + - uses: googleapis/code-suggester@v1.8.0 + with: + command: review + pull_number: ${{ github.event.pull_request.number }} + git_dir: '.' diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 69d35914..bed3431f 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -69,9 +69,21 @@ integration) RETURN_CODE=$? ;; samples) - if [[ -f samples/pom.xml ]] + SAMPLES_DIR=samples + # only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise. + if [[ ! -z ${KOKORO_GITHUB_PULL_REQUEST_NUMBER} ]] then - pushd samples + SAMPLES_DIR=samples/snapshot + fi + + if [[ -f ${SAMPLES_DIR}/pom.xml ]] + then + if [ -f "${KOKORO_GFILE_DIR}/secret_manager/java-bigqueryconnection-samples-secrets" ] + then + source "${KOKORO_GFILE_DIR}/secret_manager/java-bigqueryconnection-samples-secrets" + fi + + pushd ${SAMPLES_DIR} mvn -B \ -Penable-samples \ -DtrimStackTrace=false \ diff --git a/.kokoro/nightly/samples.cfg b/.kokoro/nightly/samples.cfg index f2542931..5585ccb4 100644 --- a/.kokoro/nightly/samples.cfg +++ b/.kokoro/nightly/samples.cfg @@ -29,7 +29,7 @@ env_vars: { env_vars: { key: "SECRET_MANAGER_KEYS" - value: "java-docs-samples-service-account" + value: "java-docs-samples-service-account, java-bigqueryconnection-samples-secrets" } env_vars: { diff --git a/.kokoro/presubmit/samples.cfg b/.kokoro/presubmit/samples.cfg index 01e09600..3fd1ecc9 100644 --- a/.kokoro/presubmit/samples.cfg +++ b/.kokoro/presubmit/samples.cfg @@ -29,5 +29,5 @@ env_vars: { env_vars: { key: "SECRET_MANAGER_KEYS" - value: "java-docs-samples-service-account" + value: "java-docs-samples-service-account, java-bigqueryconnection-samples-secrets" } \ No newline at end of file diff --git a/.kokoro/readme.sh b/.kokoro/readme.sh old mode 100644 new mode 100755 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0790ae84..8d50b750 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +### [0.4.1](https://www.github.com/googleapis/java-bigqueryconnection/compare/v0.4.0...v0.4.1) (2020-10-16) + + +### Documentation + +* **samples:** add create and delete connection ([#151](https://www.github.com/googleapis/java-bigqueryconnection/issues/151)) ([39a1f45](https://www.github.com/googleapis/java-bigqueryconnection/commit/39a1f45a97604d90a31d1a31412b6c90eb22069e)) +* **samples:** add create aws connection ([#163](https://www.github.com/googleapis/java-bigqueryconnection/issues/163)) ([59fa9ae](https://www.github.com/googleapis/java-bigqueryconnection/commit/59fa9aed468c9fa13e538ecdcff4c452d870ef49)) +* **samples:** add get connection ([#156](https://www.github.com/googleapis/java-bigqueryconnection/issues/156)) ([0cdb6ce](https://www.github.com/googleapis/java-bigqueryconnection/commit/0cdb6ce95bcb22084dfaf6a562783466398a3847)) +* **samples:** add list connections ([#157](https://www.github.com/googleapis/java-bigqueryconnection/issues/157)) ([d015a4e](https://www.github.com/googleapis/java-bigqueryconnection/commit/d015a4e5b435e07b5abbe35c4a61b609824227a8)) +* **samples:** add share connection ([#161](https://www.github.com/googleapis/java-bigqueryconnection/issues/161)) ([760c488](https://www.github.com/googleapis/java-bigqueryconnection/commit/760c4888d30f532df8abc725849190487c056d22)) +* **samples:** add update connection ([#158](https://www.github.com/googleapis/java-bigqueryconnection/issues/158)) ([068dbc0](https://www.github.com/googleapis/java-bigqueryconnection/commit/068dbc01aba88f7b13b483fa40a651e0d071822a)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.10.2 ([#167](https://www.github.com/googleapis/java-bigqueryconnection/issues/167)) ([19a482b](https://www.github.com/googleapis/java-bigqueryconnection/commit/19a482ba80ff342eeb70fba89b973b39c59f6422)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.11.0 ([#178](https://www.github.com/googleapis/java-bigqueryconnection/issues/178)) ([7cf25d0](https://www.github.com/googleapis/java-bigqueryconnection/commit/7cf25d082fecdbe5dc2efa7125cb30ee07595129)) + ## [0.4.0](https://www.github.com/googleapis/java-bigqueryconnection/compare/v0.3.4...v0.4.0) (2020-10-02) diff --git a/README.md b/README.md index ebd8b390..7b30a08f 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,11 @@ If you are using Maven, add this to your pom.xml file: com.google.cloud google-cloud-bigqueryconnection - 0.3.1 + 0.4.0 ``` -[//]: # ({x-version-update-start:google-cloud-bigqueryconnection:released}) - If you are using Gradle, add this to your dependencies ```Groovy compile 'com.google.cloud:google-cloud-bigqueryconnection:0.4.0' @@ -35,7 +33,6 @@ If you are using SBT, add this to your dependencies ```Scala libraryDependencies += "com.google.cloud" % "google-cloud-bigqueryconnection" % "0.4.0" ``` -[//]: # ({x-version-update-end}) ## Authentication @@ -75,7 +72,14 @@ has instructions for running the samples. | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | +| Create Aws Connection | [source code](https://github.com/googleapis/java-bigqueryconnection/blob/master/samples/snippets/src/main/java/com/example/bigqueryconnection/CreateAwsConnection.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigqueryconnection&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigqueryconnection/CreateAwsConnection.java) | +| Create Connection | [source code](https://github.com/googleapis/java-bigqueryconnection/blob/master/samples/snippets/src/main/java/com/example/bigqueryconnection/CreateConnection.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigqueryconnection&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigqueryconnection/CreateConnection.java) | +| Delete Connection | [source code](https://github.com/googleapis/java-bigqueryconnection/blob/master/samples/snippets/src/main/java/com/example/bigqueryconnection/DeleteConnection.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigqueryconnection&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigqueryconnection/DeleteConnection.java) | +| Get Connection | [source code](https://github.com/googleapis/java-bigqueryconnection/blob/master/samples/snippets/src/main/java/com/example/bigqueryconnection/GetConnection.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigqueryconnection&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigqueryconnection/GetConnection.java) | +| List Connections | [source code](https://github.com/googleapis/java-bigqueryconnection/blob/master/samples/snippets/src/main/java/com/example/bigqueryconnection/ListConnections.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigqueryconnection&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigqueryconnection/ListConnections.java) | | Quickstart Sample | [source code](https://github.com/googleapis/java-bigqueryconnection/blob/master/samples/snippets/src/main/java/com/example/bigqueryconnection/QuickstartSample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigqueryconnection&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigqueryconnection/QuickstartSample.java) | +| Share Connection | [source code](https://github.com/googleapis/java-bigqueryconnection/blob/master/samples/snippets/src/main/java/com/example/bigqueryconnection/ShareConnection.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigqueryconnection&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigqueryconnection/ShareConnection.java) | +| Update Connection | [source code](https://github.com/googleapis/java-bigqueryconnection/blob/master/samples/snippets/src/main/java/com/example/bigqueryconnection/UpdateConnection.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigqueryconnection&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigqueryconnection/UpdateConnection.java) | diff --git a/google-cloud-bigqueryconnection-bom/pom.xml b/google-cloud-bigqueryconnection-bom/pom.xml index 9b37ad76..35ea5b42 100644 --- a/google-cloud-bigqueryconnection-bom/pom.xml +++ b/google-cloud-bigqueryconnection-bom/pom.xml @@ -3,12 +3,12 @@ 4.0.0 com.google.cloud google-cloud-bigqueryconnection-bom - 0.4.0 + 0.4.1 pom com.google.cloud google-cloud-shared-config - 0.9.2 + 0.9.3 Google Cloud BigQuery Connections BOM @@ -64,27 +64,27 @@ com.google.cloud google-cloud-bigqueryconnection - 0.4.0 + 0.4.1 com.google.api.grpc proto-google-cloud-bigqueryconnection-v1 - 0.4.0 + 0.4.1 com.google.api.grpc grpc-google-cloud-bigqueryconnection-v1 - 0.4.0 + 0.4.1 com.google.api.grpc proto-google-cloud-bigqueryconnection-v1beta1 - 0.4.0 + 0.4.1 com.google.api.grpc grpc-google-cloud-bigqueryconnection-v1beta1 - 0.4.0 + 0.4.1 diff --git a/google-cloud-bigqueryconnection/pom.xml b/google-cloud-bigqueryconnection/pom.xml index 3c44b840..c986f7a9 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 - 0.4.0 + 0.4.1 jar Google Cloud BigQuery Connections https://github.com/googleapis/java-bigqueryconnection @@ -11,7 +11,7 @@ com.google.cloud google-cloud-bigqueryconnection-parent - 0.4.0 + 0.4.1 google-cloud-bigqueryconnection diff --git a/grpc-google-cloud-bigqueryconnection-v1/pom.xml b/grpc-google-cloud-bigqueryconnection-v1/pom.xml index 1447737d..e5b7af60 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 - 0.4.0 + 0.4.1 grpc-google-cloud-bigqueryconnection-v1 GRPC library for grpc-google-cloud-bigqueryconnection-v1 com.google.cloud google-cloud-bigqueryconnection-parent - 0.4.0 + 0.4.1 diff --git a/grpc-google-cloud-bigqueryconnection-v1beta1/pom.xml b/grpc-google-cloud-bigqueryconnection-v1beta1/pom.xml index 900af145..92886802 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.4.0 + 0.4.1 grpc-google-cloud-bigqueryconnection-v1beta1 GRPC library for grpc-google-cloud-bigqueryconnection-v1beta1 com.google.cloud google-cloud-bigqueryconnection-parent - 0.4.0 + 0.4.1 diff --git a/pom.xml b/pom.xml index 245f9d59..8ed42125 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-bigqueryconnection-parent pom - 0.4.0 + 0.4.1 Google Cloud BigQuery Connections Parent https://github.com/googleapis/java-bigqueryconnection @@ -14,7 +14,7 @@ com.google.cloud google-cloud-shared-config - 0.9.2 + 0.9.3 @@ -63,6 +63,7 @@ UTF-8 github google-cloud-bigqueryconnection-parent + 0.12.1 @@ -70,33 +71,33 @@ com.google.cloud google-cloud-bigqueryconnection - 0.4.0 + 0.4.1 com.google.api.grpc proto-google-cloud-bigqueryconnection-v1 - 0.4.0 + 0.4.1 com.google.api.grpc grpc-google-cloud-bigqueryconnection-v1 - 0.4.0 + 0.4.1 com.google.api.grpc proto-google-cloud-bigqueryconnection-v1beta1 - 0.4.0 + 0.4.1 com.google.api.grpc grpc-google-cloud-bigqueryconnection-v1beta1 - 0.4.0 + 0.4.1 com.google.cloud google-cloud-shared-dependencies - 0.9.0 + ${google.cloud.shared-dependencies.version} pom import @@ -105,7 +106,7 @@ junit junit - 4.13 + 4.13.1 test @@ -139,7 +140,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 3.1.0 + 3.1.1 @@ -203,4 +204,4 @@ - \ No newline at end of file + diff --git a/proto-google-cloud-bigqueryconnection-v1/pom.xml b/proto-google-cloud-bigqueryconnection-v1/pom.xml index be71b2e6..dd9d3119 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 - 0.4.0 + 0.4.1 proto-google-cloud-bigqueryconnection-v1 PROTO library for proto-google-cloud-bigqueryconnection-v1 com.google.cloud google-cloud-bigqueryconnection-parent - 0.4.0 + 0.4.1 diff --git a/proto-google-cloud-bigqueryconnection-v1beta1/pom.xml b/proto-google-cloud-bigqueryconnection-v1beta1/pom.xml index 7a90b035..a6364f51 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.4.0 + 0.4.1 proto-google-cloud-bigqueryconnection-v1beta1 PROTO library for proto-google-cloud-bigqueryconnection-v1beta1 com.google.cloud google-cloud-bigqueryconnection-parent - 0.4.0 + 0.4.1 diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index e1e9366b..5edab34f 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -14,7 +14,7 @@ com.google.cloud.samples shared-configuration - 1.0.18 + 1.0.21 @@ -29,14 +29,19 @@ com.google.cloud google-cloud-bigqueryconnection - 0.3.1 + 0.4.0 + + com.google.protobuf + protobuf-java-util + 3.13.0 + junit junit - 4.13 + 4.13.1 test diff --git a/samples/pom.xml b/samples/pom.xml index b44601c5..4d910fcb 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -18,7 +18,7 @@ com.google.cloud.samples shared-configuration - 1.0.18 + 1.0.21 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index eb04742b..68acd4e4 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -14,7 +14,7 @@ com.google.cloud.samples shared-configuration - 1.0.18 + 1.0.21 @@ -28,14 +28,19 @@ com.google.cloud google-cloud-bigqueryconnection - 0.4.0 + 0.4.1 + + com.google.protobuf + protobuf-java-util + 3.13.0 + junit junit - 4.13 + 4.13.1 test @@ -80,4 +85,4 @@ - \ No newline at end of file + diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 13ae0dcc..3af77db6 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -14,7 +14,7 @@ com.google.cloud.samples shared-configuration - 1.0.18 + 1.0.21 @@ -28,7 +28,7 @@ com.google.cloud libraries-bom - 9.1.0 + 12.1.0 pom import @@ -40,13 +40,18 @@ com.google.cloud google-cloud-bigqueryconnection - 0.3.1 + 0.4.0 + + com.google.protobuf + protobuf-java-util + 3.13.0 + junit junit - 4.13 + 4.13.1 test diff --git a/samples/snippets/src/main/java/com/example/bigqueryconnection/CreateAwsConnection.java b/samples/snippets/src/main/java/com/example/bigqueryconnection/CreateAwsConnection.java new file mode 100644 index 00000000..072025b3 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigqueryconnection/CreateAwsConnection.java @@ -0,0 +1,66 @@ +/* + * 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 + * + * 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. + */ + +package com.example.bigqueryconnection; + +// [START bigqueryconnection_create_aws_connection] +import com.google.cloud.bigquery.connection.v1.AwsCrossAccountRole; +import com.google.cloud.bigquery.connection.v1.AwsProperties; +import com.google.cloud.bigquery.connection.v1.Connection; +import com.google.cloud.bigquery.connection.v1.CreateConnectionRequest; +import com.google.cloud.bigquery.connection.v1.LocationName; +import com.google.cloud.bigqueryconnection.v1.ConnectionServiceClient; +import java.io.IOException; + +// Sample to create aws connection +public class CreateAwsConnection { + + public static void main(String[] args) throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "MY_PROJECT_ID"; + // Note: As of now location only supports aws-us-east-1 + String location = "MY_LOCATION"; + String connectionId = "MY_CONNECTION_ID"; + // Example of role id arn:aws:iam::accountId:role/myrole + String iamRoleId = "MY_AWS_ROLE_ID"; + AwsCrossAccountRole role = AwsCrossAccountRole.newBuilder().setIamRoleId(iamRoleId).build(); + AwsProperties awsProperties = AwsProperties.newBuilder().setCrossAccountRole(role).build(); + Connection connection = Connection.newBuilder().setAws(awsProperties).build(); + createAwsConnection(projectId, location, connectionId, connection); + } + + public static void createAwsConnection( + String projectId, String location, String connectionId, Connection connection) + throws IOException { + try (ConnectionServiceClient client = ConnectionServiceClient.create()) { + LocationName parent = LocationName.of(projectId, location); + CreateConnectionRequest request = + CreateConnectionRequest.newBuilder() + .setParent(parent.toString()) + .setConnection(connection) + .setConnectionId(connectionId) + .build(); + Connection response = client.createConnection(request); + AwsCrossAccountRole role = response.getAws().getCrossAccountRole(); + System.out.println( + "Aws connection created successfully : Aws userId :" + + role.getIamUserId() + + " Aws externalId :" + + role.getExternalId()); + } + } +} +// [END bigqueryconnection_create_aws_connection] diff --git a/samples/snippets/src/main/java/com/example/bigqueryconnection/CreateConnection.java b/samples/snippets/src/main/java/com/example/bigqueryconnection/CreateConnection.java new file mode 100644 index 00000000..e22a695a --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigqueryconnection/CreateConnection.java @@ -0,0 +1,71 @@ +/* + * 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 + * + * 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. + */ + +package com.example.bigqueryconnection; + +// [START bigqueryconnection_create_connection] +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.CreateConnectionRequest; +import com.google.cloud.bigquery.connection.v1.LocationName; +import com.google.cloud.bigqueryconnection.v1.ConnectionServiceClient; +import java.io.IOException; + +// Sample to create a connection with cloud MySql database +public class CreateConnection { + + public static void main(String[] args) throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "MY_PROJECT_ID"; + String location = "MY_LOCATION"; + String connectionId = "MY_CONNECTION_ID"; + String database = "MY_DATABASE"; + String instance = "MY_INSTANCE"; + String instanceLocation = "MY_INSTANCE_LOCATION"; + String username = "MY_USERNAME"; + String password = "MY_PASSWORD"; + String instanceId = String.format("%s:%s:%s", projectId, instanceLocation, instance); + CloudSqlCredential cloudSqlCredential = + CloudSqlCredential.newBuilder().setUsername(username).setPassword(password).build(); + CloudSqlProperties cloudSqlProperties = + CloudSqlProperties.newBuilder() + .setType(CloudSqlProperties.DatabaseType.MYSQL) + .setDatabase(database) + .setInstanceId(instanceId) + .setCredential(cloudSqlCredential) + .build(); + Connection connection = Connection.newBuilder().setCloudSql(cloudSqlProperties).build(); + createConnection(projectId, location, connectionId, connection); + } + + public static void createConnection( + String projectId, String location, String connectionId, Connection connection) + throws IOException { + try (ConnectionServiceClient client = ConnectionServiceClient.create()) { + LocationName parent = LocationName.of(projectId, location); + CreateConnectionRequest request = + CreateConnectionRequest.newBuilder() + .setParent(parent.toString()) + .setConnection(connection) + .setConnectionId(connectionId) + .build(); + Connection response = client.createConnection(request); + System.out.println("Connection created successfully :" + response.getName()); + } + } +} +// [END bigqueryconnection_create_connection] diff --git a/samples/snippets/src/main/java/com/example/bigqueryconnection/DeleteConnection.java b/samples/snippets/src/main/java/com/example/bigqueryconnection/DeleteConnection.java new file mode 100644 index 00000000..0baca2a9 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigqueryconnection/DeleteConnection.java @@ -0,0 +1,47 @@ +/* + * 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 + * + * 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. + */ + +package com.example.bigqueryconnection; + +// [START bigqueryconnection_delete_connection] +import com.google.cloud.bigquery.connection.v1.ConnectionName; +import com.google.cloud.bigquery.connection.v1.DeleteConnectionRequest; +import com.google.cloud.bigqueryconnection.v1.ConnectionServiceClient; +import java.io.IOException; + +// Sample to delete a connection +public class DeleteConnection { + + public static void main(String[] args) throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "MY_PROJECT_ID"; + String location = "MY_LOCATION"; + String connectionName = "MY_CONNECTION_NAME"; + deleteConnection(projectId, location, connectionName); + } + + public static void deleteConnection(String projectId, String location, String connectionName) + throws IOException { + try (ConnectionServiceClient client = ConnectionServiceClient.create()) { + ConnectionName name = ConnectionName.of(projectId, location, connectionName); + DeleteConnectionRequest request = + DeleteConnectionRequest.newBuilder().setName(name.toString()).build(); + client.deleteConnection(request); + System.out.println("Connection deleted successfully"); + } + } +} +// [END bigqueryconnection_delete_connection] diff --git a/samples/snippets/src/main/java/com/example/bigqueryconnection/GetConnection.java b/samples/snippets/src/main/java/com/example/bigqueryconnection/GetConnection.java new file mode 100644 index 00000000..76f42cf0 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigqueryconnection/GetConnection.java @@ -0,0 +1,48 @@ +/* + * 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 + * + * 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. + */ + +package com.example.bigqueryconnection; + +// [START bigqueryconnection_get_connection] +import com.google.cloud.bigquery.connection.v1.Connection; +import com.google.cloud.bigquery.connection.v1.ConnectionName; +import com.google.cloud.bigquery.connection.v1.GetConnectionRequest; +import com.google.cloud.bigqueryconnection.v1.ConnectionServiceClient; +import java.io.IOException; + +// Sample to get connection +public class GetConnection { + + public static void main(String[] args) throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "MY_PROJECT_ID"; + String location = "MY_LOCATION"; + String connectionId = "MY_CONNECTION_ID"; + getConnection(projectId, location, connectionId); + } + + public static void getConnection(String projectId, String location, String connectionId) + throws IOException { + try (ConnectionServiceClient client = ConnectionServiceClient.create()) { + ConnectionName name = ConnectionName.of(projectId, location, connectionId); + GetConnectionRequest request = + GetConnectionRequest.newBuilder().setName(name.toString()).build(); + Connection response = client.getConnection(request); + System.out.println("Connection info retrieved successfully :" + response.getName()); + } + } +} +// [END bigqueryconnection_get_connection] diff --git a/samples/snippets/src/main/java/com/example/bigqueryconnection/ListConnections.java b/samples/snippets/src/main/java/com/example/bigqueryconnection/ListConnections.java new file mode 100644 index 00000000..f5f456b3 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigqueryconnection/ListConnections.java @@ -0,0 +1,51 @@ +/* + * 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 + * + * 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. + */ + +package com.example.bigqueryconnection; + +// [START bigqueryconnection_list_connections] +import com.google.cloud.bigquery.connection.v1.ListConnectionsRequest; +import com.google.cloud.bigquery.connection.v1.LocationName; +import com.google.cloud.bigqueryconnection.v1.ConnectionServiceClient; +import java.io.IOException; + +// Sample to get list of connections +public class ListConnections { + + public static void main(String[] args) throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "MY_PROJECT_ID"; + String location = "MY_LOCATION"; + listConnections(projectId, location); + } + + public static void listConnections(String projectId, String location) throws IOException { + try (ConnectionServiceClient client = ConnectionServiceClient.create()) { + LocationName parent = LocationName.of(projectId, location); + int pageSize = 10; + ListConnectionsRequest request = + ListConnectionsRequest.newBuilder() + .setParent(parent.toString()) + .setPageSize(pageSize) + .build(); + client + .listConnections(request) + .iterateAll() + .forEach(con -> System.out.println("Connection Id :" + con.getName())); + } + } +} +// [END bigqueryconnection_list_connections] diff --git a/samples/snippets/src/main/java/com/example/bigqueryconnection/ShareConnection.java b/samples/snippets/src/main/java/com/example/bigqueryconnection/ShareConnection.java new file mode 100644 index 00000000..b5ae8315 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigqueryconnection/ShareConnection.java @@ -0,0 +1,59 @@ +/* + * 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 + * + * 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. + */ + +package com.example.bigqueryconnection; + +// [START bigqueryconnection_share_connection] +import com.google.api.resourcenames.ResourceName; +import com.google.cloud.bigquery.connection.v1.ConnectionName; +import com.google.cloud.bigqueryconnection.v1.ConnectionServiceClient; +import com.google.iam.v1.Binding; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import java.io.IOException; + +// Sample to share connections +public class ShareConnection { + + public static void main(String[] args) throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "MY_PROJECT_ID"; + String location = "MY_LOCATION"; + String connectionId = "MY_CONNECTION_ID"; + shareConnection(projectId, location, connectionId); + } + + public static void shareConnection(String projectId, String location, String connectionId) + throws IOException { + try (ConnectionServiceClient client = ConnectionServiceClient.create()) { + ResourceName resource = ConnectionName.of(projectId, location, connectionId); + 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(); + client.setIamPolicy(request); + System.out.println("Connection shared successfully"); + } + } +} +// [END bigqueryconnection_share_connection] diff --git a/samples/snippets/src/main/java/com/example/bigqueryconnection/UpdateConnection.java b/samples/snippets/src/main/java/com/example/bigqueryconnection/UpdateConnection.java new file mode 100644 index 00000000..b3efce6a --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigqueryconnection/UpdateConnection.java @@ -0,0 +1,58 @@ +/* + * 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 + * + * 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. + */ + +package com.example.bigqueryconnection; + +// [START bigqueryconnection_update_connection] +import com.google.cloud.bigquery.connection.v1.Connection; +import com.google.cloud.bigquery.connection.v1.ConnectionName; +import com.google.cloud.bigquery.connection.v1.UpdateConnectionRequest; +import com.google.cloud.bigqueryconnection.v1.ConnectionServiceClient; +import com.google.protobuf.FieldMask; +import com.google.protobuf.util.FieldMaskUtil; +import java.io.IOException; + +// Sample to update connection +public class UpdateConnection { + + public static void main(String[] args) throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "MY_PROJECT_ID"; + String location = "MY_LOCATION"; + String connectionId = "MY_CONNECTION_ID"; + String description = "MY_DESCRIPTION"; + Connection connection = Connection.newBuilder().setDescription(description).build(); + updateConnection(projectId, location, connectionId, connection); + } + + public static void updateConnection( + String projectId, String location, String connectionId, Connection connection) + throws IOException { + try (ConnectionServiceClient client = ConnectionServiceClient.create()) { + ConnectionName name = ConnectionName.of(projectId, location, connectionId); + FieldMask updateMask = FieldMaskUtil.fromString("description"); + UpdateConnectionRequest request = + UpdateConnectionRequest.newBuilder() + .setName(name.toString()) + .setConnection(connection) + .setUpdateMask(updateMask) + .build(); + Connection response = client.updateConnection(request); + System.out.println("Connection updated successfully :" + response.getDescription()); + } + } +} +// [END bigqueryconnection_update_connection] diff --git a/samples/snippets/src/test/java/com/example/bigqueryconnection/CreateAwsConnectionIT.java b/samples/snippets/src/test/java/com/example/bigqueryconnection/CreateAwsConnectionIT.java new file mode 100644 index 00000000..e7dc2d85 --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigqueryconnection/CreateAwsConnectionIT.java @@ -0,0 +1,92 @@ +/* + * 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 + * + * 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. + */ + +package com.example.bigqueryconnection; + +import static com.google.common.truth.Truth.assertThat; +import static junit.framework.TestCase.assertNotNull; + +import com.google.cloud.bigquery.connection.v1.AwsCrossAccountRole; +import com.google.cloud.bigquery.connection.v1.AwsProperties; +import com.google.cloud.bigquery.connection.v1.Connection; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.UUID; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class CreateAwsConnectionIT { + + private static final Logger LOG = Logger.getLogger(CreateAwsConnectionIT.class.getName()); + private static final String LOCATION = "aws-us-east-1"; + private static final String PROJECT_ID = requireEnvVar("GOOGLE_CLOUD_PROJECT"); + private static final String AWS_ACCOUNT_ID = requireEnvVar("AWS_ACCOUNT_ID"); + private static final String AWS_ROLE_ID = requireEnvVar("AWS_ROLE_ID"); + + private String connectionId; + private ByteArrayOutputStream bout; + private PrintStream out; + private PrintStream originalPrintStream; + + 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("GOOGLE_CLOUD_PROJECT"); + requireEnvVar("AWS_ACCOUNT_ID"); + requireEnvVar("AWS_ROLE_ID"); + } + + @Before + public void setUp() { + connectionId = "CREATE_AWS_CONNECTION_TEST_" + UUID.randomUUID().toString().substring(0, 8); + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + originalPrintStream = System.out; + System.setOut(out); + } + + @After + public void tearDown() throws IOException { + // Clean up + DeleteConnection.deleteConnection(PROJECT_ID, LOCATION, connectionId); + // restores print statements in the original method + System.out.flush(); + System.setOut(originalPrintStream); + LOG.log(Level.INFO, bout.toString()); + } + + @Test + public void testCreateAwsConnection() throws IOException { + String iamRoleId = String.format("arn:aws:iam::%s:role/%s", AWS_ACCOUNT_ID, AWS_ROLE_ID); + AwsCrossAccountRole role = AwsCrossAccountRole.newBuilder().setIamRoleId(iamRoleId).build(); + AwsProperties awsProperties = AwsProperties.newBuilder().setCrossAccountRole(role).build(); + Connection connection = Connection.newBuilder().setAws(awsProperties).build(); + CreateAwsConnection.createAwsConnection(PROJECT_ID, LOCATION, connectionId, connection); + assertThat(bout.toString()).contains("Aws connection created successfully :"); + } +} diff --git a/samples/snippets/src/test/java/com/example/bigqueryconnection/CreateConnectionIT.java b/samples/snippets/src/test/java/com/example/bigqueryconnection/CreateConnectionIT.java new file mode 100644 index 00000000..0012d2c7 --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigqueryconnection/CreateConnectionIT.java @@ -0,0 +1,108 @@ +/* + * 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 + * + * 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. + */ + +package com.example.bigqueryconnection; + +import static com.google.common.truth.Truth.assertThat; +import static junit.framework.TestCase.assertNotNull; + +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 java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.UUID; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class CreateConnectionIT { + + private static final Logger LOG = Logger.getLogger(CreateConnectionIT.class.getName()); + private static final String LOCATION = "US"; + private static final String REGION = "us-central1"; + private static final String PROJECT_ID = requireEnvVar("GOOGLE_CLOUD_PROJECT"); + 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 String connectionId; + private ByteArrayOutputStream bout; + private PrintStream out; + private PrintStream originalPrintStream; + + 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("GOOGLE_CLOUD_PROJECT"); + requireEnvVar("MY_SQL_DATABASE"); + requireEnvVar("MY_SQL_INSTANCE"); + requireEnvVar("DB_USER"); + requireEnvVar("DB_PWD"); + } + + @Before + public void setUp() { + connectionId = "CREATE_CONNECTION_TEST_" + UUID.randomUUID().toString().substring(0, 8); + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + originalPrintStream = System.out; + System.setOut(out); + } + + @After + public void tearDown() throws IOException { + // Clean up + DeleteConnection.deleteConnection(PROJECT_ID, LOCATION, connectionId); + // restores print statements in the original method + System.out.flush(); + System.setOut(originalPrintStream); + LOG.log(Level.INFO, bout.toString()); + } + + @Test + public void testCreateConnection() throws IOException { + 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(); + Connection connection = + Connection.newBuilder() + .setFriendlyName(connectionId) + .setCloudSql(cloudSqlProperties) + .build(); + CreateConnection.createConnection(PROJECT_ID, LOCATION, connectionId, connection); + assertThat(bout.toString()).contains("Connection created successfully :"); + } +} diff --git a/samples/snippets/src/test/java/com/example/bigqueryconnection/DeleteConnectionIT.java b/samples/snippets/src/test/java/com/example/bigqueryconnection/DeleteConnectionIT.java new file mode 100644 index 00000000..6ea2a8f7 --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigqueryconnection/DeleteConnectionIT.java @@ -0,0 +1,104 @@ +/* + * 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 + * + * 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. + */ + +package com.example.bigqueryconnection; + +import static com.google.common.truth.Truth.assertThat; +import static junit.framework.TestCase.assertNotNull; + +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 java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.UUID; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class DeleteConnectionIT { + + private static final Logger LOG = Logger.getLogger(DeleteConnectionIT.class.getName()); + private static final String LOCATION = "US"; + private static final String REGION = "us-central1"; + private static final String PROJECT_ID = requireEnvVar("GOOGLE_CLOUD_PROJECT"); + 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 String connectionId; + private ByteArrayOutputStream bout; + private PrintStream out; + private PrintStream originalPrintStream; + + 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("GOOGLE_CLOUD_PROJECT"); + requireEnvVar("MY_SQL_DATABASE"); + requireEnvVar("MY_SQL_INSTANCE"); + requireEnvVar("DB_USER"); + requireEnvVar("DB_PWD"); + } + + @Before + public void setUp() throws IOException { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + originalPrintStream = System.out; + System.setOut(out); + // create a temporary connection + connectionId = "DELETE_CONNECTION_TEST_" + UUID.randomUUID().toString().substring(0, 8); + 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(); + Connection connection = Connection.newBuilder().setCloudSql(cloudSqlProperties).build(); + CreateConnection.createConnection(PROJECT_ID, LOCATION, connectionId, connection); + } + + @After + public void tearDown() { + // restores print statements in the original method + System.out.flush(); + System.setOut(originalPrintStream); + LOG.log(Level.INFO, bout.toString()); + } + + @Test + public void testDeleteConnection() throws IOException { + DeleteConnection.deleteConnection(PROJECT_ID, LOCATION, connectionId); + assertThat(bout.toString()).contains("Connection deleted successfully"); + } +} diff --git a/samples/snippets/src/test/java/com/example/bigqueryconnection/GetConnectionIT.java b/samples/snippets/src/test/java/com/example/bigqueryconnection/GetConnectionIT.java new file mode 100644 index 00000000..49dcf638 --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigqueryconnection/GetConnectionIT.java @@ -0,0 +1,106 @@ +/* + * 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 + * + * 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. + */ + +package com.example.bigqueryconnection; + +import static com.google.common.truth.Truth.assertThat; +import static junit.framework.TestCase.assertNotNull; + +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 java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.UUID; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class GetConnectionIT { + + private static final Logger LOG = Logger.getLogger(GetConnectionIT.class.getName()); + private static final String LOCATION = "US"; + private static final String REGION = "us-central1"; + private static final String PROJECT_ID = requireEnvVar("GOOGLE_CLOUD_PROJECT"); + 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 String connectionId; + private ByteArrayOutputStream bout; + private PrintStream out; + private PrintStream originalPrintStream; + + 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("GOOGLE_CLOUD_PROJECT"); + requireEnvVar("MY_SQL_DATABASE"); + requireEnvVar("MY_SQL_INSTANCE"); + requireEnvVar("DB_USER"); + requireEnvVar("DB_PWD"); + } + + @Before + public void setUp() throws IOException { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + originalPrintStream = System.out; + System.setOut(out); + // create a temporary connection + connectionId = "GET_CONNECTION_TEST_" + UUID.randomUUID().toString().substring(0, 8); + 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(); + Connection connection = Connection.newBuilder().setCloudSql(cloudSqlProperties).build(); + CreateConnection.createConnection(PROJECT_ID, LOCATION, connectionId, connection); + } + + @After + public void tearDown() throws IOException { + // Clean up + DeleteConnection.deleteConnection(PROJECT_ID, LOCATION, connectionId); + // restores print statements in the original method + System.out.flush(); + System.setOut(originalPrintStream); + LOG.log(Level.INFO, bout.toString()); + } + + @Test + public void testGetConnection() throws IOException { + GetConnection.getConnection(PROJECT_ID, LOCATION, connectionId); + assertThat(bout.toString()).contains("Connection info retrieved successfully :"); + } +} diff --git a/samples/snippets/src/test/java/com/example/bigqueryconnection/ListConnectionsIT.java b/samples/snippets/src/test/java/com/example/bigqueryconnection/ListConnectionsIT.java new file mode 100644 index 00000000..47001b94 --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigqueryconnection/ListConnectionsIT.java @@ -0,0 +1,106 @@ +/* + * 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 + * + * 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. + */ + +package com.example.bigqueryconnection; + +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.assertNotNull; + +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 java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.UUID; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class ListConnectionsIT { + + private static final Logger LOG = Logger.getLogger(ListConnectionsIT.class.getName()); + private static final String LOCATION = "US"; + private static final String REGION = "us-central1"; + private static final String PROJECT_ID = requireEnvVar("GOOGLE_CLOUD_PROJECT"); + 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 String connectionId; + private ByteArrayOutputStream bout; + private PrintStream out; + private PrintStream originalPrintStream; + + 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("GOOGLE_CLOUD_PROJECT"); + requireEnvVar("MY_SQL_DATABASE"); + requireEnvVar("MY_SQL_INSTANCE"); + requireEnvVar("DB_USER"); + requireEnvVar("DB_PWD"); + } + + @Before + public void setUp() throws IOException { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + originalPrintStream = System.out; + System.setOut(out); + // create a temporary connection + connectionId = "LIST_CONNECTIONS_TEST_" + UUID.randomUUID().toString().substring(0, 8); + 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(); + Connection connection = Connection.newBuilder().setCloudSql(cloudSqlProperties).build(); + CreateConnection.createConnection(PROJECT_ID, LOCATION, connectionId, connection); + } + + @After + public void tearDown() throws IOException { + // Clean up + DeleteConnection.deleteConnection(PROJECT_ID, LOCATION, connectionId); + // restores print statements in the original method + System.out.flush(); + System.setOut(originalPrintStream); + LOG.log(Level.INFO, bout.toString()); + } + + @Test + public void testListConnections() throws IOException { + ListConnections.listConnections(PROJECT_ID, LOCATION); + assertThat(bout.toString()).contains("Connection Id :"); + } +} diff --git a/samples/snippets/src/test/java/com/example/bigqueryconnection/ShareConnectionIT.java b/samples/snippets/src/test/java/com/example/bigqueryconnection/ShareConnectionIT.java new file mode 100644 index 00000000..8daf09bb --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigqueryconnection/ShareConnectionIT.java @@ -0,0 +1,106 @@ +/* + * 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 + * + * 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. + */ + +package com.example.bigqueryconnection; + +import static com.google.common.truth.Truth.assertThat; +import static junit.framework.TestCase.assertNotNull; + +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 java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.UUID; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class ShareConnectionIT { + + private static final Logger LOG = Logger.getLogger(ShareConnectionIT.class.getName()); + private static final String LOCATION = "US"; + private static final String REGION = "us-central1"; + private static final String PROJECT_ID = requireEnvVar("GOOGLE_CLOUD_PROJECT"); + 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 String connectionId; + private ByteArrayOutputStream bout; + private PrintStream out; + private PrintStream originalPrintStream; + + 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("GOOGLE_CLOUD_PROJECT"); + requireEnvVar("MY_SQL_DATABASE"); + requireEnvVar("MY_SQL_INSTANCE"); + requireEnvVar("DB_USER"); + requireEnvVar("DB_PWD"); + } + + @Before + public void setUp() throws IOException { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + originalPrintStream = System.out; + System.setOut(out); + // create a temporary connection + connectionId = "SHARE_CONNECTION_TEST_" + UUID.randomUUID().toString().substring(0, 8); + 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(); + Connection connection = Connection.newBuilder().setCloudSql(cloudSqlProperties).build(); + CreateConnection.createConnection(PROJECT_ID, LOCATION, connectionId, connection); + } + + @After + public void tearDown() throws IOException { + // Clean up + DeleteConnection.deleteConnection(PROJECT_ID, LOCATION, connectionId); + // restores print statements in the original method + System.out.flush(); + System.setOut(originalPrintStream); + LOG.log(Level.INFO, bout.toString()); + } + + @Test + public void testShareConnection() throws IOException { + ShareConnection.shareConnection(PROJECT_ID, LOCATION, connectionId); + assertThat(bout.toString()).contains("Connection shared successfully"); + } +} diff --git a/samples/snippets/src/test/java/com/example/bigqueryconnection/UpdateConnectionIT.java b/samples/snippets/src/test/java/com/example/bigqueryconnection/UpdateConnectionIT.java new file mode 100644 index 00000000..ff3dc50d --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigqueryconnection/UpdateConnectionIT.java @@ -0,0 +1,108 @@ +/* + * 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 + * + * 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. + */ + +package com.example.bigqueryconnection; + +import static com.google.common.truth.Truth.assertThat; +import static junit.framework.TestCase.assertNotNull; + +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 java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.UUID; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class UpdateConnectionIT { + + private static final Logger LOG = Logger.getLogger(UpdateConnectionIT.class.getName()); + private static final String LOCATION = "US"; + private static final String REGION = "us-central1"; + private static final String PROJECT_ID = requireEnvVar("GOOGLE_CLOUD_PROJECT"); + 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 String connectionId; + private ByteArrayOutputStream bout; + private PrintStream out; + private PrintStream originalPrintStream; + + 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("GOOGLE_CLOUD_PROJECT"); + requireEnvVar("MY_SQL_DATABASE"); + requireEnvVar("MY_SQL_INSTANCE"); + requireEnvVar("DB_USER"); + requireEnvVar("DB_PWD"); + } + + @Before + public void setUp() throws IOException { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + originalPrintStream = System.out; + System.setOut(out); + // create a temporary connection + connectionId = "UPDATE_CONNECTION_TEST_" + UUID.randomUUID().toString().substring(0, 8); + 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(); + Connection connection = Connection.newBuilder().setCloudSql(cloudSqlProperties).build(); + CreateConnection.createConnection(PROJECT_ID, LOCATION, connectionId, connection); + } + + @After + public void tearDown() throws IOException { + // Clean up + DeleteConnection.deleteConnection(PROJECT_ID, LOCATION, connectionId); + // restores print statements in the original method + System.out.flush(); + System.setOut(originalPrintStream); + LOG.log(Level.INFO, bout.toString()); + } + + @Test + public void testUpdateConnection() throws IOException { + String description = "MY_DESCRIPTION"; + Connection connection = Connection.newBuilder().setDescription(description).build(); + UpdateConnection.updateConnection(PROJECT_ID, LOCATION, connectionId, connection); + assertThat(bout.toString()).contains("Connection updated successfully :"); + } +} diff --git a/synth.metadata b/synth.metadata index 730500ff..a18b7f3d 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigqueryconnection.git", - "sha": "88fdcc246448f5fc8580ca4128c3a0fc1b5c8865" + "sha": "7cf25d082fecdbe5dc2efa7125cb30ee07595129" } }, { @@ -27,7 +27,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "8a7a3021fe97aa0a3641db642fe2b767f1c8110f" + "sha": "7c5370937dd9ba9dcf9cd7d2af880a58b389b4f1" } } ], @@ -60,11 +60,12 @@ ".github/readme/synth.py", ".github/release-please.yml", ".github/trusted-contribution.yml", + ".github/workflows/approve-readme.yaml", ".github/workflows/auto-release.yaml", ".github/workflows/ci.yaml", + ".github/workflows/formatting.yaml", ".github/workflows/samples.yaml", ".kokoro/build.bat", - ".kokoro/build.sh", ".kokoro/coerce_logs.sh", ".kokoro/common.cfg", ".kokoro/common.sh", @@ -80,7 +81,6 @@ ".kokoro/nightly/java8-osx.cfg", ".kokoro/nightly/java8-win.cfg", ".kokoro/nightly/java8.cfg", - ".kokoro/nightly/samples.cfg", ".kokoro/populate-secrets.sh", ".kokoro/presubmit/clirr.cfg", ".kokoro/presubmit/common.cfg", @@ -93,7 +93,6 @@ ".kokoro/presubmit/java8.cfg", ".kokoro/presubmit/linkage-monitor.cfg", ".kokoro/presubmit/lint.cfg", - ".kokoro/presubmit/samples.cfg", ".kokoro/readme.sh", ".kokoro/release/bump_snapshot.cfg", ".kokoro/release/common.cfg", diff --git a/synth.py b/synth.py index 4c0c84fe..ec846e95 100644 --- a/synth.py +++ b/synth.py @@ -30,4 +30,8 @@ destination_name='bigqueryconnection', ) -java.common_templates() \ No newline at end of file +java.common_templates(excludes=[ + '.kokoro/build.sh', + '.kokoro/nightly/samples.cfg', + '.kokoro/presubmit/samples.cfg', +]) \ No newline at end of file diff --git a/versions.txt b/versions.txt index 0de57106..a923e1d9 100644 --- a/versions.txt +++ b/versions.txt @@ -1,8 +1,8 @@ # Format: # module:released-version:current-version -google-cloud-bigqueryconnection:0.4.0:0.4.0 -proto-google-cloud-bigqueryconnection-v1:0.4.0:0.4.0 -grpc-google-cloud-bigqueryconnection-v1:0.4.0:0.4.0 -proto-google-cloud-bigqueryconnection-v1beta1:0.4.0:0.4.0 -grpc-google-cloud-bigqueryconnection-v1beta1:0.4.0:0.4.0 \ No newline at end of file +google-cloud-bigqueryconnection:0.4.1:0.4.1 +proto-google-cloud-bigqueryconnection-v1:0.4.1:0.4.1 +grpc-google-cloud-bigqueryconnection-v1:0.4.1:0.4.1 +proto-google-cloud-bigqueryconnection-v1beta1:0.4.1:0.4.1 +grpc-google-cloud-bigqueryconnection-v1beta1:0.4.1:0.4.1 \ No newline at end of file