From a8b0cfda848c1d1aa4f2bb4080a9537c5abe62d7 Mon Sep 17 00:00:00 2001 From: Neenu1995 Date: Mon, 14 Jun 2021 17:42:23 -0400 Subject: [PATCH] feat: initial generation --- .github/.OwlBot.lock.yaml | 3 + .github/.OwlBot.yaml | 29 + .github/CODEOWNERS | 10 + .github/ISSUE_TEMPLATE/bug_report.md | 51 ++ .github/ISSUE_TEMPLATE/feature_request.md | 21 + .github/ISSUE_TEMPLATE/support_request.md | 7 + .github/PULL_REQUEST_TEMPLATE.md | 7 + .github/blunderbuss.yml | 7 + .github/generated-files-bot.yml | 12 + .github/readme/synth.py | 19 + .github/release-please.yml | 3 + .github/snippet-bot.yml | 0 .github/sync-repo-settings.yaml | 49 ++ .github/trusted-contribution.yml | 2 + .github/workflows/approve-readme.yaml | 54 ++ .github/workflows/auto-release.yaml | 88 ++ .github/workflows/ci.yaml | 79 ++ .github/workflows/samples.yaml | 14 + .gitignore | 17 + .kokoro/build.bat | 3 + .kokoro/build.sh | 125 +++ .kokoro/coerce_logs.sh | 38 + .kokoro/common.cfg | 13 + .kokoro/common.sh | 58 ++ .kokoro/continuous/common.cfg | 25 + .kokoro/continuous/java8.cfg | 12 + .kokoro/continuous/readme.cfg | 55 ++ .kokoro/dependencies.sh | 90 ++ .kokoro/nightly/common.cfg | 25 + .kokoro/nightly/integration.cfg | 37 + .kokoro/nightly/java11.cfg | 7 + .kokoro/nightly/java7.cfg | 7 + .kokoro/nightly/java8-osx.cfg | 3 + .kokoro/nightly/java8-win.cfg | 3 + .kokoro/nightly/java8.cfg | 12 + .kokoro/nightly/samples.cfg | 38 + .kokoro/populate-secrets.sh | 43 + .kokoro/presubmit/clirr.cfg | 13 + .kokoro/presubmit/common.cfg | 34 + .kokoro/presubmit/dependencies.cfg | 12 + .kokoro/presubmit/integration.cfg | 33 + .kokoro/presubmit/java11.cfg | 7 + .kokoro/presubmit/java7.cfg | 7 + .kokoro/presubmit/java8-osx.cfg | 3 + .kokoro/presubmit/java8-win.cfg | 3 + .kokoro/presubmit/java8.cfg | 12 + .kokoro/presubmit/linkage-monitor.cfg | 12 + .kokoro/presubmit/lint.cfg | 13 + .kokoro/presubmit/samples.cfg | 33 + .kokoro/readme.sh | 45 + .kokoro/release/bump_snapshot.cfg | 53 ++ .kokoro/release/common.cfg | 49 ++ .kokoro/release/common.sh | 50 ++ .kokoro/release/drop.cfg | 6 + .kokoro/release/drop.sh | 32 + .kokoro/release/promote.cfg | 6 + .kokoro/release/promote.sh | 34 + .kokoro/release/publish_javadoc.cfg | 23 + .kokoro/release/publish_javadoc.sh | 53 ++ .kokoro/release/publish_javadoc11.cfg | 30 + .kokoro/release/publish_javadoc11.sh | 67 ++ .kokoro/release/snapshot.cfg | 6 + .kokoro/release/snapshot.sh | 33 + .kokoro/release/stage.cfg | 19 + .kokoro/release/stage.sh | 45 + .kokoro/trampoline.sh | 26 + .repo-metadata.json | 15 + CODE_OF_CONDUCT.md | 94 +++ CONTRIBUTING.md | 139 ++++ LICENSE | 201 +++++ SECURITY.md | 7 + codecov.yaml | 4 + google-cloud-gke-connect-gateway-bom/pom.xml | 85 ++ google-cloud-gke-connect-gateway/pom.xml | 111 +++ .../gateway/v1beta1/GatewayServiceClient.java | 426 ++++++++++ .../v1beta1/GatewayServiceSettings.java | 225 +++++ .../gateway/v1beta1/gapic_metadata.json | 33 + .../gateway/v1beta1/package-info.java | 44 + .../v1beta1/stub/GatewayServiceStub.java | 57 ++ .../stub/GatewayServiceStubSettings.java | 352 ++++++++ .../GrpcGatewayServiceCallableFactory.java | 115 +++ .../v1beta1/stub/GrpcGatewayServiceStub.java | 233 ++++++ .../v1beta1/GatewayServiceClientTest.java | 341 ++++++++ .../gateway/v1beta1/MockGatewayService.java | 59 ++ .../v1beta1/MockGatewayServiceImpl.java | 161 ++++ .../pom.xml | 69 ++ .../gateway/v1beta1/GatewayServiceGrpc.java | 780 ++++++++++++++++++ java.header | 15 + license-checks.xml | 10 + owlbot.py | 24 + pom.xml | 179 ++++ .../clirr-ignored-differences.xml | 5 + .../pom.xml | 46 ++ .../gateway/v1beta1/GatewayProto.java | 85 ++ .../gkeconnect/gateway/v1beta1/gateway.proto | 75 ++ renovate.json | 73 ++ samples/install-without-bom/pom.xml | 84 ++ samples/pom.xml | 56 ++ samples/snapshot/pom.xml | 83 ++ samples/snippets/pom.xml | 47 ++ versions.txt | 6 + 101 files changed, 6164 insertions(+) create mode 100644 .github/.OwlBot.lock.yaml create mode 100644 .github/.OwlBot.yaml create mode 100644 .github/CODEOWNERS create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/support_request.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/blunderbuss.yml create mode 100644 .github/generated-files-bot.yml create mode 100644 .github/readme/synth.py create mode 100644 .github/release-please.yml create mode 100644 .github/snippet-bot.yml create mode 100644 .github/sync-repo-settings.yaml create mode 100644 .github/trusted-contribution.yml create mode 100644 .github/workflows/approve-readme.yaml create mode 100644 .github/workflows/auto-release.yaml create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/samples.yaml create mode 100644 .gitignore create mode 100644 .kokoro/build.bat create mode 100755 .kokoro/build.sh create mode 100755 .kokoro/coerce_logs.sh create mode 100644 .kokoro/common.cfg create mode 100644 .kokoro/common.sh create mode 100644 .kokoro/continuous/common.cfg create mode 100644 .kokoro/continuous/java8.cfg create mode 100644 .kokoro/continuous/readme.cfg create mode 100755 .kokoro/dependencies.sh create mode 100644 .kokoro/nightly/common.cfg create mode 100644 .kokoro/nightly/integration.cfg create mode 100644 .kokoro/nightly/java11.cfg create mode 100644 .kokoro/nightly/java7.cfg create mode 100644 .kokoro/nightly/java8-osx.cfg create mode 100644 .kokoro/nightly/java8-win.cfg create mode 100644 .kokoro/nightly/java8.cfg create mode 100644 .kokoro/nightly/samples.cfg create mode 100755 .kokoro/populate-secrets.sh create mode 100644 .kokoro/presubmit/clirr.cfg create mode 100644 .kokoro/presubmit/common.cfg create mode 100644 .kokoro/presubmit/dependencies.cfg create mode 100644 .kokoro/presubmit/integration.cfg create mode 100644 .kokoro/presubmit/java11.cfg create mode 100644 .kokoro/presubmit/java7.cfg create mode 100644 .kokoro/presubmit/java8-osx.cfg create mode 100644 .kokoro/presubmit/java8-win.cfg create mode 100644 .kokoro/presubmit/java8.cfg create mode 100644 .kokoro/presubmit/linkage-monitor.cfg create mode 100644 .kokoro/presubmit/lint.cfg create mode 100644 .kokoro/presubmit/samples.cfg create mode 100755 .kokoro/readme.sh create mode 100644 .kokoro/release/bump_snapshot.cfg create mode 100644 .kokoro/release/common.cfg create mode 100755 .kokoro/release/common.sh create mode 100644 .kokoro/release/drop.cfg create mode 100755 .kokoro/release/drop.sh create mode 100644 .kokoro/release/promote.cfg create mode 100755 .kokoro/release/promote.sh create mode 100644 .kokoro/release/publish_javadoc.cfg create mode 100755 .kokoro/release/publish_javadoc.sh create mode 100644 .kokoro/release/publish_javadoc11.cfg create mode 100755 .kokoro/release/publish_javadoc11.sh create mode 100644 .kokoro/release/snapshot.cfg create mode 100755 .kokoro/release/snapshot.sh create mode 100644 .kokoro/release/stage.cfg create mode 100755 .kokoro/release/stage.sh create mode 100644 .kokoro/trampoline.sh create mode 100644 .repo-metadata.json create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 SECURITY.md create mode 100644 codecov.yaml create mode 100644 google-cloud-gke-connect-gateway-bom/pom.xml create mode 100644 google-cloud-gke-connect-gateway/pom.xml create mode 100644 google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayServiceClient.java create mode 100644 google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayServiceSettings.java create mode 100644 google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/gapic_metadata.json create mode 100644 google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/package-info.java create mode 100644 google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/stub/GatewayServiceStub.java create mode 100644 google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/stub/GatewayServiceStubSettings.java create mode 100644 google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/stub/GrpcGatewayServiceCallableFactory.java create mode 100644 google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/stub/GrpcGatewayServiceStub.java create mode 100644 google-cloud-gke-connect-gateway/src/test/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayServiceClientTest.java create mode 100644 google-cloud-gke-connect-gateway/src/test/java/com/google/cloud/gkeconnect/gateway/v1beta1/MockGatewayService.java create mode 100644 google-cloud-gke-connect-gateway/src/test/java/com/google/cloud/gkeconnect/gateway/v1beta1/MockGatewayServiceImpl.java create mode 100644 grpc-google-cloud-gke-connect-gateway-v1beta1/pom.xml create mode 100644 grpc-google-cloud-gke-connect-gateway-v1beta1/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayServiceGrpc.java create mode 100644 java.header create mode 100644 license-checks.xml create mode 100644 owlbot.py create mode 100644 pom.xml create mode 100644 proto-google-cloud-gke-connect-gateway-v1beta1/clirr-ignored-differences.xml create mode 100644 proto-google-cloud-gke-connect-gateway-v1beta1/pom.xml create mode 100644 proto-google-cloud-gke-connect-gateway-v1beta1/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayProto.java create mode 100644 proto-google-cloud-gke-connect-gateway-v1beta1/src/main/proto/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto create mode 100644 renovate.json create mode 100644 samples/install-without-bom/pom.xml create mode 100644 samples/pom.xml create mode 100644 samples/snapshot/pom.xml create mode 100644 samples/snippets/pom.xml create mode 100644 versions.txt diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml new file mode 100644 index 0000000..0abbbcd --- /dev/null +++ b/.github/.OwlBot.lock.yaml @@ -0,0 +1,3 @@ +docker: + digest: sha256:89f1301826d54cfa5cf5b8895817a362ca5ad1fecd8f55ab051ad4df4312aeae + image: gcr.io/repo-automation-bots/owlbot-java:latest \ No newline at end of file diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml new file mode 100644 index 0000000..8bb50bb --- /dev/null +++ b/.github/.OwlBot.yaml @@ -0,0 +1,29 @@ +# Copyright 2021 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. + +docker: + image: "gcr.io/repo-automation-bots/owlbot-java:latest" + +deep-remove-regex: +- "/grpc-google-.*/src" +- "/proto-google-.*/src" +- "/google-.*/src" + +deep-copy-regex: +- source: "/google/cloud/gkeconnect/gateway/(v.*)/.*-java/proto-google-.*/src" + dest: "/owl-bot-staging/$1/proto-google-cloud-gke-connect-gateway-$1/src" +- source: "/google/cloud/gkeconnect/gateway/(v.*)/.*-java/grpc-google-.*/src" + dest: "/owl-bot-staging/$1/grpc-google-cloud-gke-connect-gateway-$1/src" +- source: "/google/cloud/gkeconnect/gateway/(v.*)/.*-java/gapic-google-.*/src" + dest: "/owl-bot-staging/$1/google-cloud-gke-connect-gateway/src" \ No newline at end of file diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..30fdb7b --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,10 @@ +# Code owners file. +# This file controls who is tagged for review for any given pull request. + +# For syntax help see: +# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax + +* @googleapis/yoshi-java + +# The java-samples-reviewers team is the default owner for samples changes +samples/**/*.java @googleapis/java-samples-reviewers diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..12d1a64 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,51 @@ +--- +name: Bug report +about: Create a report to help us improve + +--- + +Thanks for stopping by to let us know something could be better! + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. + +Please run down the following list and make sure you've tried the usual "quick fixes": + + - Search the issues already opened: https://github.com/googleapis/java-gke-connect-gateway/issues + - Check for answers on StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform + +If you are still having issues, please include as much information as possible: + +#### Environment details + +1. Specify the API at the beginning of the title. For example, "BigQuery: ..."). + General, Core, and Other are also allowed as types +2. OS type and version: +3. Java version: +4. gke-connect-gateway version(s): + +#### Steps to reproduce + + 1. ? + 2. ? + +#### Code example + +```java +// example +``` + +#### Stack trace +``` +Any relevant stacktrace here. +``` + +#### External references such as API reference guides + +- ? + +#### Any additional information below + + +Following these steps guarantees the quickest resolution possible. + +Thanks! diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..754e30c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,21 @@ +--- +name: Feature request +about: Suggest an idea for this library + +--- + +Thanks for stopping by to let us know something could be better! + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. + +**Is your feature request related to a problem? Please describe.** +What the problem is. Example: I'm always frustrated when [...] + +**Describe the solution you'd like** +What you want to happen. + +**Describe alternatives you've considered** +Any alternative solutions or features you've considered. + +**Additional context** +Any other context or screenshots about the feature request. diff --git a/.github/ISSUE_TEMPLATE/support_request.md b/.github/ISSUE_TEMPLATE/support_request.md new file mode 100644 index 0000000..9958690 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/support_request.md @@ -0,0 +1,7 @@ +--- +name: Support request +about: If you have a support contract with Google, please create an issue in the Google Cloud Support console. + +--- + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..4f765e3 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,7 @@ +Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: +- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/java-gke-connect-gateway/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea +- [ ] Ensure the tests and linter pass +- [ ] Code coverage does not decrease (if any source code was changed) +- [ ] Appropriate docs were updated (if necessary) + +Fixes # ☕️ diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml new file mode 100644 index 0000000..1a23ea4 --- /dev/null +++ b/.github/blunderbuss.yml @@ -0,0 +1,7 @@ +# Configuration for the Blunderbuss GitHub app. For more info see +# https://github.com/googleapis/repo-automation-bots/tree/master/packages/blunderbuss +assign_prs_by: +- labels: + - samples + to: + - googleapis/java-samples-reviewers \ No newline at end of file diff --git a/.github/generated-files-bot.yml b/.github/generated-files-bot.yml new file mode 100644 index 0000000..c644a24 --- /dev/null +++ b/.github/generated-files-bot.yml @@ -0,0 +1,12 @@ +externalManifests: +- type: json + file: 'synth.metadata' + jsonpath: '$.generatedFiles[*]' +- type: json + file: '.github/readme/synth.metadata/synth.metadata' + jsonpath: '$.generatedFiles[*]' +ignoreAuthors: +- 'renovate-bot' +- 'yoshi-automation' +- 'release-please[bot]' +- 'gcf-owl-bot[bot]' diff --git a/.github/readme/synth.py b/.github/readme/synth.py new file mode 100644 index 0000000..7b48cc2 --- /dev/null +++ b/.github/readme/synth.py @@ -0,0 +1,19 @@ +# 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. + +"""This script is used to synthesize generated the README for this library.""" + +from synthtool.languages import java + +java.custom_templates(["java_library/README.md"]) diff --git a/.github/release-please.yml b/.github/release-please.yml new file mode 100644 index 0000000..8ca7f9c --- /dev/null +++ b/.github/release-please.yml @@ -0,0 +1,3 @@ +bumpMinorPreMajor: true +handleGHRelease: true +releaseType: java-yoshi diff --git a/.github/snippet-bot.yml b/.github/snippet-bot.yml new file mode 100644 index 0000000..e69de29 diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml new file mode 100644 index 0000000..e100454 --- /dev/null +++ b/.github/sync-repo-settings.yaml @@ -0,0 +1,49 @@ + +# Whether or not rebase-merging is enabled on this repository. +# Defaults to `true` +rebaseMergeAllowed: false + +# Whether or not squash-merging is enabled on this repository. +# Defaults to `true` +squashMergeAllowed: true + +# Whether or not PRs are merged with a merge commit on this repository. +# Defaults to `false` +mergeCommitAllowed: false + +# Rules for master branch protection +branchProtectionRules: +# Identifies the protection rule pattern. Name of the branch to be protected. +# Defaults to `master` +- pattern: master + # Can admins overwrite branch protection. + # Defaults to `true` + isAdminEnforced: true + # Number of approving reviews required to update matching branches. + # Defaults to `1` + requiredApprovingReviewCount: 1 + # Are reviews from code owners required to update matching branches. + # Defaults to `false` + requiresCodeOwnerReviews: true + # Require up to date branches + requiresStrictStatusChecks: false + # List of required status check contexts that must pass for commits to be accepted to matching branches. + requiredStatusCheckContexts: + - "dependencies (8)" + - "dependencies (11)" + - "linkage-monitor" + - "lint" + - "clirr" + - "units (7)" + - "units (8)" + - "units (11)" + - "Kokoro - Test: Integration" + - "cla/google" +# List of explicit permissions to add (additive only) +permissionRules: +- team: yoshi-admins + permission: admin +- team: yoshi-java-admins + permission: admin +- team: yoshi-java + permission: push diff --git a/.github/trusted-contribution.yml b/.github/trusted-contribution.yml new file mode 100644 index 0000000..f247d5c --- /dev/null +++ b/.github/trusted-contribution.yml @@ -0,0 +1,2 @@ +trustedContributors: +- renovate-bot \ 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 0000000..7513aca --- /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 + 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/auto-release.yaml b/.github/workflows/auto-release.yaml new file mode 100644 index 0000000..9b4fd4d --- /dev/null +++ b/.github/workflows/auto-release.yaml @@ -0,0 +1,88 @@ +on: + pull_request: +name: auto-release +jobs: + approve: + runs-on: ubuntu-latest + if: contains(github.head_ref, 'release-please') + steps: + - uses: actions/github-script@v3 + with: + github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} + debug: true + script: | + // only approve PRs from release-please[bot] + if (context.payload.pull_request.user.login !== "release-please[bot]") { + return; + } + + // only approve PRs like "chore: release " + if ( !context.payload.pull_request.title.startsWith("chore: release") ) { + return; + } + + // only approve PRs with pom.xml and versions.txt changes + const filesPromise = github.pulls.listFiles.endpoint({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + }); + const changed_files = await github.paginate(filesPromise) + + if ( changed_files.length < 1 ) { + console.log( "Not proceeding since PR is empty!" ) + return; + } + + if ( !changed_files.some(v => v.filename.includes("pom")) || !changed_files.some(v => v.filename.includes("versions.txt")) ) { + console.log( "PR file changes do not have pom.xml or versions.txt -- something is wrong. PTAL!" ) + return; + } + + // trigger auto-release when + // 1) it is a SNAPSHOT release (auto-generated post regular release) + // 2) there are dependency updates only + // 3) there are no open dependency update PRs in this repo (to avoid multiple releases) + if ( + context.payload.pull_request.body.includes("Fix") || + context.payload.pull_request.body.includes("Build") || + context.payload.pull_request.body.includes("Documentation") || + context.payload.pull_request.body.includes("BREAKING CHANGES") || + context.payload.pull_request.body.includes("Features") + ) { + console.log( "Not auto-releasing since it is not a dependency-update-only release." ); + return; + } + + const promise = github.pulls.list.endpoint({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open' + }); + const open_pulls = await github.paginate(promise) + + if ( open_pulls.length > 1 && !context.payload.pull_request.title.includes("SNAPSHOT") ) { + for ( const pull of open_pulls ) { + if ( pull.title.startsWith("deps: update dependency") ) { + console.log( "Not auto-releasing yet since there are dependency update PRs open in this repo." ); + return; + } + } + } + + // approve release PR + await github.pulls.createReview({ + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Rubber stamped release!', + pull_number: context.payload.pull_request.number, + event: 'APPROVE' + }); + + // attach kokoro:force-run and automerge labels + await github.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + labels: ['kokoro:force-run', 'automerge'] + }); diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..0195b32 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,79 @@ +on: + push: + branches: + - master + pull_request: +name: ci +jobs: + units: + runs-on: ubuntu-latest + strategy: + matrix: + java: [7, 8, 11] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: ${{matrix.java}} + - run: java -version + - run: .kokoro/build.sh + env: + JOB_TYPE: test + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 8 + - run: java -version + - run: .kokoro/build.bat + env: + JOB_TYPE: test + dependencies: + runs-on: ubuntu-latest + strategy: + matrix: + java: [8, 11] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: ${{matrix.java}} + - run: java -version + - run: .kokoro/dependencies.sh + linkage-monitor: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 8 + - run: java -version + - name: Install artifacts to local Maven repository + run: .kokoro/build.sh + shell: bash + - name: Validate any conflicts with regard to com.google.cloud:libraries-bom (latest release) + uses: GoogleCloudPlatform/cloud-opensource-java/linkage-monitor@v1-linkagemonitor + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 8 + - run: java -version + - run: .kokoro/build.sh + env: + JOB_TYPE: lint + clirr: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 8 + - run: java -version + - run: .kokoro/build.sh + env: + JOB_TYPE: clirr diff --git a/.github/workflows/samples.yaml b/.github/workflows/samples.yaml new file mode 100644 index 0000000..c46230a --- /dev/null +++ b/.github/workflows/samples.yaml @@ -0,0 +1,14 @@ +on: + pull_request: +name: samples +jobs: + checkstyle: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 8 + - name: Run checkstyle + run: mvn -P lint --quiet --batch-mode checkstyle:check + working-directory: samples/snippets diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..069d08f --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +# Maven +target/ + +# Eclipse +.classpath +.project +.settings + +# Intellij +*.iml +.idea/ + +# python utilities +*.pyc +__pycache__ + +.flattened-pom.xml diff --git a/.kokoro/build.bat b/.kokoro/build.bat new file mode 100644 index 0000000..05826ad --- /dev/null +++ b/.kokoro/build.bat @@ -0,0 +1,3 @@ +:: See documentation in type-shell-output.bat + +"C:\Program Files\Git\bin\bash.exe" %~dp0build.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh new file mode 100755 index 0000000..d91eae2 --- /dev/null +++ b/.kokoro/build.sh @@ -0,0 +1,125 @@ +#!/bin/bash +# Copyright 2019 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. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +# include common functions +source ${scriptDir}/common.sh + +# Print out Maven & Java version +mvn -version +echo ${JOB_TYPE} + +# attempt to install 3 times with exponential backoff (starting with 10 seconds) +retry_with_backoff 3 10 \ + mvn install -B -V -ntp \ + -DskipTests=true \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dmaven.javadoc.skip=true \ + -Dgcloud.download.skip=true \ + -T 1C + +# if GOOGLE_APPLICATION_CREDENTIALS is specified as a relative path, prepend Kokoro root directory onto it +if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then + export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS}) +fi + +RETURN_CODE=0 +set +e + +case ${JOB_TYPE} in +test) + mvn test -B -Dclirr.skip=true -Denforcer.skip=true + RETURN_CODE=$? + ;; +lint) + mvn com.coveo:fmt-maven-plugin:check + RETURN_CODE=$? + ;; +javadoc) + mvn javadoc:javadoc javadoc:test-javadoc + RETURN_CODE=$? + ;; +integration) + mvn -B ${INTEGRATION_TEST_ARGS} \ + -ntp \ + -Penable-integration-tests \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -fae \ + verify + RETURN_CODE=$? + ;; +samples) + 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 + SAMPLES_DIR=samples/snapshot + fi + + if [[ -f ${SAMPLES_DIR}/pom.xml ]] + then + for FILE in ${KOKORO_GFILE_DIR}/secret_manager/*-samples-secrets; do + [[ -f "$FILE" ]] || continue + source "$FILE" + done + + pushd ${SAMPLES_DIR} + mvn -B \ + -Penable-samples \ + -ntp \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -fae \ + verify + RETURN_CODE=$? + popd + else + echo "no sample pom.xml found - skipping sample tests" + fi + ;; +clirr) + mvn -B -Denforcer.skip=true clirr:check + RETURN_CODE=$? + ;; +*) + ;; +esac + +if [ "${REPORT_COVERAGE}" == "true" ] +then + bash ${KOKORO_GFILE_DIR}/codecov.sh +fi + +# fix output location of logs +bash .kokoro/coerce_logs.sh + +if [[ "${ENABLE_BUILD_COP}" == "true" ]] +then + chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot + ${KOKORO_GFILE_DIR}/linux_amd64/flakybot -repo=googleapis/java-gke-connect-gateway +fi + +echo "exiting with ${RETURN_CODE}" +exit ${RETURN_CODE} diff --git a/.kokoro/coerce_logs.sh b/.kokoro/coerce_logs.sh new file mode 100755 index 0000000..5cf7ba4 --- /dev/null +++ b/.kokoro/coerce_logs.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Copyright 2019 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. + +# This script finds and moves sponge logs so that they can be found by placer +# and are not flagged as flaky by sponge. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +job=$(basename ${KOKORO_JOB_NAME}) + +echo "coercing sponge logs..." +for xml in `find . -name *-sponge_log.xml` +do + echo "processing ${xml}" + class=$(basename ${xml} | cut -d- -f2) + dir=$(dirname ${xml})/${job}/${class} + text=$(dirname ${xml})/${class}-sponge_log.txt + mkdir -p ${dir} + mv ${xml} ${dir}/sponge_log.xml + mv ${text} ${dir}/sponge_log.txt +done diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg new file mode 100644 index 0000000..0d7c1fb --- /dev/null +++ b/.kokoro/common.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Download trampoline resources. These will be in ${KOKORO_GFILE_DIR} +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# All builds use the trampoline script to run in docker. +build_file: "java-gke-connect-gateway/.kokoro/trampoline.sh" + +# Tell the trampoline which build file to use. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-gke-connect-gateway/.kokoro/build.sh" +} diff --git a/.kokoro/common.sh b/.kokoro/common.sh new file mode 100644 index 0000000..ace89f4 --- /dev/null +++ b/.kokoro/common.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# 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. + +function retry_with_backoff { + attempts_left=$1 + sleep_seconds=$2 + shift 2 + command=$@ + + + # store current flag state + flags=$- + + # allow a failures to continue + set +e + ${command} + exit_code=$? + + # restore "e" flag + if [[ ${flags} =~ e ]] + then set -e + else set +e + fi + + if [[ $exit_code == 0 ]] + then + return 0 + fi + + # failure + if [[ ${attempts_left} > 0 ]] + then + echo "failure (${exit_code}), sleeping ${sleep_seconds}..." + sleep ${sleep_seconds} + new_attempts=$((${attempts_left} - 1)) + new_sleep=$((${sleep_seconds} * 2)) + retry_with_backoff ${new_attempts} ${new_sleep} ${command} + fi + + return $exit_code +} + +## Helper functionss +function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; } +function msg() { println "$*" >&2; } +function println() { printf '%s\n' "$(now) $*"; } \ No newline at end of file diff --git a/.kokoro/continuous/common.cfg b/.kokoro/continuous/common.cfg new file mode 100644 index 0000000..60038f7 --- /dev/null +++ b/.kokoro/continuous/common.cfg @@ -0,0 +1,25 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-gke-connect-gateway/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-gke-connect-gateway/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} diff --git a/.kokoro/continuous/java8.cfg b/.kokoro/continuous/java8.cfg new file mode 100644 index 0000000..495cc7b --- /dev/null +++ b/.kokoro/continuous/java8.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/.kokoro/continuous/readme.cfg b/.kokoro/continuous/readme.cfg new file mode 100644 index 0000000..7115bb8 --- /dev/null +++ b/.kokoro/continuous/readme.cfg @@ -0,0 +1,55 @@ +# 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. + +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-multi" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-gke-connect-gateway/.kokoro/readme.sh" +} + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.log" + } +} + +# The github token is stored here. +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "yoshi-automation-github-key" + # TODO(theacodes): remove this after secrets have globally propagated + backend_type: FASTCONFIGPUSH + } + } +} + +# Common env vars for all repositories and builds. +env_vars: { + key: "GITHUB_USER" + value: "yoshi-automation" +} +env_vars: { + key: "GITHUB_EMAIL" + value: "yoshi-automation@google.com" +} diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh new file mode 100755 index 0000000..59d2aaf --- /dev/null +++ b/.kokoro/dependencies.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# Copyright 2019 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. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +# include common functions +source ${scriptDir}/common.sh + +# Print out Java +java -version +echo $JOB_TYPE + +export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m" + +# this should run maven enforcer +retry_with_backoff 3 10 \ + mvn install -B -V -ntp \ + -DskipTests=true \ + -Dmaven.javadoc.skip=true \ + -Dclirr.skip=true + +mvn -B dependency:analyze -DfailOnWarning=true + +echo "****************** DEPENDENCY LIST COMPLETENESS CHECK *******************" +## Run dependency list completeness check +function completenessCheck() { + # Output dep list with compile scope generated using the original pom + # Running mvn dependency:list on Java versions that support modules will also include the module of the dependency. + # This is stripped from the output as it is not present in the flattened pom. + # Only dependencies with 'compile' or 'runtime' scope are included from original dependency list. + msg "Generating dependency list using original pom..." + mvn dependency:list -f pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' | sed -e s/\\s--\\smodule.*// >.org-list.txt + + # Output dep list generated using the flattened pom (only 'compile' and 'runtime' scopes) + msg "Generating dependency list using flattened pom..." + mvn dependency:list -f .flattened-pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt + + # Compare two dependency lists + msg "Comparing dependency lists..." + diff .org-list.txt .new-list.txt >.diff.txt + if [[ $? == 0 ]] + then + msg "Success. No diff!" + else + msg "Diff found. See below: " + msg "You can also check .diff.txt file located in $1." + cat .diff.txt + return 1 + fi +} + +# Allow failures to continue running the script +set +e + +error_count=0 +for path in $(find -name ".flattened-pom.xml") +do + # Check flattened pom in each dir that contains it for completeness + dir=$(dirname "$path") + pushd "$dir" + completenessCheck "$dir" + error_count=$(($error_count + $?)) + popd +done + +if [[ $error_count == 0 ]] +then + msg "All checks passed." + exit 0 +else + msg "Errors found. See log statements above." + exit 1 +fi diff --git a/.kokoro/nightly/common.cfg b/.kokoro/nightly/common.cfg new file mode 100644 index 0000000..60038f7 --- /dev/null +++ b/.kokoro/nightly/common.cfg @@ -0,0 +1,25 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-gke-connect-gateway/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-gke-connect-gateway/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} diff --git a/.kokoro/nightly/integration.cfg b/.kokoro/nightly/integration.cfg new file mode 100644 index 0000000..0048c8e --- /dev/null +++ b/.kokoro/nightly/integration.cfg @@ -0,0 +1,37 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "integration" +} +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "ENABLE_BUILD_COP" + value: "true" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} diff --git a/.kokoro/nightly/java11.cfg b/.kokoro/nightly/java11.cfg new file mode 100644 index 0000000..709f2b4 --- /dev/null +++ b/.kokoro/nightly/java11.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} diff --git a/.kokoro/nightly/java7.cfg b/.kokoro/nightly/java7.cfg new file mode 100644 index 0000000..cb24f44 --- /dev/null +++ b/.kokoro/nightly/java7.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java7" +} diff --git a/.kokoro/nightly/java8-osx.cfg b/.kokoro/nightly/java8-osx.cfg new file mode 100644 index 0000000..d1dcee5 --- /dev/null +++ b/.kokoro/nightly/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-gke-connect-gateway/.kokoro/build.sh" diff --git a/.kokoro/nightly/java8-win.cfg b/.kokoro/nightly/java8-win.cfg new file mode 100644 index 0000000..e18ad04 --- /dev/null +++ b/.kokoro/nightly/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-gke-connect-gateway/.kokoro/build.bat" diff --git a/.kokoro/nightly/java8.cfg b/.kokoro/nightly/java8.cfg new file mode 100644 index 0000000..495cc7b --- /dev/null +++ b/.kokoro/nightly/java8.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/.kokoro/nightly/samples.cfg b/.kokoro/nightly/samples.cfg new file mode 100644 index 0000000..f254293 --- /dev/null +++ b/.kokoro/nightly/samples.cfg @@ -0,0 +1,38 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "samples" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-docs-samples-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-docs-samples-service-account" +} + +env_vars: { + key: "ENABLE_BUILD_COP" + value: "true" +} diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh new file mode 100755 index 0000000..f525142 --- /dev/null +++ b/.kokoro/populate-secrets.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# 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. + +set -eo pipefail + +function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} +function msg { println "$*" >&2 ;} +function println { printf '%s\n' "$(now) $*" ;} + + +# Populates requested secrets set in SECRET_MANAGER_KEYS from service account: +# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com +SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" +msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" +mkdir -p ${SECRET_LOCATION} +for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") +do + msg "Retrieving secret ${key}" + docker run --entrypoint=gcloud \ + --volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \ + gcr.io/google.com/cloudsdktool/cloud-sdk \ + secrets versions access latest \ + --project cloud-devrel-kokoro-resources \ + --secret ${key} > \ + "${SECRET_LOCATION}/${key}" + if [[ $? == 0 ]]; then + msg "Secret written to ${SECRET_LOCATION}/${key}" + else + msg "Error retrieving secret ${key}" + fi +done diff --git a/.kokoro/presubmit/clirr.cfg b/.kokoro/presubmit/clirr.cfg new file mode 100644 index 0000000..ec57244 --- /dev/null +++ b/.kokoro/presubmit/clirr.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "clirr" +} \ No newline at end of file diff --git a/.kokoro/presubmit/common.cfg b/.kokoro/presubmit/common.cfg new file mode 100644 index 0000000..bbe4bbc --- /dev/null +++ b/.kokoro/presubmit/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-gke-connect-gateway/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-gke-connect-gateway/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "dpebot_codecov_token" + } + } +} diff --git a/.kokoro/presubmit/dependencies.cfg b/.kokoro/presubmit/dependencies.cfg new file mode 100644 index 0000000..f6cd2dd --- /dev/null +++ b/.kokoro/presubmit/dependencies.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-gke-connect-gateway/.kokoro/dependencies.sh" +} diff --git a/.kokoro/presubmit/integration.cfg b/.kokoro/presubmit/integration.cfg new file mode 100644 index 0000000..dded67a --- /dev/null +++ b/.kokoro/presubmit/integration.cfg @@ -0,0 +1,33 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "integration" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} diff --git a/.kokoro/presubmit/java11.cfg b/.kokoro/presubmit/java11.cfg new file mode 100644 index 0000000..709f2b4 --- /dev/null +++ b/.kokoro/presubmit/java11.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} diff --git a/.kokoro/presubmit/java7.cfg b/.kokoro/presubmit/java7.cfg new file mode 100644 index 0000000..cb24f44 --- /dev/null +++ b/.kokoro/presubmit/java7.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java7" +} diff --git a/.kokoro/presubmit/java8-osx.cfg b/.kokoro/presubmit/java8-osx.cfg new file mode 100644 index 0000000..d1dcee5 --- /dev/null +++ b/.kokoro/presubmit/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-gke-connect-gateway/.kokoro/build.sh" diff --git a/.kokoro/presubmit/java8-win.cfg b/.kokoro/presubmit/java8-win.cfg new file mode 100644 index 0000000..e18ad04 --- /dev/null +++ b/.kokoro/presubmit/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-gke-connect-gateway/.kokoro/build.bat" diff --git a/.kokoro/presubmit/java8.cfg b/.kokoro/presubmit/java8.cfg new file mode 100644 index 0000000..495cc7b --- /dev/null +++ b/.kokoro/presubmit/java8.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/.kokoro/presubmit/linkage-monitor.cfg b/.kokoro/presubmit/linkage-monitor.cfg new file mode 100644 index 0000000..c2b9f44 --- /dev/null +++ b/.kokoro/presubmit/linkage-monitor.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-gke-connect-gateway/.kokoro/linkage-monitor.sh" +} \ No newline at end of file diff --git a/.kokoro/presubmit/lint.cfg b/.kokoro/presubmit/lint.cfg new file mode 100644 index 0000000..6d323c8 --- /dev/null +++ b/.kokoro/presubmit/lint.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "lint" +} \ No newline at end of file diff --git a/.kokoro/presubmit/samples.cfg b/.kokoro/presubmit/samples.cfg new file mode 100644 index 0000000..01e0960 --- /dev/null +++ b/.kokoro/presubmit/samples.cfg @@ -0,0 +1,33 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "samples" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-docs-samples-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-docs-samples-service-account" +} \ No newline at end of file diff --git a/.kokoro/readme.sh b/.kokoro/readme.sh new file mode 100755 index 0000000..e356020 --- /dev/null +++ b/.kokoro/readme.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# 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. + +set -eo pipefail + +cd ${KOKORO_ARTIFACTS_DIR}/github/java-gke-connect-gateway + +# Disable buffering, so that the logs stream through. +export PYTHONUNBUFFERED=1 + +# Kokoro exposes this as a file, but the scripts expect just a plain variable. +export GITHUB_TOKEN=$(cat ${KOKORO_KEYSTORE_DIR}/73713_yoshi-automation-github-key) + +# Setup git credentials +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-gke-connect-gateway \ + --synth-file-name=.github/readme/synth.py \ + --metadata-path=.github/readme/synth.metadata \ + --pr-title="chore: regenerate README" \ + --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/bump_snapshot.cfg b/.kokoro/release/bump_snapshot.cfg new file mode 100644 index 0000000..a81afaf --- /dev/null +++ b/.kokoro/release/bump_snapshot.cfg @@ -0,0 +1,53 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-gke-connect-gateway/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-gke-connect-gateway/.kokoro/release/bump_snapshot.sh" +} + +# tokens used by release-please to keep an up-to-date release PR. +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-key-release-please" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-token-release-please" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-url-release-please" + } + } +} diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg new file mode 100644 index 0000000..a70da0e --- /dev/null +++ b/.kokoro/release/common.cfg @@ -0,0 +1,49 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-gke-connect-gateway/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-keyring" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-passphrase" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-pubkeyring" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "sonatype-credentials" + } + } +} diff --git a/.kokoro/release/common.sh b/.kokoro/release/common.sh new file mode 100755 index 0000000..6e3f659 --- /dev/null +++ b/.kokoro/release/common.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# 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. + +set -eo pipefail + +# Get secrets from keystore and set and environment variables +setup_environment_secrets() { + export GPG_PASSPHRASE=$(cat ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-passphrase) + export GPG_TTY=$(tty) + export GPG_HOMEDIR=/gpg + mkdir $GPG_HOMEDIR + mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-pubkeyring $GPG_HOMEDIR/pubring.gpg + mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-keyring $GPG_HOMEDIR/secring.gpg + export SONATYPE_USERNAME=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f1 -d'|') + export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|') +} + +create_settings_xml_file() { + echo " + + + ossrh + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + + sonatype-nexus-staging + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + + sonatype-nexus-snapshots + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + +" > $1 +} \ No newline at end of file diff --git a/.kokoro/release/drop.cfg b/.kokoro/release/drop.cfg new file mode 100644 index 0000000..34a2c02 --- /dev/null +++ b/.kokoro/release/drop.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-gke-connect-gateway/.kokoro/release/drop.sh" +} diff --git a/.kokoro/release/drop.sh b/.kokoro/release/drop.sh new file mode 100755 index 0000000..5c4551e --- /dev/null +++ b/.kokoro/release/drop.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# 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. + +set -eo pipefail + +# STAGING_REPOSITORY_ID must be set +if [ -z "${STAGING_REPOSITORY_ID}" ]; then + echo "Missing STAGING_REPOSITORY_ID environment variable" + exit 1 +fi + +source $(dirname "$0")/common.sh +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn nexus-staging:drop -B \ + --settings=settings.xml \ + -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/promote.cfg b/.kokoro/release/promote.cfg new file mode 100644 index 0000000..a406181 --- /dev/null +++ b/.kokoro/release/promote.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-gke-connect-gateway/.kokoro/release/promote.sh" +} diff --git a/.kokoro/release/promote.sh b/.kokoro/release/promote.sh new file mode 100755 index 0000000..1fa95fa --- /dev/null +++ b/.kokoro/release/promote.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# 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. + +set -eo pipefail + +# STAGING_REPOSITORY_ID must be set +if [ -z "${STAGING_REPOSITORY_ID}" ]; then + echo "Missing STAGING_REPOSITORY_ID environment variable" + exit 1 +fi + +source $(dirname "$0")/common.sh + +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn nexus-staging:release -B \ + -DperformRelease=true \ + --settings=settings.xml \ + -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/publish_javadoc.cfg b/.kokoro/release/publish_javadoc.cfg new file mode 100644 index 0000000..950cad9 --- /dev/null +++ b/.kokoro/release/publish_javadoc.cfg @@ -0,0 +1,23 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/doc-templates/" + +env_vars: { + key: "STAGING_BUCKET" + value: "docs-staging" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-gke-connect-gateway/.kokoro/release/publish_javadoc.sh" +} + + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "docuploader_service_account" + } + } +} diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh new file mode 100755 index 0000000..8437d7b --- /dev/null +++ b/.kokoro/release/publish_javadoc.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Copyright 2019 Google Inc. +# +# 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. + +set -eo pipefail + +if [[ -z "${CREDENTIALS}" ]]; then + CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account +fi + +if [[ -z "${STAGING_BUCKET}" ]]; then + echo "Need to set STAGING_BUCKET environment variable" + exit 1 +fi + +# work from the git root directory +pushd $(dirname "$0")/../../ + +# install docuploader package +python3 -m pip install gcp-docuploader + +# compile all packages +mvn clean install -B -q -DskipTests=true + +export NAME=google-cloud-gke-connect-gateway +export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) + +# build the docs +mvn site -B -q + +pushd target/site/apidocs + +# create metadata +python3 -m docuploader create-metadata \ + --name ${NAME} \ + --version ${VERSION} \ + --language java + +# upload docs +python3 -m docuploader upload . \ + --credentials ${CREDENTIALS} \ + --staging-bucket ${STAGING_BUCKET} diff --git a/.kokoro/release/publish_javadoc11.cfg b/.kokoro/release/publish_javadoc11.cfg new file mode 100644 index 0000000..618e4d9 --- /dev/null +++ b/.kokoro/release/publish_javadoc11.cfg @@ -0,0 +1,30 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# cloud-rad production +env_vars: { + key: "STAGING_BUCKET_V2" + value: "docs-staging-v2" +} + +# Configure the docker image for kokoro-trampoline +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-gke-connect-gateway/.kokoro/release/publish_javadoc11.sh" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "docuploader_service_account" + } + } +} + +# Downloads docfx doclet resource. This will be in ${KOKORO_GFILE_DIR}/ +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/docfx" diff --git a/.kokoro/release/publish_javadoc11.sh b/.kokoro/release/publish_javadoc11.sh new file mode 100755 index 0000000..24c86b4 --- /dev/null +++ b/.kokoro/release/publish_javadoc11.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# Copyright 2021 Google Inc. +# +# 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. + +set -eo pipefail + +if [[ -z "${CREDENTIALS}" ]]; then + CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account +fi + +if [[ -z "${STAGING_BUCKET_V2}" ]]; then + echo "Need to set STAGING_BUCKET_V2 environment variable" + exit 1 +fi + +# work from the git root directory +pushd $(dirname "$0")/../../ + +# install docuploader package +python3 -m pip install gcp-docuploader + +# compile all packages +mvn clean install -B -q -DskipTests=true + +export NAME=google-cloud-gke-connect-gateway +export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) + +# V3 generates docfx yml from javadoc +# generate yml +mvn clean site -B -q -P docFX + +# copy README to docfx-yml dir and rename index.md +cp README.md target/docfx-yml/index.md +# copy CHANGELOG to docfx-yml dir and rename history.md +cp CHANGELOG.md target/docfx-yml/history.md + +pushd target/docfx-yml + +# create metadata +python3 -m docuploader create-metadata \ + --name ${NAME} \ + --version ${VERSION} \ + --xrefs devsite://java/gax \ + --xrefs devsite://java/google-cloud-core \ + --xrefs devsite://java/api-common \ + --xrefs devsite://java/proto-google-common-protos \ + --xrefs devsite://java/google-api-client \ + --xrefs devsite://java/google-http-client \ + --xrefs devsite://java/protobuf \ + --language java + +# upload yml to production bucket +python3 -m docuploader upload . \ + --credentials ${CREDENTIALS} \ + --staging-bucket ${STAGING_BUCKET_V2} \ + --destination-prefix docfx diff --git a/.kokoro/release/snapshot.cfg b/.kokoro/release/snapshot.cfg new file mode 100644 index 0000000..53f6b96 --- /dev/null +++ b/.kokoro/release/snapshot.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-gke-connect-gateway/.kokoro/release/snapshot.sh" +} \ No newline at end of file diff --git a/.kokoro/release/snapshot.sh b/.kokoro/release/snapshot.sh new file mode 100755 index 0000000..1f55b77 --- /dev/null +++ b/.kokoro/release/snapshot.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Copyright 2019 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. + +set -eo pipefail + +source $(dirname "$0")/common.sh +MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml +pushd $(dirname "$0")/../../ + +# ensure we're trying to push a snapshot (no-result returns non-zero exit code) +grep SNAPSHOT versions.txt + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn clean deploy -B \ + --settings ${MAVEN_SETTINGS_FILE} \ + -DperformRelease=true \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} diff --git a/.kokoro/release/stage.cfg b/.kokoro/release/stage.cfg new file mode 100644 index 0000000..442634e --- /dev/null +++ b/.kokoro/release/stage.cfg @@ -0,0 +1,19 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-gke-connect-gateway/.kokoro/release/stage.sh" +} + +# Need to save the properties file +action { + define_artifacts { + regex: "github/java-gke-connect-gateway/target/nexus-staging/staging/*.properties" + strip_prefix: "github/java-gke-connect-gateway" + } +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" +} diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh new file mode 100755 index 0000000..8a10338 --- /dev/null +++ b/.kokoro/release/stage.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# 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. + +set -eo pipefail + +# Start the releasetool reporter +python3 -m pip install gcp-releasetool +python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script + +source $(dirname "$0")/common.sh +source $(dirname "$0")/../common.sh +MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +# attempt to stage 3 times with exponential backoff (starting with 10 seconds) +retry_with_backoff 3 10 \ + mvn clean deploy -B \ + --settings ${MAVEN_SETTINGS_FILE} \ + -DskipTests=true \ + -DperformRelease=true \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} + +if [[ -n "${AUTORELEASE_PR}" ]] +then + mvn nexus-staging:release -B \ + -DperformRelease=true \ + --settings=settings.xml +fi \ No newline at end of file diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh new file mode 100644 index 0000000..9da0f83 --- /dev/null +++ b/.kokoro/trampoline.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# 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. +set -eo pipefail +# Always run the cleanup script, regardless of the success of bouncing into +# the container. +function cleanup() { + chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + echo "cleanup"; +} +trap cleanup EXIT + +$(dirname $0)/populate-secrets.sh # Secret Manager secrets. +python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/.repo-metadata.json b/.repo-metadata.json new file mode 100644 index 0000000..b1d782c --- /dev/null +++ b/.repo-metadata.json @@ -0,0 +1,15 @@ +{ + "name": "gke-connect-gateway", + "name_pretty": "Connect Gateway API", + "product_documentation": "https://cloud.google.com/anthos/multicluster-management/gateway/", + "api_description": "builds on the power of fleets to let Anthos users connect to and run commands against registered Anthos clusters in a simple, consistent, and secured way, whether the clusters are on Google Cloud, other public clouds, or on premises, and makes it easier to automate DevOps processes across all your clusters.", + "client_documentation": "https://googleapis.dev/java/google-cloud-gke-connect-gateway/latest/index.html", + "release_level": "beta", + "transport": "grpc", + "language": "java", + "repo": "googleapis/java-gke-connect-gateway", + "repo_short": "java-gke-connect-gateway", + "distribution_name": "com.google.cloud:google-cloud-gke-connect-gateway", + "api_id": "gke-connect-gateway.googleapis.com", + "requires_billing": true +} \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..2add254 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,94 @@ + +# Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal appearance, +race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +This Code of Conduct also applies outside the project spaces when the Project +Steward has a reasonable belief that an individual's behavior may have a +negative impact on the project or its community. + +## Conflict Resolution + +We do not believe that all conflict is bad; healthy debate and disagreement +often yield positive results. However, it is never okay to be disrespectful or +to engage in behavior that violates the project’s code of conduct. + +If you see someone violating the code of conduct, you are encouraged to address +the behavior directly with those involved. Many issues can be resolved quickly +and easily, and this gives people more control over the outcome of their +dispute. If you are unable to resolve the matter for any reason, or if the +behavior is threatening or harassing, report it. We are dedicated to providing +an environment where participants feel welcome and safe. + +Reports should be directed to *googleapis-stewards@google.com*, the +Project Steward(s) for *Google Cloud Client Libraries*. It is the Project Steward’s duty to +receive and address reported violations of the code of conduct. They will then +work with a committee consisting of representatives from the Open Source +Programs Office and the Google Open Source Strategy team. If for any reason you +are uncomfortable reaching out to the Project Steward, please email +opensource@google.com. + +We will investigate every complaint, but you may not receive a direct response. +We will use our discretion in determining when and how to follow up on reported +incidents, which may range from not taking action to permanent expulsion from +the project and project-sponsored spaces. We will notify the accused of the +report and provide them an opportunity to discuss it before any action is taken. +The identity of the reporter will be omitted from the details of the report +supplied to the accused. In potentially harmful situations, such as ongoing +harassment or threats to anyone's safety, we may take action without notice. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..f2dbdee --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,139 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. There are +just a few small guidelines you need to follow. + +## Contributor License Agreement + +Contributions to this project must be accompanied by a Contributor License +Agreement. You (or your employer) retain the copyright to your contribution; +this simply gives us permission to use and redistribute your contributions as +part of the project. Head over to to see +your current agreements on file or to sign a new one. + +You generally only need to submit a CLA once, so if you've already submitted one +(even if it was for a different project), you probably don't need to do it +again. + +## Code reviews + +All submissions, including submissions by project members, require review. We +use GitHub pull requests for this purpose. Consult +[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more +information on using pull requests. + +## Community Guidelines + +This project follows +[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/). + +## Building the project + +To build, package, and run all unit tests run the command + +``` +mvn clean verify +``` + +### Running Integration tests + +To include integration tests when building the project, you need access to +a GCP Project with a valid service account. + +For instructions on how to generate a service account and corresponding +credentials JSON see: [Creating a Service Account][1]. + +Then run the following to build, package, run all unit tests and run all +integration tests. + +```bash +export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json +mvn -Penable-integration-tests clean verify +``` + +## Code Samples + +Code Samples must be bundled in separate Maven modules, and guarded by a +Maven profile with the name `enable-samples`. + +The samples must be separate from the primary project for a few reasons: +1. Primary projects have a minimum Java version of Java 7 whereas samples have + a minimum Java version of Java 8. Due to this we need the ability to + selectively exclude samples from a build run. +2. Many code samples depend on external GCP services and need + credentials to access the service. +3. Code samples are not released as Maven artifacts and must be excluded from + release builds. + +### Building + +```bash +mvn -Penable-samples clean verify +``` + +Some samples require access to GCP services and require a service account: + +```bash +export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json +mvn -Penable-samples clean verify +``` + +### Profile Config + +1. To add samples in a profile to your Maven project, add the following to your +`pom.xml` + + ```xml + + [...] + + + enable-samples + + sample + + + + [...] + + ``` + +2. [Activate](#profile-activation) the profile. +3. Define your samples in a normal Maven project in the `samples/` directory. + +### Code Formatting + +Code in this repo is formatted with +[google-java-format](https://github.com/google/google-java-format). +To run formatting on your project, you can run: +``` +mvn com.coveo:fmt-maven-plugin:format +``` + +### Profile Activation + +To include code samples when building and testing the project, enable the +`enable-samples` Maven profile. + +#### Command line + +To activate the Maven profile on the command line add `-Penable-samples` to your +Maven command. + +#### Maven `settings.xml` + +To activate the Maven profile in your `~/.m2/settings.xml` add an entry of +`enable-samples` following the instructions in [Active Profiles][2]. + +This method has the benefit of applying to all projects you build (and is +respected by IntelliJ IDEA) and is recommended if you are going to be +contributing samples to several projects. + +#### IntelliJ IDEA + +To activate the Maven Profile inside IntelliJ IDEA, follow the instructions in +[Activate Maven profiles][3] to activate `enable-samples`. + +[1]: https://cloud.google.com/docs/authentication/getting-started#creating_a_service_account +[2]: https://maven.apache.org/settings.html#Active_Profiles +[3]: https://www.jetbrains.com/help/idea/work-with-maven-profiles.html#activate_maven_profiles diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..8b58ae9 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). + +The Google Security Team will respond within 5 working days of your report on g.co/vulnz. + +We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. diff --git a/codecov.yaml b/codecov.yaml new file mode 100644 index 0000000..5724ea9 --- /dev/null +++ b/codecov.yaml @@ -0,0 +1,4 @@ +--- +codecov: + ci: + - source.cloud.google.com diff --git a/google-cloud-gke-connect-gateway-bom/pom.xml b/google-cloud-gke-connect-gateway-bom/pom.xml new file mode 100644 index 0000000..4bdf851 --- /dev/null +++ b/google-cloud-gke-connect-gateway-bom/pom.xml @@ -0,0 +1,85 @@ + + + 4.0.0 + com.google.cloud + google-cloud-gke-connect-gateway-bom + 0.0.1-SNAPSHOT + pom + + com.google.cloud + google-cloud-shared-config + 0.11.0 + + + Google Connect Gateway API BOM + https://github.com/googleapis/java-gke-connect-gateway + + BOM for Connect Gateway API + + + + Google LLC + + + + + chingor13 + Jeff Ching + chingor@google.com + Google LLC + + Developer + + + + + + scm:git:https://github.com/googleapis/java-gke-connect-gateway.git + scm:git:git@github.com:googleapis/java-gke-connect-gateway.git + https://github.com/googleapis/java-gke-connect-gateway + + + + true + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + + com.google.cloud + google-cloud-gke-connect-gateway + 0.0.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-gke-connect-gateway-v1beta1 + 0.0.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-gke-connect-gateway-v1beta1 + 0.0.1-SNAPSHOT + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + + + + + diff --git a/google-cloud-gke-connect-gateway/pom.xml b/google-cloud-gke-connect-gateway/pom.xml new file mode 100644 index 0000000..2e297a9 --- /dev/null +++ b/google-cloud-gke-connect-gateway/pom.xml @@ -0,0 +1,111 @@ + + + 4.0.0 + com.google.cloud + google-cloud-gke-connect-gateway + 0.0.1-SNAPSHOT + jar + Google Connect Gateway API + https://github.com/googleapis/java-gke-connect-gateway + Connect Gateway API builds on the power of fleets to let Anthos users connect to and run commands against registered Anthos clusters in a simple, consistent, and secured way, whether the clusters are on Google Cloud, other public clouds, or on premises, and makes it easier to automate DevOps processes across all your clusters. + + com.google.cloud + google-cloud-gke-connect-gateway-parent + 0.0.1-SNAPSHOT + + + google-cloud-gke-connect-gateway + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.api + api-common + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + + com.google.api.grpc + proto-google-cloud-gke-connect-gateway-v1beta1 + + + com.google.guava + guava + + + com.google.api + gax + + + com.google.api + gax-grpc + + + org.threeten + threetenbp + + + + + junit + junit + test + 4.13.2 + + + + com.google.api.grpc + grpc-google-cloud-gke-connect-gateway-v1beta1 + test + + + + com.google.api + gax-grpc + testlib + test + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + \ No newline at end of file diff --git a/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayServiceClient.java b/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayServiceClient.java new file mode 100644 index 0000000..c5c9f17 --- /dev/null +++ b/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayServiceClient.java @@ -0,0 +1,426 @@ +/* + * Copyright 2021 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.gkeconnect.gateway.v1beta1; + +import com.google.api.HttpBody; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.gkeconnect.gateway.v1beta1.stub.GatewayServiceStub; +import com.google.cloud.gkeconnect.gateway.v1beta1.stub.GatewayServiceStubSettings; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Gateway service is a public API which works as a Kubernetes resource model + * proxy between end users and registered Kubernetes clusters. Each RPC in this service matches with + * an HTTP verb. End user will initiate kubectl commands against the Gateway service, and Gateway + * service will forward user requests to clusters. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

{@code
+ * try (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
+ *   HttpBody request =
+ *       HttpBody.newBuilder()
+ *           .setContentType("contentType-389131437")
+ *           .setData(ByteString.EMPTY)
+ *           .addAllExtensions(new ArrayList())
+ *           .build();
+ *   HttpBody response = gatewayServiceClient.getResource(request);
+ * }
+ * }
+ * + *

Note: close() needs to be called on the GatewayServiceClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of GatewayServiceSettings to + * create(). For example: + * + *

To customize credentials: + * + *

{@code
+ * GatewayServiceSettings gatewayServiceSettings =
+ *     GatewayServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create(gatewayServiceSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * GatewayServiceSettings gatewayServiceSettings =
+ *     GatewayServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create(gatewayServiceSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class GatewayServiceClient implements BackgroundResource { + private final GatewayServiceSettings settings; + private final GatewayServiceStub stub; + + /** Constructs an instance of GatewayServiceClient with default settings. */ + public static final GatewayServiceClient create() throws IOException { + return create(GatewayServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of GatewayServiceClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final GatewayServiceClient create(GatewayServiceSettings settings) + throws IOException { + return new GatewayServiceClient(settings); + } + + /** + * Constructs an instance of GatewayServiceClient, using the given stub for making calls. This is + * for advanced usage - prefer using create(GatewayServiceSettings). + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final GatewayServiceClient create(GatewayServiceStub stub) { + return new GatewayServiceClient(stub); + } + + /** + * Constructs an instance of GatewayServiceClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GatewayServiceClient(GatewayServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((GatewayServiceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected GatewayServiceClient(GatewayServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final GatewayServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public GatewayServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * GetResource performs an HTTP GET request on the Kubernetes API Server. + * + *

Sample code: + * + *

{@code
+   * try (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
+   *   HttpBody request =
+   *       HttpBody.newBuilder()
+   *           .setContentType("contentType-389131437")
+   *           .setData(ByteString.EMPTY)
+   *           .addAllExtensions(new ArrayList())
+   *           .build();
+   *   HttpBody response = gatewayServiceClient.getResource(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final HttpBody getResource(HttpBody request) { + return getResourceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * GetResource performs an HTTP GET request on the Kubernetes API Server. + * + *

Sample code: + * + *

{@code
+   * try (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
+   *   HttpBody request =
+   *       HttpBody.newBuilder()
+   *           .setContentType("contentType-389131437")
+   *           .setData(ByteString.EMPTY)
+   *           .addAllExtensions(new ArrayList())
+   *           .build();
+   *   ApiFuture future = gatewayServiceClient.getResourceCallable().futureCall(request);
+   *   // Do something.
+   *   HttpBody response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getResourceCallable() { + return stub.getResourceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * PostResource performs an HTTP POST on the Kubernetes API Server. + * + *

Sample code: + * + *

{@code
+   * try (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
+   *   HttpBody request =
+   *       HttpBody.newBuilder()
+   *           .setContentType("contentType-389131437")
+   *           .setData(ByteString.EMPTY)
+   *           .addAllExtensions(new ArrayList())
+   *           .build();
+   *   HttpBody response = gatewayServiceClient.postResource(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final HttpBody postResource(HttpBody request) { + return postResourceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * PostResource performs an HTTP POST on the Kubernetes API Server. + * + *

Sample code: + * + *

{@code
+   * try (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
+   *   HttpBody request =
+   *       HttpBody.newBuilder()
+   *           .setContentType("contentType-389131437")
+   *           .setData(ByteString.EMPTY)
+   *           .addAllExtensions(new ArrayList())
+   *           .build();
+   *   ApiFuture future = gatewayServiceClient.postResourceCallable().futureCall(request);
+   *   // Do something.
+   *   HttpBody response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable postResourceCallable() { + return stub.postResourceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * DeleteResource performs an HTTP DELETE on the Kubernetes API Server. + * + *

Sample code: + * + *

{@code
+   * try (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
+   *   HttpBody request =
+   *       HttpBody.newBuilder()
+   *           .setContentType("contentType-389131437")
+   *           .setData(ByteString.EMPTY)
+   *           .addAllExtensions(new ArrayList())
+   *           .build();
+   *   HttpBody response = gatewayServiceClient.deleteResource(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final HttpBody deleteResource(HttpBody request) { + return deleteResourceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * DeleteResource performs an HTTP DELETE on the Kubernetes API Server. + * + *

Sample code: + * + *

{@code
+   * try (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
+   *   HttpBody request =
+   *       HttpBody.newBuilder()
+   *           .setContentType("contentType-389131437")
+   *           .setData(ByteString.EMPTY)
+   *           .addAllExtensions(new ArrayList())
+   *           .build();
+   *   ApiFuture future =
+   *       gatewayServiceClient.deleteResourceCallable().futureCall(request);
+   *   // Do something.
+   *   HttpBody response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable deleteResourceCallable() { + return stub.deleteResourceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * PutResource performs an HTTP PUT on the Kubernetes API Server. + * + *

Sample code: + * + *

{@code
+   * try (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
+   *   HttpBody request =
+   *       HttpBody.newBuilder()
+   *           .setContentType("contentType-389131437")
+   *           .setData(ByteString.EMPTY)
+   *           .addAllExtensions(new ArrayList())
+   *           .build();
+   *   HttpBody response = gatewayServiceClient.putResource(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final HttpBody putResource(HttpBody request) { + return putResourceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * PutResource performs an HTTP PUT on the Kubernetes API Server. + * + *

Sample code: + * + *

{@code
+   * try (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
+   *   HttpBody request =
+   *       HttpBody.newBuilder()
+   *           .setContentType("contentType-389131437")
+   *           .setData(ByteString.EMPTY)
+   *           .addAllExtensions(new ArrayList())
+   *           .build();
+   *   ApiFuture future = gatewayServiceClient.putResourceCallable().futureCall(request);
+   *   // Do something.
+   *   HttpBody response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable putResourceCallable() { + return stub.putResourceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * PatchResource performs an HTTP PATCH on the Kubernetes API Server. + * + *

Sample code: + * + *

{@code
+   * try (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
+   *   HttpBody request =
+   *       HttpBody.newBuilder()
+   *           .setContentType("contentType-389131437")
+   *           .setData(ByteString.EMPTY)
+   *           .addAllExtensions(new ArrayList())
+   *           .build();
+   *   HttpBody response = gatewayServiceClient.patchResource(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final HttpBody patchResource(HttpBody request) { + return patchResourceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * PatchResource performs an HTTP PATCH on the Kubernetes API Server. + * + *

Sample code: + * + *

{@code
+   * try (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
+   *   HttpBody request =
+   *       HttpBody.newBuilder()
+   *           .setContentType("contentType-389131437")
+   *           .setData(ByteString.EMPTY)
+   *           .addAllExtensions(new ArrayList())
+   *           .build();
+   *   ApiFuture future = gatewayServiceClient.patchResourceCallable().futureCall(request);
+   *   // Do something.
+   *   HttpBody response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable patchResourceCallable() { + return stub.patchResourceCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayServiceSettings.java b/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayServiceSettings.java new file mode 100644 index 0000000..e99c394 --- /dev/null +++ b/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayServiceSettings.java @@ -0,0 +1,225 @@ +/* + * Copyright 2021 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.gkeconnect.gateway.v1beta1; + +import com.google.api.HttpBody; +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.gkeconnect.gateway.v1beta1.stub.GatewayServiceStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link GatewayServiceClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (connectgateway.googleapis.com) and default port (443) are + * used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of getResource to 30 seconds: + * + *

{@code
+ * GatewayServiceSettings.Builder gatewayServiceSettingsBuilder =
+ *     GatewayServiceSettings.newBuilder();
+ * gatewayServiceSettingsBuilder
+ *     .getResourceSettings()
+ *     .setRetrySettings(
+ *         gatewayServiceSettingsBuilder
+ *             .getResourceSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * GatewayServiceSettings gatewayServiceSettings = gatewayServiceSettingsBuilder.build();
+ * }
+ */ +@BetaApi +@Generated("by gapic-generator-java") +public class GatewayServiceSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to getResource. */ + public UnaryCallSettings getResourceSettings() { + return ((GatewayServiceStubSettings) getStubSettings()).getResourceSettings(); + } + + /** Returns the object with the settings used for calls to postResource. */ + public UnaryCallSettings postResourceSettings() { + return ((GatewayServiceStubSettings) getStubSettings()).postResourceSettings(); + } + + /** Returns the object with the settings used for calls to deleteResource. */ + public UnaryCallSettings deleteResourceSettings() { + return ((GatewayServiceStubSettings) getStubSettings()).deleteResourceSettings(); + } + + /** Returns the object with the settings used for calls to putResource. */ + public UnaryCallSettings putResourceSettings() { + return ((GatewayServiceStubSettings) getStubSettings()).putResourceSettings(); + } + + /** Returns the object with the settings used for calls to patchResource. */ + public UnaryCallSettings patchResourceSettings() { + return ((GatewayServiceStubSettings) getStubSettings()).patchResourceSettings(); + } + + public static final GatewayServiceSettings create(GatewayServiceStubSettings stub) + throws IOException { + return new GatewayServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return GatewayServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return GatewayServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return GatewayServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GatewayServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return GatewayServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return GatewayServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return GatewayServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected GatewayServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for GatewayServiceSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(GatewayServiceStubSettings.newBuilder(clientContext)); + } + + protected Builder(GatewayServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(GatewayServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(GatewayServiceStubSettings.newBuilder()); + } + + public GatewayServiceStubSettings.Builder getStubSettingsBuilder() { + return ((GatewayServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception'. + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to getResource. */ + public UnaryCallSettings.Builder getResourceSettings() { + return getStubSettingsBuilder().getResourceSettings(); + } + + /** Returns the builder for the settings used for calls to postResource. */ + public UnaryCallSettings.Builder postResourceSettings() { + return getStubSettingsBuilder().postResourceSettings(); + } + + /** Returns the builder for the settings used for calls to deleteResource. */ + public UnaryCallSettings.Builder deleteResourceSettings() { + return getStubSettingsBuilder().deleteResourceSettings(); + } + + /** Returns the builder for the settings used for calls to putResource. */ + public UnaryCallSettings.Builder putResourceSettings() { + return getStubSettingsBuilder().putResourceSettings(); + } + + /** Returns the builder for the settings used for calls to patchResource. */ + public UnaryCallSettings.Builder patchResourceSettings() { + return getStubSettingsBuilder().patchResourceSettings(); + } + + @Override + public GatewayServiceSettings build() throws IOException { + return new GatewayServiceSettings(this); + } + } +} diff --git a/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/gapic_metadata.json b/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/gapic_metadata.json new file mode 100644 index 0000000..3bde4f0 --- /dev/null +++ b/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/gapic_metadata.json @@ -0,0 +1,33 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "java", + "protoPackage": "google.cloud.gkeconnect.gateway.v1beta1", + "libraryPackage": "com.google.cloud.gkeconnect.gateway.v1beta1", + "services": { + "GatewayService": { + "clients": { + "grpc": { + "libraryClient": "GatewayServiceClient", + "rpcs": { + "DeleteResource": { + "methods": ["deleteResource", "deleteResourceCallable"] + }, + "GetResource": { + "methods": ["getResource", "getResourceCallable"] + }, + "PatchResource": { + "methods": ["patchResource", "patchResourceCallable"] + }, + "PostResource": { + "methods": ["postResource", "postResourceCallable"] + }, + "PutResource": { + "methods": ["putResource", "putResourceCallable"] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/package-info.java b/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/package-info.java new file mode 100644 index 0000000..9f65836 --- /dev/null +++ b/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/package-info.java @@ -0,0 +1,44 @@ +/* + * Copyright 2021 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. + */ + +/** + * The interfaces provided are listed below, along with usage samples. + * + *

======================= GatewayServiceClient ======================= + * + *

Service Description: Gateway service is a public API which works as a Kubernetes resource + * model proxy between end users and registered Kubernetes clusters. Each RPC in this service + * matches with an HTTP verb. End user will initiate kubectl commands against the Gateway service, + * and Gateway service will forward user requests to clusters. + * + *

Sample for GatewayServiceClient: + * + *

{@code
+ * try (GatewayServiceClient gatewayServiceClient = GatewayServiceClient.create()) {
+ *   HttpBody request =
+ *       HttpBody.newBuilder()
+ *           .setContentType("contentType-389131437")
+ *           .setData(ByteString.EMPTY)
+ *           .addAllExtensions(new ArrayList())
+ *           .build();
+ *   HttpBody response = gatewayServiceClient.getResource(request);
+ * }
+ * }
+ */ +@Generated("by gapic-generator-java") +package com.google.cloud.gkeconnect.gateway.v1beta1; + +import javax.annotation.Generated; diff --git a/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/stub/GatewayServiceStub.java b/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/stub/GatewayServiceStub.java new file mode 100644 index 0000000..e252d52 --- /dev/null +++ b/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/stub/GatewayServiceStub.java @@ -0,0 +1,57 @@ +/* + * Copyright 2021 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.gkeconnect.gateway.v1beta1.stub; + +import com.google.api.HttpBody; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the GatewayService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public abstract class GatewayServiceStub implements BackgroundResource { + + public UnaryCallable getResourceCallable() { + throw new UnsupportedOperationException("Not implemented: getResourceCallable()"); + } + + public UnaryCallable postResourceCallable() { + throw new UnsupportedOperationException("Not implemented: postResourceCallable()"); + } + + public UnaryCallable deleteResourceCallable() { + throw new UnsupportedOperationException("Not implemented: deleteResourceCallable()"); + } + + public UnaryCallable putResourceCallable() { + throw new UnsupportedOperationException("Not implemented: putResourceCallable()"); + } + + public UnaryCallable patchResourceCallable() { + throw new UnsupportedOperationException("Not implemented: patchResourceCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/stub/GatewayServiceStubSettings.java b/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/stub/GatewayServiceStubSettings.java new file mode 100644 index 0000000..d80b2f8 --- /dev/null +++ b/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/stub/GatewayServiceStubSettings.java @@ -0,0 +1,352 @@ +/* + * Copyright 2021 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.gkeconnect.gateway.v1beta1.stub; + +import com.google.api.HttpBody; +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link GatewayServiceStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (connectgateway.googleapis.com) and default port (443) are + * used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of getResource to 30 seconds: + * + *

{@code
+ * GatewayServiceStubSettings.Builder gatewayServiceSettingsBuilder =
+ *     GatewayServiceStubSettings.newBuilder();
+ * gatewayServiceSettingsBuilder
+ *     .getResourceSettings()
+ *     .setRetrySettings(
+ *         gatewayServiceSettingsBuilder
+ *             .getResourceSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * GatewayServiceStubSettings gatewayServiceSettings = gatewayServiceSettingsBuilder.build();
+ * }
+ */ +@BetaApi +@Generated("by gapic-generator-java") +public class GatewayServiceStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final UnaryCallSettings getResourceSettings; + private final UnaryCallSettings postResourceSettings; + private final UnaryCallSettings deleteResourceSettings; + private final UnaryCallSettings putResourceSettings; + private final UnaryCallSettings patchResourceSettings; + + /** Returns the object with the settings used for calls to getResource. */ + public UnaryCallSettings getResourceSettings() { + return getResourceSettings; + } + + /** Returns the object with the settings used for calls to postResource. */ + public UnaryCallSettings postResourceSettings() { + return postResourceSettings; + } + + /** Returns the object with the settings used for calls to deleteResource. */ + public UnaryCallSettings deleteResourceSettings() { + return deleteResourceSettings; + } + + /** Returns the object with the settings used for calls to putResource. */ + public UnaryCallSettings putResourceSettings() { + return putResourceSettings; + } + + /** Returns the object with the settings used for calls to patchResource. */ + public UnaryCallSettings patchResourceSettings() { + return patchResourceSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public GatewayServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcGatewayServiceStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "connectgateway.googleapis.com:443"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "connectgateway.mtls.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(GatewayServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected GatewayServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + getResourceSettings = settingsBuilder.getResourceSettings().build(); + postResourceSettings = settingsBuilder.postResourceSettings().build(); + deleteResourceSettings = settingsBuilder.deleteResourceSettings().build(); + putResourceSettings = settingsBuilder.putResourceSettings().build(); + patchResourceSettings = settingsBuilder.patchResourceSettings().build(); + } + + /** Builder for GatewayServiceStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder getResourceSettings; + private final UnaryCallSettings.Builder postResourceSettings; + private final UnaryCallSettings.Builder deleteResourceSettings; + private final UnaryCallSettings.Builder putResourceSettings; + private final UnaryCallSettings.Builder patchResourceSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + getResourceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + postResourceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deleteResourceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + putResourceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + patchResourceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getResourceSettings, + postResourceSettings, + deleteResourceSettings, + putResourceSettings, + patchResourceSettings); + initDefaults(this); + } + + protected Builder(GatewayServiceStubSettings settings) { + super(settings); + + getResourceSettings = settings.getResourceSettings.toBuilder(); + postResourceSettings = settings.postResourceSettings.toBuilder(); + deleteResourceSettings = settings.deleteResourceSettings.toBuilder(); + putResourceSettings = settings.putResourceSettings.toBuilder(); + patchResourceSettings = settings.patchResourceSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getResourceSettings, + postResourceSettings, + deleteResourceSettings, + putResourceSettings, + patchResourceSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .getResourceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .postResourceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .deleteResourceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .putResourceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .patchResourceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + return builder; + } + + // NEXT_MAJOR_VER: remove 'throws Exception'. + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to getResource. */ + public UnaryCallSettings.Builder getResourceSettings() { + return getResourceSettings; + } + + /** Returns the builder for the settings used for calls to postResource. */ + public UnaryCallSettings.Builder postResourceSettings() { + return postResourceSettings; + } + + /** Returns the builder for the settings used for calls to deleteResource. */ + public UnaryCallSettings.Builder deleteResourceSettings() { + return deleteResourceSettings; + } + + /** Returns the builder for the settings used for calls to putResource. */ + public UnaryCallSettings.Builder putResourceSettings() { + return putResourceSettings; + } + + /** Returns the builder for the settings used for calls to patchResource. */ + public UnaryCallSettings.Builder patchResourceSettings() { + return patchResourceSettings; + } + + @Override + public GatewayServiceStubSettings build() throws IOException { + return new GatewayServiceStubSettings(this); + } + } +} diff --git a/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/stub/GrpcGatewayServiceCallableFactory.java b/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/stub/GrpcGatewayServiceCallableFactory.java new file mode 100644 index 0000000..be4fa10 --- /dev/null +++ b/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/stub/GrpcGatewayServiceCallableFactory.java @@ -0,0 +1,115 @@ +/* + * Copyright 2021 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.gkeconnect.gateway.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the GatewayService service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class GrpcGatewayServiceCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/stub/GrpcGatewayServiceStub.java b/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/stub/GrpcGatewayServiceStub.java new file mode 100644 index 0000000..5086f7d --- /dev/null +++ b/google-cloud-gke-connect-gateway/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/stub/GrpcGatewayServiceStub.java @@ -0,0 +1,233 @@ +/* + * Copyright 2021 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.gkeconnect.gateway.v1beta1.stub; + +import com.google.api.HttpBody; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.stub.GrpcOperationsStub; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the GatewayService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class GrpcGatewayServiceStub extends GatewayServiceStub { + private static final MethodDescriptor getResourceMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.gkeconnect.gateway.v1beta1.GatewayService/GetResource") + .setRequestMarshaller(ProtoUtils.marshaller(HttpBody.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(HttpBody.getDefaultInstance())) + .build(); + + private static final MethodDescriptor postResourceMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.gkeconnect.gateway.v1beta1.GatewayService/PostResource") + .setRequestMarshaller(ProtoUtils.marshaller(HttpBody.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(HttpBody.getDefaultInstance())) + .build(); + + private static final MethodDescriptor deleteResourceMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.gkeconnect.gateway.v1beta1.GatewayService/DeleteResource") + .setRequestMarshaller(ProtoUtils.marshaller(HttpBody.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(HttpBody.getDefaultInstance())) + .build(); + + private static final MethodDescriptor putResourceMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.gkeconnect.gateway.v1beta1.GatewayService/PutResource") + .setRequestMarshaller(ProtoUtils.marshaller(HttpBody.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(HttpBody.getDefaultInstance())) + .build(); + + private static final MethodDescriptor patchResourceMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.gkeconnect.gateway.v1beta1.GatewayService/PatchResource") + .setRequestMarshaller(ProtoUtils.marshaller(HttpBody.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(HttpBody.getDefaultInstance())) + .build(); + + private final UnaryCallable getResourceCallable; + private final UnaryCallable postResourceCallable; + private final UnaryCallable deleteResourceCallable; + private final UnaryCallable putResourceCallable; + private final UnaryCallable patchResourceCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcGatewayServiceStub create(GatewayServiceStubSettings settings) + throws IOException { + return new GrpcGatewayServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcGatewayServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcGatewayServiceStub( + GatewayServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcGatewayServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcGatewayServiceStub( + GatewayServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcGatewayServiceStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcGatewayServiceStub(GatewayServiceStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcGatewayServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcGatewayServiceStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcGatewayServiceStub( + GatewayServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings getResourceTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getResourceMethodDescriptor) + .build(); + GrpcCallSettings postResourceTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(postResourceMethodDescriptor) + .build(); + GrpcCallSettings deleteResourceTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteResourceMethodDescriptor) + .build(); + GrpcCallSettings putResourceTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(putResourceMethodDescriptor) + .build(); + GrpcCallSettings patchResourceTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(patchResourceMethodDescriptor) + .build(); + + this.getResourceCallable = + callableFactory.createUnaryCallable( + getResourceTransportSettings, settings.getResourceSettings(), clientContext); + this.postResourceCallable = + callableFactory.createUnaryCallable( + postResourceTransportSettings, settings.postResourceSettings(), clientContext); + this.deleteResourceCallable = + callableFactory.createUnaryCallable( + deleteResourceTransportSettings, settings.deleteResourceSettings(), clientContext); + this.putResourceCallable = + callableFactory.createUnaryCallable( + putResourceTransportSettings, settings.putResourceSettings(), clientContext); + this.patchResourceCallable = + callableFactory.createUnaryCallable( + patchResourceTransportSettings, settings.patchResourceSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable getResourceCallable() { + return getResourceCallable; + } + + @Override + public UnaryCallable postResourceCallable() { + return postResourceCallable; + } + + @Override + public UnaryCallable deleteResourceCallable() { + return deleteResourceCallable; + } + + @Override + public UnaryCallable putResourceCallable() { + return putResourceCallable; + } + + @Override + public UnaryCallable patchResourceCallable() { + return patchResourceCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-gke-connect-gateway/src/test/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayServiceClientTest.java b/google-cloud-gke-connect-gateway/src/test/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayServiceClientTest.java new file mode 100644 index 0000000..875a82c --- /dev/null +++ b/google-cloud-gke-connect-gateway/src/test/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayServiceClientTest.java @@ -0,0 +1,341 @@ +/* + * Copyright 2021 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.gkeconnect.gateway.v1beta1; + +import com.google.api.HttpBody; +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; +import com.google.protobuf.ByteString; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class GatewayServiceClientTest { + private static MockGatewayService mockGatewayService; + private static MockServiceHelper mockServiceHelper; + private LocalChannelProvider channelProvider; + private GatewayServiceClient client; + + @BeforeClass + public static void startStaticServer() { + mockGatewayService = new MockGatewayService(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockGatewayService)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + GatewayServiceSettings settings = + GatewayServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = GatewayServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void getResourceTest() throws Exception { + HttpBody expectedResponse = + HttpBody.newBuilder() + .setContentType("contentType-389131437") + .setData(ByteString.EMPTY) + .addAllExtensions(new ArrayList()) + .build(); + mockGatewayService.addResponse(expectedResponse); + + HttpBody request = + HttpBody.newBuilder() + .setContentType("contentType-389131437") + .setData(ByteString.EMPTY) + .addAllExtensions(new ArrayList()) + .build(); + + HttpBody actualResponse = client.getResource(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockGatewayService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + HttpBody actualRequest = ((HttpBody) actualRequests.get(0)); + + Assert.assertEquals(request.getContentType(), actualRequest.getContentType()); + Assert.assertEquals(request.getData(), actualRequest.getData()); + Assert.assertEquals(request.getExtensionsList(), actualRequest.getExtensionsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getResourceExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockGatewayService.addException(exception); + + try { + HttpBody request = + HttpBody.newBuilder() + .setContentType("contentType-389131437") + .setData(ByteString.EMPTY) + .addAllExtensions(new ArrayList()) + .build(); + client.getResource(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void postResourceTest() throws Exception { + HttpBody expectedResponse = + HttpBody.newBuilder() + .setContentType("contentType-389131437") + .setData(ByteString.EMPTY) + .addAllExtensions(new ArrayList()) + .build(); + mockGatewayService.addResponse(expectedResponse); + + HttpBody request = + HttpBody.newBuilder() + .setContentType("contentType-389131437") + .setData(ByteString.EMPTY) + .addAllExtensions(new ArrayList()) + .build(); + + HttpBody actualResponse = client.postResource(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockGatewayService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + HttpBody actualRequest = ((HttpBody) actualRequests.get(0)); + + Assert.assertEquals(request.getContentType(), actualRequest.getContentType()); + Assert.assertEquals(request.getData(), actualRequest.getData()); + Assert.assertEquals(request.getExtensionsList(), actualRequest.getExtensionsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void postResourceExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockGatewayService.addException(exception); + + try { + HttpBody request = + HttpBody.newBuilder() + .setContentType("contentType-389131437") + .setData(ByteString.EMPTY) + .addAllExtensions(new ArrayList()) + .build(); + client.postResource(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteResourceTest() throws Exception { + HttpBody expectedResponse = + HttpBody.newBuilder() + .setContentType("contentType-389131437") + .setData(ByteString.EMPTY) + .addAllExtensions(new ArrayList()) + .build(); + mockGatewayService.addResponse(expectedResponse); + + HttpBody request = + HttpBody.newBuilder() + .setContentType("contentType-389131437") + .setData(ByteString.EMPTY) + .addAllExtensions(new ArrayList()) + .build(); + + HttpBody actualResponse = client.deleteResource(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockGatewayService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + HttpBody actualRequest = ((HttpBody) actualRequests.get(0)); + + Assert.assertEquals(request.getContentType(), actualRequest.getContentType()); + Assert.assertEquals(request.getData(), actualRequest.getData()); + Assert.assertEquals(request.getExtensionsList(), actualRequest.getExtensionsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteResourceExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockGatewayService.addException(exception); + + try { + HttpBody request = + HttpBody.newBuilder() + .setContentType("contentType-389131437") + .setData(ByteString.EMPTY) + .addAllExtensions(new ArrayList()) + .build(); + client.deleteResource(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void putResourceTest() throws Exception { + HttpBody expectedResponse = + HttpBody.newBuilder() + .setContentType("contentType-389131437") + .setData(ByteString.EMPTY) + .addAllExtensions(new ArrayList()) + .build(); + mockGatewayService.addResponse(expectedResponse); + + HttpBody request = + HttpBody.newBuilder() + .setContentType("contentType-389131437") + .setData(ByteString.EMPTY) + .addAllExtensions(new ArrayList()) + .build(); + + HttpBody actualResponse = client.putResource(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockGatewayService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + HttpBody actualRequest = ((HttpBody) actualRequests.get(0)); + + Assert.assertEquals(request.getContentType(), actualRequest.getContentType()); + Assert.assertEquals(request.getData(), actualRequest.getData()); + Assert.assertEquals(request.getExtensionsList(), actualRequest.getExtensionsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void putResourceExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockGatewayService.addException(exception); + + try { + HttpBody request = + HttpBody.newBuilder() + .setContentType("contentType-389131437") + .setData(ByteString.EMPTY) + .addAllExtensions(new ArrayList()) + .build(); + client.putResource(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void patchResourceTest() throws Exception { + HttpBody expectedResponse = + HttpBody.newBuilder() + .setContentType("contentType-389131437") + .setData(ByteString.EMPTY) + .addAllExtensions(new ArrayList()) + .build(); + mockGatewayService.addResponse(expectedResponse); + + HttpBody request = + HttpBody.newBuilder() + .setContentType("contentType-389131437") + .setData(ByteString.EMPTY) + .addAllExtensions(new ArrayList()) + .build(); + + HttpBody actualResponse = client.patchResource(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockGatewayService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + HttpBody actualRequest = ((HttpBody) actualRequests.get(0)); + + Assert.assertEquals(request.getContentType(), actualRequest.getContentType()); + Assert.assertEquals(request.getData(), actualRequest.getData()); + Assert.assertEquals(request.getExtensionsList(), actualRequest.getExtensionsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void patchResourceExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockGatewayService.addException(exception); + + try { + HttpBody request = + HttpBody.newBuilder() + .setContentType("contentType-389131437") + .setData(ByteString.EMPTY) + .addAllExtensions(new ArrayList()) + .build(); + client.patchResource(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-gke-connect-gateway/src/test/java/com/google/cloud/gkeconnect/gateway/v1beta1/MockGatewayService.java b/google-cloud-gke-connect-gateway/src/test/java/com/google/cloud/gkeconnect/gateway/v1beta1/MockGatewayService.java new file mode 100644 index 0000000..23351b5 --- /dev/null +++ b/google-cloud-gke-connect-gateway/src/test/java/com/google/cloud/gkeconnect/gateway/v1beta1/MockGatewayService.java @@ -0,0 +1,59 @@ +/* + * Copyright 2021 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.gkeconnect.gateway.v1beta1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockGatewayService implements MockGrpcService { + private final MockGatewayServiceImpl serviceImpl; + + public MockGatewayService() { + serviceImpl = new MockGatewayServiceImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/google-cloud-gke-connect-gateway/src/test/java/com/google/cloud/gkeconnect/gateway/v1beta1/MockGatewayServiceImpl.java b/google-cloud-gke-connect-gateway/src/test/java/com/google/cloud/gkeconnect/gateway/v1beta1/MockGatewayServiceImpl.java new file mode 100644 index 0000000..ef1acde --- /dev/null +++ b/google-cloud-gke-connect-gateway/src/test/java/com/google/cloud/gkeconnect/gateway/v1beta1/MockGatewayServiceImpl.java @@ -0,0 +1,161 @@ +/* + * Copyright 2021 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.gkeconnect.gateway.v1beta1; + +import com.google.api.HttpBody; +import com.google.api.core.BetaApi; +import com.google.cloud.gkeconnect.gateway.v1beta1.GatewayServiceGrpc.GatewayServiceImplBase; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockGatewayServiceImpl extends GatewayServiceImplBase { + private List requests; + private Queue responses; + + public MockGatewayServiceImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void getResource(HttpBody request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof HttpBody) { + requests.add(request); + responseObserver.onNext(((HttpBody) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetResource, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + HttpBody.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void postResource(HttpBody request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof HttpBody) { + requests.add(request); + responseObserver.onNext(((HttpBody) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method PostResource, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + HttpBody.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void deleteResource(HttpBody request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof HttpBody) { + requests.add(request); + responseObserver.onNext(((HttpBody) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeleteResource, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + HttpBody.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void putResource(HttpBody request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof HttpBody) { + requests.add(request); + responseObserver.onNext(((HttpBody) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method PutResource, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + HttpBody.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void patchResource(HttpBody request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof HttpBody) { + requests.add(request); + responseObserver.onNext(((HttpBody) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method PatchResource, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + HttpBody.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/grpc-google-cloud-gke-connect-gateway-v1beta1/pom.xml b/grpc-google-cloud-gke-connect-gateway-v1beta1/pom.xml new file mode 100644 index 0000000..49ad225 --- /dev/null +++ b/grpc-google-cloud-gke-connect-gateway-v1beta1/pom.xml @@ -0,0 +1,69 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-gke-connect-gateway-v1beta1 + 0.0.1-SNAPSHOT + grpc-google-cloud-gke-connect-gateway-v1beta1 + GRPC library for google-cloud-gke-connect-gateway + + com.google.cloud + google-cloud-gke-connect-gateway-parent + 0.0.1-SNAPSHOT + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-cloud-gke-connect-gateway-v1beta1 + + + com.google.guava + guava + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + \ No newline at end of file diff --git a/grpc-google-cloud-gke-connect-gateway-v1beta1/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayServiceGrpc.java b/grpc-google-cloud-gke-connect-gateway-v1beta1/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayServiceGrpc.java new file mode 100644 index 0000000..7e38840 --- /dev/null +++ b/grpc-google-cloud-gke-connect-gateway-v1beta1/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayServiceGrpc.java @@ -0,0 +1,780 @@ +/* + * 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.gkeconnect.gateway.v1beta1; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + * + * + *
+ * Gateway service is a public API which works as a Kubernetes resource model
+ * proxy between end users and registered Kubernetes clusters. Each RPC in this
+ * service matches with an HTTP verb. End user will initiate kubectl commands
+ * against the Gateway service, and Gateway service will forward user requests
+ * to clusters.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/gkeconnect/gateway/v1beta1/gateway.proto") +public final class GatewayServiceGrpc { + + private GatewayServiceGrpc() {} + + public static final String SERVICE_NAME = + "google.cloud.gkeconnect.gateway.v1beta1.GatewayService"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor + getGetResourceMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetResource", + requestType = com.google.api.HttpBody.class, + responseType = com.google.api.HttpBody.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor + getGetResourceMethod() { + io.grpc.MethodDescriptor getGetResourceMethod; + if ((getGetResourceMethod = GatewayServiceGrpc.getGetResourceMethod) == null) { + synchronized (GatewayServiceGrpc.class) { + if ((getGetResourceMethod = GatewayServiceGrpc.getGetResourceMethod) == null) { + GatewayServiceGrpc.getGetResourceMethod = + getGetResourceMethod = + io.grpc.MethodDescriptor + .newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetResource")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.HttpBody.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.HttpBody.getDefaultInstance())) + .setSchemaDescriptor( + new GatewayServiceMethodDescriptorSupplier("GetResource")) + .build(); + } + } + } + return getGetResourceMethod; + } + + private static volatile io.grpc.MethodDescriptor + getPostResourceMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "PostResource", + requestType = com.google.api.HttpBody.class, + responseType = com.google.api.HttpBody.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor + getPostResourceMethod() { + io.grpc.MethodDescriptor + getPostResourceMethod; + if ((getPostResourceMethod = GatewayServiceGrpc.getPostResourceMethod) == null) { + synchronized (GatewayServiceGrpc.class) { + if ((getPostResourceMethod = GatewayServiceGrpc.getPostResourceMethod) == null) { + GatewayServiceGrpc.getPostResourceMethod = + getPostResourceMethod = + io.grpc.MethodDescriptor + .newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "PostResource")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.HttpBody.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.HttpBody.getDefaultInstance())) + .setSchemaDescriptor( + new GatewayServiceMethodDescriptorSupplier("PostResource")) + .build(); + } + } + } + return getPostResourceMethod; + } + + private static volatile io.grpc.MethodDescriptor + getDeleteResourceMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteResource", + requestType = com.google.api.HttpBody.class, + responseType = com.google.api.HttpBody.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor + getDeleteResourceMethod() { + io.grpc.MethodDescriptor + getDeleteResourceMethod; + if ((getDeleteResourceMethod = GatewayServiceGrpc.getDeleteResourceMethod) == null) { + synchronized (GatewayServiceGrpc.class) { + if ((getDeleteResourceMethod = GatewayServiceGrpc.getDeleteResourceMethod) == null) { + GatewayServiceGrpc.getDeleteResourceMethod = + getDeleteResourceMethod = + io.grpc.MethodDescriptor + .newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeleteResource")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.HttpBody.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.HttpBody.getDefaultInstance())) + .setSchemaDescriptor( + new GatewayServiceMethodDescriptorSupplier("DeleteResource")) + .build(); + } + } + } + return getDeleteResourceMethod; + } + + private static volatile io.grpc.MethodDescriptor + getPutResourceMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "PutResource", + requestType = com.google.api.HttpBody.class, + responseType = com.google.api.HttpBody.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor + getPutResourceMethod() { + io.grpc.MethodDescriptor getPutResourceMethod; + if ((getPutResourceMethod = GatewayServiceGrpc.getPutResourceMethod) == null) { + synchronized (GatewayServiceGrpc.class) { + if ((getPutResourceMethod = GatewayServiceGrpc.getPutResourceMethod) == null) { + GatewayServiceGrpc.getPutResourceMethod = + getPutResourceMethod = + io.grpc.MethodDescriptor + .newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "PutResource")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.HttpBody.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.HttpBody.getDefaultInstance())) + .setSchemaDescriptor( + new GatewayServiceMethodDescriptorSupplier("PutResource")) + .build(); + } + } + } + return getPutResourceMethod; + } + + private static volatile io.grpc.MethodDescriptor + getPatchResourceMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "PatchResource", + requestType = com.google.api.HttpBody.class, + responseType = com.google.api.HttpBody.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor + getPatchResourceMethod() { + io.grpc.MethodDescriptor + getPatchResourceMethod; + if ((getPatchResourceMethod = GatewayServiceGrpc.getPatchResourceMethod) == null) { + synchronized (GatewayServiceGrpc.class) { + if ((getPatchResourceMethod = GatewayServiceGrpc.getPatchResourceMethod) == null) { + GatewayServiceGrpc.getPatchResourceMethod = + getPatchResourceMethod = + io.grpc.MethodDescriptor + .newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "PatchResource")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.HttpBody.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.HttpBody.getDefaultInstance())) + .setSchemaDescriptor( + new GatewayServiceMethodDescriptorSupplier("PatchResource")) + .build(); + } + } + } + return getPatchResourceMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static GatewayServiceStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public GatewayServiceStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new GatewayServiceStub(channel, callOptions); + } + }; + return GatewayServiceStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static GatewayServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public GatewayServiceBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new GatewayServiceBlockingStub(channel, callOptions); + } + }; + return GatewayServiceBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static GatewayServiceFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public GatewayServiceFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new GatewayServiceFutureStub(channel, callOptions); + } + }; + return GatewayServiceFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Gateway service is a public API which works as a Kubernetes resource model
+   * proxy between end users and registered Kubernetes clusters. Each RPC in this
+   * service matches with an HTTP verb. End user will initiate kubectl commands
+   * against the Gateway service, and Gateway service will forward user requests
+   * to clusters.
+   * 
+ */ + public abstract static class GatewayServiceImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * GetResource performs an HTTP GET request on the Kubernetes API Server.
+     * 
+ */ + public void getResource( + com.google.api.HttpBody request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetResourceMethod(), responseObserver); + } + + /** + * + * + *
+     * PostResource performs an HTTP POST on the Kubernetes API Server.
+     * 
+ */ + public void postResource( + com.google.api.HttpBody request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getPostResourceMethod(), responseObserver); + } + + /** + * + * + *
+     * DeleteResource performs an HTTP DELETE on the Kubernetes API Server.
+     * 
+ */ + public void deleteResource( + com.google.api.HttpBody request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeleteResourceMethod(), responseObserver); + } + + /** + * + * + *
+     * PutResource performs an HTTP PUT on the Kubernetes API Server.
+     * 
+ */ + public void putResource( + com.google.api.HttpBody request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getPutResourceMethod(), responseObserver); + } + + /** + * + * + *
+     * PatchResource performs an HTTP PATCH on the Kubernetes API Server.
+     * 
+ */ + public void patchResource( + com.google.api.HttpBody request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getPatchResourceMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getGetResourceMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers( + this, METHODID_GET_RESOURCE))) + .addMethod( + getPostResourceMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers( + this, METHODID_POST_RESOURCE))) + .addMethod( + getDeleteResourceMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers( + this, METHODID_DELETE_RESOURCE))) + .addMethod( + getPutResourceMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers( + this, METHODID_PUT_RESOURCE))) + .addMethod( + getPatchResourceMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers( + this, METHODID_PATCH_RESOURCE))) + .build(); + } + } + + /** + * + * + *
+   * Gateway service is a public API which works as a Kubernetes resource model
+   * proxy between end users and registered Kubernetes clusters. Each RPC in this
+   * service matches with an HTTP verb. End user will initiate kubectl commands
+   * against the Gateway service, and Gateway service will forward user requests
+   * to clusters.
+   * 
+ */ + public static final class GatewayServiceStub + extends io.grpc.stub.AbstractAsyncStub { + private GatewayServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected GatewayServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new GatewayServiceStub(channel, callOptions); + } + + /** + * + * + *
+     * GetResource performs an HTTP GET request on the Kubernetes API Server.
+     * 
+ */ + public void getResource( + com.google.api.HttpBody request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetResourceMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * PostResource performs an HTTP POST on the Kubernetes API Server.
+     * 
+ */ + public void postResource( + com.google.api.HttpBody request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getPostResourceMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * DeleteResource performs an HTTP DELETE on the Kubernetes API Server.
+     * 
+ */ + public void deleteResource( + com.google.api.HttpBody request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeleteResourceMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * PutResource performs an HTTP PUT on the Kubernetes API Server.
+     * 
+ */ + public void putResource( + com.google.api.HttpBody request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getPutResourceMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * PatchResource performs an HTTP PATCH on the Kubernetes API Server.
+     * 
+ */ + public void patchResource( + com.google.api.HttpBody request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getPatchResourceMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Gateway service is a public API which works as a Kubernetes resource model
+   * proxy between end users and registered Kubernetes clusters. Each RPC in this
+   * service matches with an HTTP verb. End user will initiate kubectl commands
+   * against the Gateway service, and Gateway service will forward user requests
+   * to clusters.
+   * 
+ */ + public static final class GatewayServiceBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private GatewayServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected GatewayServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new GatewayServiceBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * GetResource performs an HTTP GET request on the Kubernetes API Server.
+     * 
+ */ + public com.google.api.HttpBody getResource(com.google.api.HttpBody request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetResourceMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * PostResource performs an HTTP POST on the Kubernetes API Server.
+     * 
+ */ + public com.google.api.HttpBody postResource(com.google.api.HttpBody request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getPostResourceMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * DeleteResource performs an HTTP DELETE on the Kubernetes API Server.
+     * 
+ */ + public com.google.api.HttpBody deleteResource(com.google.api.HttpBody request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteResourceMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * PutResource performs an HTTP PUT on the Kubernetes API Server.
+     * 
+ */ + public com.google.api.HttpBody putResource(com.google.api.HttpBody request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getPutResourceMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * PatchResource performs an HTTP PATCH on the Kubernetes API Server.
+     * 
+ */ + public com.google.api.HttpBody patchResource(com.google.api.HttpBody request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getPatchResourceMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Gateway service is a public API which works as a Kubernetes resource model
+   * proxy between end users and registered Kubernetes clusters. Each RPC in this
+   * service matches with an HTTP verb. End user will initiate kubectl commands
+   * against the Gateway service, and Gateway service will forward user requests
+   * to clusters.
+   * 
+ */ + public static final class GatewayServiceFutureStub + extends io.grpc.stub.AbstractFutureStub { + private GatewayServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected GatewayServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new GatewayServiceFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * GetResource performs an HTTP GET request on the Kubernetes API Server.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getResource( + com.google.api.HttpBody request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetResourceMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * PostResource performs an HTTP POST on the Kubernetes API Server.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture postResource( + com.google.api.HttpBody request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getPostResourceMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * DeleteResource performs an HTTP DELETE on the Kubernetes API Server.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteResource(com.google.api.HttpBody request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeleteResourceMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * PutResource performs an HTTP PUT on the Kubernetes API Server.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture putResource( + com.google.api.HttpBody request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getPutResourceMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * PatchResource performs an HTTP PATCH on the Kubernetes API Server.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + patchResource(com.google.api.HttpBody request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getPatchResourceMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_GET_RESOURCE = 0; + private static final int METHODID_POST_RESOURCE = 1; + private static final int METHODID_DELETE_RESOURCE = 2; + private static final int METHODID_PUT_RESOURCE = 3; + private static final int METHODID_PATCH_RESOURCE = 4; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final GatewayServiceImplBase serviceImpl; + private final int methodId; + + MethodHandlers(GatewayServiceImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_GET_RESOURCE: + serviceImpl.getResource( + (com.google.api.HttpBody) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_POST_RESOURCE: + serviceImpl.postResource( + (com.google.api.HttpBody) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DELETE_RESOURCE: + serviceImpl.deleteResource( + (com.google.api.HttpBody) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_PUT_RESOURCE: + serviceImpl.putResource( + (com.google.api.HttpBody) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_PATCH_RESOURCE: + serviceImpl.patchResource( + (com.google.api.HttpBody) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class GatewayServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + GatewayServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.gkeconnect.gateway.v1beta1.GatewayProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("GatewayService"); + } + } + + private static final class GatewayServiceFileDescriptorSupplier + extends GatewayServiceBaseDescriptorSupplier { + GatewayServiceFileDescriptorSupplier() {} + } + + private static final class GatewayServiceMethodDescriptorSupplier + extends GatewayServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + GatewayServiceMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (GatewayServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new GatewayServiceFileDescriptorSupplier()) + .addMethod(getGetResourceMethod()) + .addMethod(getPostResourceMethod()) + .addMethod(getDeleteResourceMethod()) + .addMethod(getPutResourceMethod()) + .addMethod(getPatchResourceMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/java.header b/java.header new file mode 100644 index 0000000..3a9b503 --- /dev/null +++ b/java.header @@ -0,0 +1,15 @@ +^/\*$ +^ \* Copyright \d\d\d\d,? Google (Inc\.|LLC)( All [rR]ights [rR]eserved\.)?$ +^ \*$ +^ \* 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\.$ +^ \*/$ diff --git a/license-checks.xml b/license-checks.xml new file mode 100644 index 0000000..6597fce --- /dev/null +++ b/license-checks.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/owlbot.py b/owlbot.py new file mode 100644 index 0000000..7724346 --- /dev/null +++ b/owlbot.py @@ -0,0 +1,24 @@ +# Copyright 2021 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. + +import synthtool as s +from synthtool.languages import java + + +for library in s.get_staging_dirs(): + # put any special-case replacements here + s.move(library) + +s.remove_staging_dirs() +java.common_templates() \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..636b630 --- /dev/null +++ b/pom.xml @@ -0,0 +1,179 @@ + + + 4.0.0 + com.google.cloud + google-cloud-gke-connect-gateway-parent + pom + 0.0.1-SNAPSHOT + Google Connect Gateway API Parent + https://github.com/googleapis/java-gke-connect-gateway + + Java idiomatic client for Google Cloud Platform services. + + + + com.google.cloud + google-cloud-shared-config + 0.11.0 + + + + + chingor + Jeff Ching + chingor@google.com + Google + + Developer + + + + + Google LLC + + + scm:git:git@github.com:googleapis/java-gke-connect-gateway.git + scm:git:git@github.com:googleapis/java-gke-connect-gateway.git + https://github.com/googleapis/java-gke-connect-gateway + HEAD + + + https://github.com/googleapis/java-gke-connect-gateway/issues + GitHub Issues + + + + Apache-2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + + + + + UTF-8 + UTF-8 + github + google-cloud-gke-connect-gateway-parent + + + + + + com.google.cloud + google-cloud-gke-connect-gateway + 0.0.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-gke-connect-gateway-v1beta1 + 0.0.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-gke-connect-gateway-v1beta1 + 0.0.1-SNAPSHOT + + + + com.google.cloud + google-cloud-shared-dependencies + 0.20.1 + pom + import + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + org.objenesis:objenesis + javax.annotation:javax.annotation-api + + + + + + + + + google-cloud-gke-connect-gateway + grpc-google-cloud-gke-connect-gateway-v1beta1 + proto-google-cloud-gke-connect-gateway-v1beta1 + google-cloud-gke-connect-gateway-bom + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.1.1 + + + + index + dependency-info + team + ci-management + issue-management + licenses + scm + dependency-management + distribution-management + summary + modules + + + + + true + ${site.installationModule} + jar + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + + html + + aggregate + javadoc + + + + + none + protected + true + ${project.build.directory}/javadoc + + + Test helpers packages + com.google.cloud.testing + + + SPI packages + com.google.cloud.spi* + + + + + https://grpc.io/grpc-java/javadoc/ + https://developers.google.com/protocol-buffers/docs/reference/java/ + https://googleapis.dev/java/google-auth-library/latest/ + https://googleapis.dev/java/gax/latest/ + https://googleapis.github.io/api-common-java/${google.api-common.version}/apidocs/ + + + + + + \ No newline at end of file diff --git a/proto-google-cloud-gke-connect-gateway-v1beta1/clirr-ignored-differences.xml b/proto-google-cloud-gke-connect-gateway-v1beta1/clirr-ignored-differences.xml new file mode 100644 index 0000000..70e35c1 --- /dev/null +++ b/proto-google-cloud-gke-connect-gateway-v1beta1/clirr-ignored-differences.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/proto-google-cloud-gke-connect-gateway-v1beta1/pom.xml b/proto-google-cloud-gke-connect-gateway-v1beta1/pom.xml new file mode 100644 index 0000000..0be1bd6 --- /dev/null +++ b/proto-google-cloud-gke-connect-gateway-v1beta1/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-gke-connect-gateway-v1beta1 + 0.0.1-SNAPSHOT + proto-google-cloud-gke-connect-gateway-v1beta1 + Proto library for google-cloud-gke-connect-gateway + + com.google.cloud + google-cloud-gke-connect-gateway-parent + 0.0.1-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-iam-v1 + + + com.google.api + api-common + + + com.google.guava + guava + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + diff --git a/proto-google-cloud-gke-connect-gateway-v1beta1/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayProto.java b/proto-google-cloud-gke-connect-gateway-v1beta1/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayProto.java new file mode 100644 index 0000000..1c2506a --- /dev/null +++ b/proto-google-cloud-gke-connect-gateway-v1beta1/src/main/java/com/google/cloud/gkeconnect/gateway/v1beta1/GatewayProto.java @@ -0,0 +1,85 @@ +/* + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/gkeconnect/gateway/v1beta1/gateway.proto + +package com.google.cloud.gkeconnect.gateway.v1beta1; + +public final class GatewayProto { + private GatewayProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n5google/cloud/gkeconnect/gateway/v1beta" + + "1/gateway.proto\022\'google.cloud.gkeconnect" + + ".gateway.v1beta1\032\034google/api/annotations" + + ".proto\032\027google/api/client.proto\032\031google/" + + "api/httpbody.proto2\371\003\n\016GatewayService\022N\n" + + "\013GetResource\022\024.google.api.HttpBody\032\024.goo" + + "gle.api.HttpBody\"\023\202\323\344\223\002\r\022\013/v1beta1/**\022O\n" + + "\014PostResource\022\024.google.api.HttpBody\032\024.go" + + "ogle.api.HttpBody\"\023\202\323\344\223\002\r\"\013/v1beta1/**\022Q" + + "\n\016DeleteResource\022\024.google.api.HttpBody\032\024" + + ".google.api.HttpBody\"\023\202\323\344\223\002\r*\013/v1beta1/*" + + "*\022N\n\013PutResource\022\024.google.api.HttpBody\032\024" + + ".google.api.HttpBody\"\023\202\323\344\223\002\r\032\013/v1beta1/*" + + "*\022P\n\rPatchResource\022\024.google.api.HttpBody" + + "\032\024.google.api.HttpBody\"\023\202\323\344\223\002\r2\013/v1beta1" + + "/**\032Q\312A\035connectgateway.googleapis.com\322A." + + "https://www.googleapis.com/auth/cloud-pl" + + "atformB\217\002\n+com.google.cloud.gkeconnect.g" + + "ateway.v1beta1B\014GatewayProtoP\001ZNgoogle.g" + + "olang.org/genproto/googleapis/cloud/gkec" + + "onnect/gateway/v1beta1;gateway\252\002\'Google." + + "Cloud.GkeConnect.Gateway.V1Beta1\312\002\'Googl" + + "e\\Cloud\\GkeConnect\\Gateway\\V1beta1\352\002+Goo" + + "gle::Cloud::GkeConnect::Gateway::V1beta1" + + "b\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.HttpBodyProto.getDescriptor(), + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.oauthScopes); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.HttpBodyProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-cloud-gke-connect-gateway-v1beta1/src/main/proto/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto b/proto-google-cloud-gke-connect-gateway-v1beta1/src/main/proto/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto new file mode 100644 index 0000000..6e13893 --- /dev/null +++ b/proto-google-cloud-gke-connect-gateway-v1beta1/src/main/proto/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto @@ -0,0 +1,75 @@ +// Copyright 2021 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. + +syntax = "proto3"; + +package google.cloud.gkeconnect.gateway.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/httpbody.proto"; + +option csharp_namespace = "Google.Cloud.GkeConnect.Gateway.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/gkeconnect/gateway/v1beta1;gateway"; +option java_multiple_files = true; +option java_outer_classname = "GatewayProto"; +option java_package = "com.google.cloud.gkeconnect.gateway.v1beta1"; +option php_namespace = "Google\\Cloud\\GkeConnect\\Gateway\\V1beta1"; +option ruby_package = "Google::Cloud::GkeConnect::Gateway::V1beta1"; + +// Gateway service is a public API which works as a Kubernetes resource model +// proxy between end users and registered Kubernetes clusters. Each RPC in this +// service matches with an HTTP verb. End user will initiate kubectl commands +// against the Gateway service, and Gateway service will forward user requests +// to clusters. +service GatewayService { + option (google.api.default_host) = "connectgateway.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // GetResource performs an HTTP GET request on the Kubernetes API Server. + rpc GetResource(google.api.HttpBody) returns (google.api.HttpBody) { + option (google.api.http) = { + get: "/v1beta1/**" + }; + } + + // PostResource performs an HTTP POST on the Kubernetes API Server. + rpc PostResource(google.api.HttpBody) returns (google.api.HttpBody) { + option (google.api.http) = { + post: "/v1beta1/**" + }; + } + + // DeleteResource performs an HTTP DELETE on the Kubernetes API Server. + rpc DeleteResource(google.api.HttpBody) returns (google.api.HttpBody) { + option (google.api.http) = { + delete: "/v1beta1/**" + }; + } + + // PutResource performs an HTTP PUT on the Kubernetes API Server. + rpc PutResource(google.api.HttpBody) returns (google.api.HttpBody) { + option (google.api.http) = { + put: "/v1beta1/**" + }; + } + + // PatchResource performs an HTTP PATCH on the Kubernetes API Server. + rpc PatchResource(google.api.HttpBody) returns (google.api.HttpBody) { + option (google.api.http) = { + patch: "/v1beta1/**" + }; + } +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..539022d --- /dev/null +++ b/renovate.json @@ -0,0 +1,73 @@ +{ + "extends": [ + ":separateMajorReleases", + ":combinePatchMinorReleases", + ":ignoreUnstable", + ":prImmediately", + ":updateNotScheduled", + ":automergeDisabled", + ":ignoreModulesAndTests", + ":maintainLockFilesDisabled", + ":autodetectPinVersions" + ], + "packageRules": [ + { + "packagePatterns": [ + "^com.google.guava:" + ], + "versionScheme": "docker" + }, + { + "packagePatterns": [ + "*" + ], + "semanticCommitType": "deps", + "semanticCommitScope": null + }, + { + "packagePatterns": [ + "^org.apache.maven", + "^org.jacoco:", + "^org.codehaus.mojo:", + "^org.sonatype.plugins:", + "^com.coveo:", + "^com.google.cloud:google-cloud-shared-config" + ], + "semanticCommitType": "build", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^com.google.cloud:google-cloud-gke-connect-gateway", + "^com.google.cloud:libraries-bom", + "^com.google.cloud.samples:shared-configuration" + ], + "semanticCommitType": "chore", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^junit:junit", + "^com.google.truth:truth", + "^org.mockito:mockito-core", + "^org.objenesis:objenesis" + ], + "semanticCommitType": "test", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^com.google.cloud:google-cloud-" + ], + "ignoreUnstable": false + }, + { + "packagePatterns": [ + "^com.fasterxml.jackson.core" + ], + "groupName": "jackson dependencies" + } + ], + "semanticCommits": true, + "masterIssue": true +} diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml new file mode 100644 index 0000000..ad827f7 --- /dev/null +++ b/samples/install-without-bom/pom.xml @@ -0,0 +1,84 @@ + + + 4.0.0 + com.google.cloud + gke-connect-gateway-install-without-bom + jar + Google Connect Gateway API Install Without Bom + https://github.com/googleapis/java-gke-connect-gateway + + + + com.google.cloud.samples + shared-configuration + 1.0.12 + + + + 1.8 + 1.8 + UTF-8 + + + + + + + com.google.cloud + google-cloud-gke-connect-gateway + 0.0.0 + + + + + junit + junit + 4.13 + test + + + com.google.truth + truth + 1.0.1 + test + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.1.0 + + + add-snippets-source + + add-source + + + + ../snippets/src/main/java + + + + + add-snippets-tests + + add-test-source + + + + ../snippets/src/test/java + + + + + + + + diff --git a/samples/pom.xml b/samples/pom.xml new file mode 100644 index 0000000..53cd335 --- /dev/null +++ b/samples/pom.xml @@ -0,0 +1,56 @@ + + + 4.0.0 + com.google.cloud + google-cloud-gke-connect-gateway-samples + 0.0.1-SNAPSHOT + pom + Google Connect Gateway API Samples Parent + https://github.com/googleapis/java-gke-connect-gateway + + Java idiomatic client for Google Cloud Platform services. + + + + + com.google.cloud.samples + shared-configuration + 1.0.18 + + + + 1.8 + 1.8 + UTF-8 + + + + install-without-bom + snapshot + snippets + + + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 + + true + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + + true + + + + + diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml new file mode 100644 index 0000000..b180602 --- /dev/null +++ b/samples/snapshot/pom.xml @@ -0,0 +1,83 @@ + + + 4.0.0 + com.google.cloud + gke-connect-gateway-snapshot + jar + Google Connect Gateway API Snapshot Samples + https://github.com/googleapis/java-gke-connect-gateway + + + + com.google.cloud.samples + shared-configuration + 1.0.12 + + + + 1.8 + 1.8 + UTF-8 + + + + + + com.google.cloud + google-cloud-gke-connect-gateway + 0.0.0 + + + + + junit + junit + 4.13 + test + + + com.google.truth + truth + 1.0.1 + test + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.1.0 + + + add-snippets-source + + add-source + + + + ../snippets/src/main/java + + + + + add-snippets-tests + + add-test-source + + + + ../snippets/src/test/java + + + + + + + + \ No newline at end of file diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml new file mode 100644 index 0000000..5ce1009 --- /dev/null +++ b/samples/snippets/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + com.google.cloud + gke-connect-gateway-snippets + jar + Google Connect Gateway API Snippets + https://github.com/googleapis/java-gke-connect-gateway + + + + com.google.cloud.samples + shared-configuration + 1.0.12 + + + + 1.8 + 1.8 + UTF-8 + + + + + + com.google.cloud + google-cloud-gke-connect-gateway + 0.0.0 + + + + junit + junit + 4.13 + test + + + com.google.truth + truth + 1.0.1 + test + + + diff --git a/versions.txt b/versions.txt new file mode 100644 index 0000000..f88f8ed --- /dev/null +++ b/versions.txt @@ -0,0 +1,6 @@ +# Format: +# module:released-version:current-version + +google-cloud-gke-connect-gateway:0.0.0:0.0.1-SNAPSHOT +grpc-google-cloud-gke-connect-gateway-v1beta1:0.0.0:0.0.1-SNAPSHOT +proto-google-cloud-gke-connect-gateway-v1beta1:0.0.0:0.0.1-SNAPSHOT