From e7bd1ffe7f1a9cc078d62ddbe079608d605f5c8d Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 20 Aug 2021 23:14:29 +0000 Subject: [PATCH 1/2] feat: turns on self-signed JWT feature flag PiperOrigin-RevId: 392067151 Source-Link: https://github.com/googleapis/googleapis/commit/06345f7b95c4b4a3ffe4303f1f2984ccc304b2e0 Source-Link: https://github.com/googleapis/googleapis-gen/commit/95882b37970e41e4cd51b22fa507cfd46dc7c4b6 --- owl-bot-staging/v1beta1/.eslintignore | 6 + owl-bot-staging/v1beta1/.eslintrc.json | 3 + owl-bot-staging/v1beta1/.gitignore | 14 + owl-bot-staging/v1beta1/.jsdoc.js | 55 ++ owl-bot-staging/v1beta1/.mocharc.js | 33 + owl-bot-staging/v1beta1/.prettierrc.js | 22 + owl-bot-staging/v1beta1/README.md | 1 + .../v1beta1/linkinator.config.json | 10 + owl-bot-staging/v1beta1/package.json | 64 ++ .../gkeconnect/gateway/v1beta1/gateway.proto | 75 ++ owl-bot-staging/v1beta1/src/index.ts | 25 + .../v1beta1/src/v1beta1/gapic_metadata.json | 73 ++ .../src/v1beta1/gateway_service_client.ts | 643 ++++++++++++++++++ .../gateway_service_client_config.json | 46 ++ .../v1beta1/gateway_service_proto_list.json | 3 + owl-bot-staging/v1beta1/src/v1beta1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1beta1/system-test/install.ts | 49 ++ .../test/gapic_gateway_service_v1beta1.ts | 420 ++++++++++++ owl-bot-staging/v1beta1/tsconfig.json | 19 + owl-bot-staging/v1beta1/webpack.config.js | 64 ++ 22 files changed, 1703 insertions(+) create mode 100644 owl-bot-staging/v1beta1/.eslintignore create mode 100644 owl-bot-staging/v1beta1/.eslintrc.json create mode 100644 owl-bot-staging/v1beta1/.gitignore create mode 100644 owl-bot-staging/v1beta1/.jsdoc.js create mode 100644 owl-bot-staging/v1beta1/.mocharc.js create mode 100644 owl-bot-staging/v1beta1/.prettierrc.js create mode 100644 owl-bot-staging/v1beta1/README.md create mode 100644 owl-bot-staging/v1beta1/linkinator.config.json create mode 100644 owl-bot-staging/v1beta1/package.json create mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto create mode 100644 owl-bot-staging/v1beta1/src/index.ts create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/gateway_service_client.ts create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/gateway_service_client_config.json create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/gateway_service_proto_list.json create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/index.ts create mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1beta1/system-test/install.ts create mode 100644 owl-bot-staging/v1beta1/test/gapic_gateway_service_v1beta1.ts create mode 100644 owl-bot-staging/v1beta1/tsconfig.json create mode 100644 owl-bot-staging/v1beta1/webpack.config.js diff --git a/owl-bot-staging/v1beta1/.eslintignore b/owl-bot-staging/v1beta1/.eslintignore new file mode 100644 index 0000000..521dc25 --- /dev/null +++ b/owl-bot-staging/v1beta1/.eslintignore @@ -0,0 +1,6 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ diff --git a/owl-bot-staging/v1beta1/.eslintrc.json b/owl-bot-staging/v1beta1/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1beta1/.gitignore b/owl-bot-staging/v1beta1/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/v1beta1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/v1beta1/.jsdoc.js b/owl-bot-staging/v1beta1/.jsdoc.js new file mode 100644 index 0000000..0e7e239 --- /dev/null +++ b/owl-bot-staging/v1beta1/.jsdoc.js @@ -0,0 +1,55 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2021 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/gke-connect-gateway', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1beta1/.mocharc.js b/owl-bot-staging/v1beta1/.mocharc.js new file mode 100644 index 0000000..50bc7f7 --- /dev/null +++ b/owl-bot-staging/v1beta1/.mocharc.js @@ -0,0 +1,33 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1beta1/.prettierrc.js b/owl-bot-staging/v1beta1/.prettierrc.js new file mode 100644 index 0000000..84f4713 --- /dev/null +++ b/owl-bot-staging/v1beta1/.prettierrc.js @@ -0,0 +1,22 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1beta1/README.md b/owl-bot-staging/v1beta1/README.md new file mode 100644 index 0000000..796832a --- /dev/null +++ b/owl-bot-staging/v1beta1/README.md @@ -0,0 +1 @@ +Gateway: Nodejs Client diff --git a/owl-bot-staging/v1beta1/linkinator.config.json b/owl-bot-staging/v1beta1/linkinator.config.json new file mode 100644 index 0000000..29a223b --- /dev/null +++ b/owl-bot-staging/v1beta1/linkinator.config.json @@ -0,0 +1,10 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 10 +} diff --git a/owl-bot-staging/v1beta1/package.json b/owl-bot-staging/v1beta1/package.json new file mode 100644 index 0000000..e339539 --- /dev/null +++ b/owl-bot-staging/v1beta1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/gke-connect-gateway", + "version": "0.1.0", + "description": "Gateway client for Node.js", + "repository": "googleapis/nodejs-gateway", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google gateway", + "gateway", + "gateway service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^2.19.0" + }, + "devDependencies": { + "@types/mocha": "^9.0.0", + "@types/node": "^14.17.3", + "@types/sinon": "^10.0.2", + "c8": "^7.7.3", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.0", + "jsdoc-region-tag": "^1.1.0", + "linkinator": "^2.13.6", + "mocha": "^9.0.2", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^11.1.1", + "ts-loader": "^9.2.3", + "typescript": "^4.3.4", + "webpack": "^5.39.1", + "webpack-cli": "^4.7.2" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto b/owl-bot-staging/v1beta1/protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto new file mode 100644 index 0000000..6e13893 --- /dev/null +++ b/owl-bot-staging/v1beta1/protos/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/owl-bot-staging/v1beta1/src/index.ts b/owl-bot-staging/v1beta1/src/index.ts new file mode 100644 index 0000000..18d5dc4 --- /dev/null +++ b/owl-bot-staging/v1beta1/src/index.ts @@ -0,0 +1,25 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1beta1 from './v1beta1'; +const GatewayServiceClient = v1beta1.GatewayServiceClient; +type GatewayServiceClient = v1beta1.GatewayServiceClient; +export {v1beta1, GatewayServiceClient}; +export default {v1beta1, GatewayServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json new file mode 100644 index 0000000..5c3d967 --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json @@ -0,0 +1,73 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.gkeconnect.gateway.v1beta1", + "libraryPackage": "@google-cloud/gke-connect-gateway", + "services": { + "GatewayService": { + "clients": { + "grpc": { + "libraryClient": "GatewayServiceClient", + "rpcs": { + "GetResource": { + "methods": [ + "getResource" + ] + }, + "PostResource": { + "methods": [ + "postResource" + ] + }, + "DeleteResource": { + "methods": [ + "deleteResource" + ] + }, + "PutResource": { + "methods": [ + "putResource" + ] + }, + "PatchResource": { + "methods": [ + "patchResource" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "GatewayServiceClient", + "rpcs": { + "GetResource": { + "methods": [ + "getResource" + ] + }, + "PostResource": { + "methods": [ + "postResource" + ] + }, + "DeleteResource": { + "methods": [ + "deleteResource" + ] + }, + "PutResource": { + "methods": [ + "putResource" + ] + }, + "PatchResource": { + "methods": [ + "patchResource" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/gateway_service_client.ts b/owl-bot-staging/v1beta1/src/v1beta1/gateway_service_client.ts new file mode 100644 index 0000000..f40ac3f --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/gateway_service_client.ts @@ -0,0 +1,643 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta1/gateway_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './gateway_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * 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. + * @class + * @memberof v1beta1 + */ +export class GatewayServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + gatewayServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of GatewayServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof GatewayServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.gkeconnect.gateway.v1beta1.GatewayService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.gatewayServiceStub) { + return this.gatewayServiceStub; + } + + // Put together the "service stub" for + // google.cloud.gkeconnect.gateway.v1beta1.GatewayService. + this.gatewayServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.gkeconnect.gateway.v1beta1.GatewayService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.gkeconnect.gateway.v1beta1.GatewayService, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const gatewayServiceStubMethods = + ['getResource', 'postResource', 'deleteResource', 'putResource', 'patchResource']; + for (const methodName of gatewayServiceStubMethods) { + const callPromise = this.gatewayServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.gatewayServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'connectgateway.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'connectgateway.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getResource( + request?: protos.google.api.IHttpBody, + options?: CallOptions): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|undefined, {}|undefined + ]>; + getResource( + request: protos.google.api.IHttpBody, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; + getResource( + request: protos.google.api.IHttpBody, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; +/** + * GetResource performs an HTTP GET request on the Kubernetes API Server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.contentType + * The HTTP Content-Type header value specifying the content type of the body. + * @param {Buffer} request.data + * The HTTP request/response body as raw binary. + * @param {number[]} request.extensions + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getResource(request); + */ + getResource( + request?: protos.google.api.IHttpBody, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + this.initialize(); + return this.innerApiCalls.getResource(request, options, callback); + } + postResource( + request?: protos.google.api.IHttpBody, + options?: CallOptions): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|undefined, {}|undefined + ]>; + postResource( + request: protos.google.api.IHttpBody, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; + postResource( + request: protos.google.api.IHttpBody, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; +/** + * PostResource performs an HTTP POST on the Kubernetes API Server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.contentType + * The HTTP Content-Type header value specifying the content type of the body. + * @param {Buffer} request.data + * The HTTP request/response body as raw binary. + * @param {number[]} request.extensions + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.postResource(request); + */ + postResource( + request?: protos.google.api.IHttpBody, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + this.initialize(); + return this.innerApiCalls.postResource(request, options, callback); + } + deleteResource( + request?: protos.google.api.IHttpBody, + options?: CallOptions): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|undefined, {}|undefined + ]>; + deleteResource( + request: protos.google.api.IHttpBody, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; + deleteResource( + request: protos.google.api.IHttpBody, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; +/** + * DeleteResource performs an HTTP DELETE on the Kubernetes API Server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.contentType + * The HTTP Content-Type header value specifying the content type of the body. + * @param {Buffer} request.data + * The HTTP request/response body as raw binary. + * @param {number[]} request.extensions + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteResource(request); + */ + deleteResource( + request?: protos.google.api.IHttpBody, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + this.initialize(); + return this.innerApiCalls.deleteResource(request, options, callback); + } + putResource( + request?: protos.google.api.IHttpBody, + options?: CallOptions): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|undefined, {}|undefined + ]>; + putResource( + request: protos.google.api.IHttpBody, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; + putResource( + request: protos.google.api.IHttpBody, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; +/** + * PutResource performs an HTTP PUT on the Kubernetes API Server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.contentType + * The HTTP Content-Type header value specifying the content type of the body. + * @param {Buffer} request.data + * The HTTP request/response body as raw binary. + * @param {number[]} request.extensions + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.putResource(request); + */ + putResource( + request?: protos.google.api.IHttpBody, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + this.initialize(); + return this.innerApiCalls.putResource(request, options, callback); + } + patchResource( + request?: protos.google.api.IHttpBody, + options?: CallOptions): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|undefined, {}|undefined + ]>; + patchResource( + request: protos.google.api.IHttpBody, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; + patchResource( + request: protos.google.api.IHttpBody, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): void; +/** + * PatchResource performs an HTTP PATCH on the Kubernetes API Server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.contentType + * The HTTP Content-Type header value specifying the content type of the body. + * @param {Buffer} request.data + * The HTTP request/response body as raw binary. + * @param {number[]} request.extensions + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.patchResource(request); + */ + patchResource( + request?: protos.google.api.IHttpBody, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.IHttpBody, + protos.google.api.IHttpBody|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + this.initialize(); + return this.innerApiCalls.patchResource(request, options, callback); + } + + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.gatewayServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/gateway_service_client_config.json b/owl-bot-staging/v1beta1/src/v1beta1/gateway_service_client_config.json new file mode 100644 index 0000000..d733656 --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/gateway_service_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.gkeconnect.gateway.v1beta1.GatewayService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "GetResource": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PostResource": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteResource": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PutResource": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PatchResource": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/gateway_service_proto_list.json b/owl-bot-staging/v1beta1/src/v1beta1/gateway_service_proto_list.json new file mode 100644 index 0000000..634a5e1 --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/gateway_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto" +] diff --git a/owl-bot-staging/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/v1beta1/src/v1beta1/index.ts new file mode 100644 index 0000000..62d52d4 --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/index.ts @@ -0,0 +1,19 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {GatewayServiceClient} from './gateway_service_client'; diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..f702c53 --- /dev/null +++ b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const gateway = require('@google-cloud/gke-connect-gateway'); + +function main() { + const gatewayServiceClient = new gateway.GatewayServiceClient(); +} + +main(); diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..817c03b --- /dev/null +++ b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {GatewayServiceClient} from '@google-cloud/gke-connect-gateway'; + +// check that the client class type name can be used +function doStuffWithGatewayServiceClient(client: GatewayServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const gatewayServiceClient = new GatewayServiceClient(); + doStuffWithGatewayServiceClient(gatewayServiceClient); +} + +main(); diff --git a/owl-bot-staging/v1beta1/system-test/install.ts b/owl-bot-staging/v1beta1/system-test/install.ts new file mode 100644 index 0000000..1f850b5 --- /dev/null +++ b/owl-bot-staging/v1beta1/system-test/install.ts @@ -0,0 +1,49 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1beta1/test/gapic_gateway_service_v1beta1.ts b/owl-bot-staging/v1beta1/test/gapic_gateway_service_v1beta1.ts new file mode 100644 index 0000000..6d551a0 --- /dev/null +++ b/owl-bot-staging/v1beta1/test/gapic_gateway_service_v1beta1.ts @@ -0,0 +1,420 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as gatewayserviceModule from '../src'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +describe('v1beta1.GatewayServiceClient', () => { + it('has servicePath', () => { + const servicePath = gatewayserviceModule.v1beta1.GatewayServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = gatewayserviceModule.v1beta1.GatewayServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = gatewayserviceModule.v1beta1.GatewayServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.gatewayServiceStub, undefined); + await client.initialize(); + assert(client.gatewayServiceStub); + }); + + it('has close method', () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getResource', () => { + it('invokes getResource without error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.HttpBody()); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); + client.innerApiCalls.getResource = stubSimpleCall(expectedResponse); + const [response] = await client.getResource(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getResource without error using callback', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.HttpBody()); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); + client.innerApiCalls.getResource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getResource( + request, + (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getResource with error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.HttpBody()); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.getResource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getResource(request), expectedError); + assert((client.innerApiCalls.getResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('postResource', () => { + it('invokes postResource without error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.HttpBody()); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); + client.innerApiCalls.postResource = stubSimpleCall(expectedResponse); + const [response] = await client.postResource(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.postResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes postResource without error using callback', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.HttpBody()); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); + client.innerApiCalls.postResource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.postResource( + request, + (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.postResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes postResource with error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.HttpBody()); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.postResource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.postResource(request), expectedError); + assert((client.innerApiCalls.postResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteResource', () => { + it('invokes deleteResource without error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.HttpBody()); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); + client.innerApiCalls.deleteResource = stubSimpleCall(expectedResponse); + const [response] = await client.deleteResource(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteResource without error using callback', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.HttpBody()); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); + client.innerApiCalls.deleteResource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteResource( + request, + (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteResource with error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.HttpBody()); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteResource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteResource(request), expectedError); + assert((client.innerApiCalls.deleteResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('putResource', () => { + it('invokes putResource without error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.HttpBody()); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); + client.innerApiCalls.putResource = stubSimpleCall(expectedResponse); + const [response] = await client.putResource(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.putResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes putResource without error using callback', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.HttpBody()); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); + client.innerApiCalls.putResource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.putResource( + request, + (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.putResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes putResource with error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.HttpBody()); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.putResource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.putResource(request), expectedError); + assert((client.innerApiCalls.putResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('patchResource', () => { + it('invokes patchResource without error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.HttpBody()); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); + client.innerApiCalls.patchResource = stubSimpleCall(expectedResponse); + const [response] = await client.patchResource(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.patchResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes patchResource without error using callback', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.HttpBody()); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); + client.innerApiCalls.patchResource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.patchResource( + request, + (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.patchResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes patchResource with error', async () => { + const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.api.HttpBody()); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.patchResource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.patchResource(request), expectedError); + assert((client.innerApiCalls.patchResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); +}); diff --git a/owl-bot-staging/v1beta1/tsconfig.json b/owl-bot-staging/v1beta1/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/v1beta1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v1beta1/webpack.config.js b/owl-bot-staging/v1beta1/webpack.config.js new file mode 100644 index 0000000..3292111 --- /dev/null +++ b/owl-bot-staging/v1beta1/webpack.config.js @@ -0,0 +1,64 @@ +// 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. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'GatewayService', + filename: './gateway-service.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; From edca29952ec34a59ca7a9ba466de9a408fa69b6e Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 20 Aug 2021 23:15:35 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- owl-bot-staging/v1beta1/.eslintignore | 6 - owl-bot-staging/v1beta1/.eslintrc.json | 3 - owl-bot-staging/v1beta1/.gitignore | 14 - owl-bot-staging/v1beta1/.jsdoc.js | 55 -- owl-bot-staging/v1beta1/.mocharc.js | 33 - owl-bot-staging/v1beta1/.prettierrc.js | 22 - owl-bot-staging/v1beta1/README.md | 1 - .../v1beta1/linkinator.config.json | 10 - owl-bot-staging/v1beta1/package.json | 64 -- .../gkeconnect/gateway/v1beta1/gateway.proto | 75 -- owl-bot-staging/v1beta1/src/index.ts | 25 - .../v1beta1/src/v1beta1/gapic_metadata.json | 73 -- .../src/v1beta1/gateway_service_client.ts | 643 ------------------ .../gateway_service_client_config.json | 46 -- .../v1beta1/gateway_service_proto_list.json | 3 - owl-bot-staging/v1beta1/src/v1beta1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1beta1/system-test/install.ts | 49 -- .../test/gapic_gateway_service_v1beta1.ts | 420 ------------ owl-bot-staging/v1beta1/tsconfig.json | 19 - owl-bot-staging/v1beta1/webpack.config.js | 64 -- src/v1beta1/gateway_service_client.ts | 6 + 23 files changed, 6 insertions(+), 1703 deletions(-) delete mode 100644 owl-bot-staging/v1beta1/.eslintignore delete mode 100644 owl-bot-staging/v1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/v1beta1/.gitignore delete mode 100644 owl-bot-staging/v1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/v1beta1/.mocharc.js delete mode 100644 owl-bot-staging/v1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/v1beta1/README.md delete mode 100644 owl-bot-staging/v1beta1/linkinator.config.json delete mode 100644 owl-bot-staging/v1beta1/package.json delete mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto delete mode 100644 owl-bot-staging/v1beta1/src/index.ts delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/gateway_service_client.ts delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/gateway_service_client_config.json delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/gateway_service_proto_list.json delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/index.ts delete mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/v1beta1/test/gapic_gateway_service_v1beta1.ts delete mode 100644 owl-bot-staging/v1beta1/tsconfig.json delete mode 100644 owl-bot-staging/v1beta1/webpack.config.js diff --git a/owl-bot-staging/v1beta1/.eslintignore b/owl-bot-staging/v1beta1/.eslintignore deleted file mode 100644 index 521dc25..0000000 --- a/owl-bot-staging/v1beta1/.eslintignore +++ /dev/null @@ -1,6 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ diff --git a/owl-bot-staging/v1beta1/.eslintrc.json b/owl-bot-staging/v1beta1/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1beta1/.gitignore b/owl-bot-staging/v1beta1/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/v1beta1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/v1beta1/.jsdoc.js b/owl-bot-staging/v1beta1/.jsdoc.js deleted file mode 100644 index 0e7e239..0000000 --- a/owl-bot-staging/v1beta1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// 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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2021 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/gke-connect-gateway', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1beta1/.mocharc.js b/owl-bot-staging/v1beta1/.mocharc.js deleted file mode 100644 index 50bc7f7..0000000 --- a/owl-bot-staging/v1beta1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// 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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1beta1/.prettierrc.js b/owl-bot-staging/v1beta1/.prettierrc.js deleted file mode 100644 index 84f4713..0000000 --- a/owl-bot-staging/v1beta1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// 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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1beta1/README.md b/owl-bot-staging/v1beta1/README.md deleted file mode 100644 index 796832a..0000000 --- a/owl-bot-staging/v1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Gateway: Nodejs Client diff --git a/owl-bot-staging/v1beta1/linkinator.config.json b/owl-bot-staging/v1beta1/linkinator.config.json deleted file mode 100644 index 29a223b..0000000 --- a/owl-bot-staging/v1beta1/linkinator.config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io" - ], - "silent": true, - "concurrency": 10 -} diff --git a/owl-bot-staging/v1beta1/package.json b/owl-bot-staging/v1beta1/package.json deleted file mode 100644 index e339539..0000000 --- a/owl-bot-staging/v1beta1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/gke-connect-gateway", - "version": "0.1.0", - "description": "Gateway client for Node.js", - "repository": "googleapis/nodejs-gateway", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google gateway", - "gateway", - "gateway service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^2.19.0" - }, - "devDependencies": { - "@types/mocha": "^9.0.0", - "@types/node": "^14.17.3", - "@types/sinon": "^10.0.2", - "c8": "^7.7.3", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.0", - "jsdoc-region-tag": "^1.1.0", - "linkinator": "^2.13.6", - "mocha": "^9.0.2", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^11.1.1", - "ts-loader": "^9.2.3", - "typescript": "^4.3.4", - "webpack": "^5.39.1", - "webpack-cli": "^4.7.2" - }, - "engines": { - "node": ">=v10.24.0" - } -} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto b/owl-bot-staging/v1beta1/protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto deleted file mode 100644 index 6e13893..0000000 --- a/owl-bot-staging/v1beta1/protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto +++ /dev/null @@ -1,75 +0,0 @@ -// 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/owl-bot-staging/v1beta1/src/index.ts b/owl-bot-staging/v1beta1/src/index.ts deleted file mode 100644 index 18d5dc4..0000000 --- a/owl-bot-staging/v1beta1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// 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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1beta1 from './v1beta1'; -const GatewayServiceClient = v1beta1.GatewayServiceClient; -type GatewayServiceClient = v1beta1.GatewayServiceClient; -export {v1beta1, GatewayServiceClient}; -export default {v1beta1, GatewayServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json deleted file mode 100644 index 5c3d967..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.gkeconnect.gateway.v1beta1", - "libraryPackage": "@google-cloud/gke-connect-gateway", - "services": { - "GatewayService": { - "clients": { - "grpc": { - "libraryClient": "GatewayServiceClient", - "rpcs": { - "GetResource": { - "methods": [ - "getResource" - ] - }, - "PostResource": { - "methods": [ - "postResource" - ] - }, - "DeleteResource": { - "methods": [ - "deleteResource" - ] - }, - "PutResource": { - "methods": [ - "putResource" - ] - }, - "PatchResource": { - "methods": [ - "patchResource" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "GatewayServiceClient", - "rpcs": { - "GetResource": { - "methods": [ - "getResource" - ] - }, - "PostResource": { - "methods": [ - "postResource" - ] - }, - "DeleteResource": { - "methods": [ - "deleteResource" - ] - }, - "PutResource": { - "methods": [ - "putResource" - ] - }, - "PatchResource": { - "methods": [ - "patchResource" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/gateway_service_client.ts b/owl-bot-staging/v1beta1/src/v1beta1/gateway_service_client.ts deleted file mode 100644 index f40ac3f..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/gateway_service_client.ts +++ /dev/null @@ -1,643 +0,0 @@ -// 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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/gateway_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './gateway_service_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * 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. - * @class - * @memberof v1beta1 - */ -export class GatewayServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - gatewayServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of GatewayServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof GatewayServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.gkeconnect.gateway.v1beta1.GatewayService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.gatewayServiceStub) { - return this.gatewayServiceStub; - } - - // Put together the "service stub" for - // google.cloud.gkeconnect.gateway.v1beta1.GatewayService. - this.gatewayServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.gkeconnect.gateway.v1beta1.GatewayService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.gkeconnect.gateway.v1beta1.GatewayService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const gatewayServiceStubMethods = - ['getResource', 'postResource', 'deleteResource', 'putResource', 'patchResource']; - for (const methodName of gatewayServiceStubMethods) { - const callPromise = this.gatewayServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.gatewayServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'connectgateway.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'connectgateway.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getResource( - request?: protos.google.api.IHttpBody, - options?: CallOptions): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|undefined, {}|undefined - ]>; - getResource( - request: protos.google.api.IHttpBody, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; - getResource( - request: protos.google.api.IHttpBody, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; -/** - * GetResource performs an HTTP GET request on the Kubernetes API Server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.contentType - * The HTTP Content-Type header value specifying the content type of the body. - * @param {Buffer} request.data - * The HTTP request/response body as raw binary. - * @param {number[]} request.extensions - * Application specific response metadata. Must be set in the first response - * for streaming APIs. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getResource(request); - */ - getResource( - request?: protos.google.api.IHttpBody, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - this.initialize(); - return this.innerApiCalls.getResource(request, options, callback); - } - postResource( - request?: protos.google.api.IHttpBody, - options?: CallOptions): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|undefined, {}|undefined - ]>; - postResource( - request: protos.google.api.IHttpBody, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; - postResource( - request: protos.google.api.IHttpBody, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; -/** - * PostResource performs an HTTP POST on the Kubernetes API Server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.contentType - * The HTTP Content-Type header value specifying the content type of the body. - * @param {Buffer} request.data - * The HTTP request/response body as raw binary. - * @param {number[]} request.extensions - * Application specific response metadata. Must be set in the first response - * for streaming APIs. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.postResource(request); - */ - postResource( - request?: protos.google.api.IHttpBody, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - this.initialize(); - return this.innerApiCalls.postResource(request, options, callback); - } - deleteResource( - request?: protos.google.api.IHttpBody, - options?: CallOptions): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|undefined, {}|undefined - ]>; - deleteResource( - request: protos.google.api.IHttpBody, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; - deleteResource( - request: protos.google.api.IHttpBody, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; -/** - * DeleteResource performs an HTTP DELETE on the Kubernetes API Server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.contentType - * The HTTP Content-Type header value specifying the content type of the body. - * @param {Buffer} request.data - * The HTTP request/response body as raw binary. - * @param {number[]} request.extensions - * Application specific response metadata. Must be set in the first response - * for streaming APIs. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteResource(request); - */ - deleteResource( - request?: protos.google.api.IHttpBody, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - this.initialize(); - return this.innerApiCalls.deleteResource(request, options, callback); - } - putResource( - request?: protos.google.api.IHttpBody, - options?: CallOptions): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|undefined, {}|undefined - ]>; - putResource( - request: protos.google.api.IHttpBody, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; - putResource( - request: protos.google.api.IHttpBody, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; -/** - * PutResource performs an HTTP PUT on the Kubernetes API Server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.contentType - * The HTTP Content-Type header value specifying the content type of the body. - * @param {Buffer} request.data - * The HTTP request/response body as raw binary. - * @param {number[]} request.extensions - * Application specific response metadata. Must be set in the first response - * for streaming APIs. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.putResource(request); - */ - putResource( - request?: protos.google.api.IHttpBody, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - this.initialize(); - return this.innerApiCalls.putResource(request, options, callback); - } - patchResource( - request?: protos.google.api.IHttpBody, - options?: CallOptions): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|undefined, {}|undefined - ]>; - patchResource( - request: protos.google.api.IHttpBody, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; - patchResource( - request: protos.google.api.IHttpBody, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): void; -/** - * PatchResource performs an HTTP PATCH on the Kubernetes API Server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.contentType - * The HTTP Content-Type header value specifying the content type of the body. - * @param {Buffer} request.data - * The HTTP request/response body as raw binary. - * @param {number[]} request.extensions - * Application specific response metadata. Must be set in the first response - * for streaming APIs. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.patchResource(request); - */ - patchResource( - request?: protos.google.api.IHttpBody, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IHttpBody, - protos.google.api.IHttpBody|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - this.initialize(); - return this.innerApiCalls.patchResource(request, options, callback); - } - - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.gatewayServiceStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/gateway_service_client_config.json b/owl-bot-staging/v1beta1/src/v1beta1/gateway_service_client_config.json deleted file mode 100644 index d733656..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/gateway_service_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.gkeconnect.gateway.v1beta1.GatewayService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetResource": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PostResource": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteResource": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PutResource": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PatchResource": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/gateway_service_proto_list.json b/owl-bot-staging/v1beta1/src/v1beta1/gateway_service_proto_list.json deleted file mode 100644 index 634a5e1..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/gateway_service_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/gkeconnect/gateway/v1beta1/gateway.proto" -] diff --git a/owl-bot-staging/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/v1beta1/src/v1beta1/index.ts deleted file mode 100644 index 62d52d4..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// 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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {GatewayServiceClient} from './gateway_service_client'; diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index f702c53..0000000 --- a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// 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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const gateway = require('@google-cloud/gke-connect-gateway'); - -function main() { - const gatewayServiceClient = new gateway.GatewayServiceClient(); -} - -main(); diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 817c03b..0000000 --- a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// 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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {GatewayServiceClient} from '@google-cloud/gke-connect-gateway'; - -// check that the client class type name can be used -function doStuffWithGatewayServiceClient(client: GatewayServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const gatewayServiceClient = new GatewayServiceClient(); - doStuffWithGatewayServiceClient(gatewayServiceClient); -} - -main(); diff --git a/owl-bot-staging/v1beta1/system-test/install.ts b/owl-bot-staging/v1beta1/system-test/install.ts deleted file mode 100644 index 1f850b5..0000000 --- a/owl-bot-staging/v1beta1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// 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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1beta1/test/gapic_gateway_service_v1beta1.ts b/owl-bot-staging/v1beta1/test/gapic_gateway_service_v1beta1.ts deleted file mode 100644 index 6d551a0..0000000 --- a/owl-bot-staging/v1beta1/test/gapic_gateway_service_v1beta1.ts +++ /dev/null @@ -1,420 +0,0 @@ -// 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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as gatewayserviceModule from '../src'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1beta1.GatewayServiceClient', () => { - it('has servicePath', () => { - const servicePath = gatewayserviceModule.v1beta1.GatewayServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = gatewayserviceModule.v1beta1.GatewayServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = gatewayserviceModule.v1beta1.GatewayServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.gatewayServiceStub, undefined); - await client.initialize(); - assert(client.gatewayServiceStub); - }); - - it('has close method', () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getResource', () => { - it('invokes getResource without error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.HttpBody()); - const expectedOptions = {}; - const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); - client.innerApiCalls.getResource = stubSimpleCall(expectedResponse); - const [response] = await client.getResource(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getResource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getResource without error using callback', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.HttpBody()); - const expectedOptions = {}; - const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); - client.innerApiCalls.getResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getResource( - request, - (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getResource as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getResource with error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.HttpBody()); - const expectedOptions = {}; - const expectedError = new Error('expected'); - client.innerApiCalls.getResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getResource(request), expectedError); - assert((client.innerApiCalls.getResource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('postResource', () => { - it('invokes postResource without error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.HttpBody()); - const expectedOptions = {}; - const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); - client.innerApiCalls.postResource = stubSimpleCall(expectedResponse); - const [response] = await client.postResource(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.postResource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes postResource without error using callback', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.HttpBody()); - const expectedOptions = {}; - const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); - client.innerApiCalls.postResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.postResource( - request, - (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.postResource as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes postResource with error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.HttpBody()); - const expectedOptions = {}; - const expectedError = new Error('expected'); - client.innerApiCalls.postResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.postResource(request), expectedError); - assert((client.innerApiCalls.postResource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteResource', () => { - it('invokes deleteResource without error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.HttpBody()); - const expectedOptions = {}; - const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); - client.innerApiCalls.deleteResource = stubSimpleCall(expectedResponse); - const [response] = await client.deleteResource(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteResource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteResource without error using callback', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.HttpBody()); - const expectedOptions = {}; - const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); - client.innerApiCalls.deleteResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteResource( - request, - (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteResource as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteResource with error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.HttpBody()); - const expectedOptions = {}; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteResource(request), expectedError); - assert((client.innerApiCalls.deleteResource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('putResource', () => { - it('invokes putResource without error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.HttpBody()); - const expectedOptions = {}; - const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); - client.innerApiCalls.putResource = stubSimpleCall(expectedResponse); - const [response] = await client.putResource(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.putResource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes putResource without error using callback', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.HttpBody()); - const expectedOptions = {}; - const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); - client.innerApiCalls.putResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.putResource( - request, - (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.putResource as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes putResource with error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.HttpBody()); - const expectedOptions = {}; - const expectedError = new Error('expected'); - client.innerApiCalls.putResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.putResource(request), expectedError); - assert((client.innerApiCalls.putResource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('patchResource', () => { - it('invokes patchResource without error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.HttpBody()); - const expectedOptions = {}; - const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); - client.innerApiCalls.patchResource = stubSimpleCall(expectedResponse); - const [response] = await client.patchResource(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.patchResource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes patchResource without error using callback', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.HttpBody()); - const expectedOptions = {}; - const expectedResponse = generateSampleMessage(new protos.google.api.HttpBody()); - client.innerApiCalls.patchResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.patchResource( - request, - (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.patchResource as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes patchResource with error', async () => { - const client = new gatewayserviceModule.v1beta1.GatewayServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.api.HttpBody()); - const expectedOptions = {}; - const expectedError = new Error('expected'); - client.innerApiCalls.patchResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.patchResource(request), expectedError); - assert((client.innerApiCalls.patchResource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); -}); diff --git a/owl-bot-staging/v1beta1/tsconfig.json b/owl-bot-staging/v1beta1/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/v1beta1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v1beta1/webpack.config.js b/owl-bot-staging/v1beta1/webpack.config.js deleted file mode 100644 index 3292111..0000000 --- a/owl-bot-staging/v1beta1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'GatewayService', - filename: './gateway-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/src/v1beta1/gateway_service_client.ts b/src/v1beta1/gateway_service_client.ts index c39cc16..e51f7ac 100644 --- a/src/v1beta1/gateway_service_client.ts +++ b/src/v1beta1/gateway_service_client.ts @@ -125,6 +125,12 @@ export class GatewayServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes;