@google-cloud/clientgateways
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -672,2 +672,6 @@ { | ||
"id": 12 | ||
}, | ||
"edition": { | ||
"type": "string", | ||
"id": 13 | ||
} | ||
@@ -1500,3 +1504,16 @@ } | ||
"id": 4 | ||
}, | ||
"semantic": { | ||
"type": "Semantic", | ||
"id": 5 | ||
} | ||
}, | ||
"nested": { | ||
"Semantic": { | ||
"values": { | ||
"NONE": 0, | ||
"SET": 1, | ||
"ALIAS": 2 | ||
} | ||
} | ||
} | ||
@@ -1503,0 +1520,0 @@ } |
/// <reference types="node" /> | ||
import * as gax from 'google-gax'; | ||
import { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, IamClient, IamProtos, LocationsClient, LocationProtos } from 'google-gax'; | ||
import type * as gax from 'google-gax'; | ||
import type { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, IamClient, IamProtos, LocationsClient, LocationProtos } from 'google-gax'; | ||
import { Transform } from 'stream'; | ||
@@ -76,4 +76,11 @@ import * as protos from '../../protos/protos'; | ||
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. | ||
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you | ||
* need to avoid loading the default gRPC version and want to use the fallback | ||
* HTTP implementation. Load only fallback version and pass it to the constructor: | ||
* ``` | ||
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC | ||
* const client = new ClientGatewaysServiceClient({fallback: 'rest'}, gax); | ||
* ``` | ||
*/ | ||
constructor(opts?: ClientOptions); | ||
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback); | ||
/** | ||
@@ -80,0 +87,0 @@ * Initialize the client. |
@@ -21,5 +21,2 @@ "use strict"; | ||
exports.ClientGatewaysServiceClient = void 0; | ||
/* global window */ | ||
const gax = require("google-gax"); | ||
const google_gax_1 = require("google-gax"); | ||
const jsonProtos = require("../../protos/protos.json"); | ||
@@ -32,3 +29,2 @@ /** | ||
const gapicConfig = require("./client_gateways_service_client_config.json"); | ||
const google_gax_2 = require("google-gax"); | ||
const version = require('../../../package.json').version; | ||
@@ -83,4 +79,11 @@ /** | ||
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. | ||
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you | ||
* need to avoid loading the default gRPC version and want to use the fallback | ||
* HTTP implementation. Load only fallback version and pass it to the constructor: | ||
* ``` | ||
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC | ||
* const client = new ClientGatewaysServiceClient({fallback: 'rest'}, gax); | ||
* ``` | ||
*/ | ||
constructor(opts) { | ||
constructor(opts, gaxInstance) { | ||
var _a, _b; | ||
@@ -107,4 +110,8 @@ this._terminated = false; | ||
} | ||
// Load google-gax module synchronously if needed | ||
if (!gaxInstance) { | ||
gaxInstance = require('google-gax'); | ||
} | ||
// Choose either gRPC or proto-over-HTTP implementation of google-gax. | ||
this._gaxModule = opts.fallback ? gax.fallback : gax; | ||
this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; | ||
// Create a `gaxGrpc` object, with any grpc-specific options sent to the client. | ||
@@ -124,4 +131,4 @@ this._gaxGrpc = new this._gaxModule.GrpcClient(opts); | ||
} | ||
this.iamClient = new google_gax_1.IamClient(this._gaxGrpc, opts); | ||
this.locationsClient = new google_gax_1.LocationsClient(this._gaxGrpc, opts); | ||
this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); | ||
this.locationsClient = new this._gaxModule.LocationsClient(this._gaxGrpc, opts); | ||
// Determine the client header string. | ||
@@ -280,3 +287,3 @@ const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; | ||
// Add a warn function to the client constructor so it can be easily tested. | ||
this.warn = gax.warn; | ||
this.warn = this._gaxModule.warn; | ||
} | ||
@@ -327,3 +334,3 @@ /** | ||
undefined; | ||
const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor); | ||
const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback); | ||
this.innerApiCalls[methodName] = apiCall; | ||
@@ -388,3 +395,3 @@ } | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: request.name || '', | ||
@@ -409,3 +416,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
parent: request.parent || '', | ||
@@ -429,5 +436,5 @@ }); | ||
async checkCreateClientGatewayProgress(name) { | ||
const request = new google_gax_2.operationsProtos.google.longrunning.GetOperationRequest({ name }); | ||
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name }); | ||
const [operation] = await this.operationsClient.getOperation(request); | ||
const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createClientGateway, gax.createDefaultBackoffSettings()); | ||
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createClientGateway, this._gaxModule.createDefaultBackoffSettings()); | ||
return decodeOperation; | ||
@@ -449,3 +456,3 @@ } | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: request.name || '', | ||
@@ -469,5 +476,5 @@ }); | ||
async checkDeleteClientGatewayProgress(name) { | ||
const request = new google_gax_2.operationsProtos.google.longrunning.GetOperationRequest({ name }); | ||
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name }); | ||
const [operation] = await this.operationsClient.getOperation(request); | ||
const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteClientGateway, gax.createDefaultBackoffSettings()); | ||
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteClientGateway, this._gaxModule.createDefaultBackoffSettings()); | ||
return decodeOperation; | ||
@@ -489,3 +496,3 @@ } | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
parent: request.parent || '', | ||
@@ -529,3 +536,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
parent: request.parent || '', | ||
@@ -574,3 +581,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
parent: request.parent || '', | ||
@@ -577,0 +584,0 @@ }); |
# Changelog | ||
## [0.2.0](https://github.com/googleapis/google-cloud-node/compare/clientgateways-v0.1.0...clientgateways-v0.2.0) (2022-08-29) | ||
### Features | ||
* update typescript generator for beyond corp app ([#3309](https://github.com/googleapis/google-cloud-node/issues/3309)) ([380e7b7](https://github.com/googleapis/google-cloud-node/commit/380e7b70316e072f97fef0e050011d52f41262b1)) | ||
## 0.1.0 (2022-08-13) | ||
@@ -4,0 +11,0 @@ |
{ | ||
"name": "@google-cloud/clientgateways", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "BeyondCorp API client for Node.js", | ||
@@ -5,0 +5,0 @@ "repository": "googleapis/google-cloud-node", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1445425
24612
2