@google-cloud/service-management
Advanced tools
Comparing version
/// <reference types="node" /> | ||
import * as gax from 'google-gax'; | ||
import { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback } from 'google-gax'; | ||
import type * as gax from 'google-gax'; | ||
import type { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback } from 'google-gax'; | ||
import { Transform } from 'stream'; | ||
@@ -62,4 +62,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 ServiceManagerClient({fallback: 'rest'}, gax); | ||
* ``` | ||
*/ | ||
constructor(opts?: ClientOptions); | ||
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback); | ||
/** | ||
@@ -66,0 +73,0 @@ * Initialize the client. |
@@ -21,4 +21,2 @@ "use strict"; | ||
exports.ServiceManagerClient = void 0; | ||
/* global window */ | ||
const gax = require("google-gax"); | ||
const jsonProtos = require("../../protos/protos.json"); | ||
@@ -31,3 +29,2 @@ /** | ||
const gapicConfig = require("./service_manager_client_config.json"); | ||
const google_gax_1 = require("google-gax"); | ||
const version = require('../../../package.json').version; | ||
@@ -73,4 +70,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 ServiceManagerClient({fallback: 'rest'}, gax); | ||
* ``` | ||
*/ | ||
constructor(opts) { | ||
constructor(opts, gaxInstance) { | ||
var _a, _b; | ||
@@ -96,4 +100,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. | ||
@@ -217,3 +225,3 @@ this._gaxGrpc = new this._gaxModule.GrpcClient(opts); | ||
// Add a warn function to the client constructor so it can be easily tested. | ||
this.warn = gax.warn; | ||
this.warn = this._gaxModule.warn; | ||
} | ||
@@ -337,3 +345,3 @@ /** | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
service_name: request.serviceName || '', | ||
@@ -358,3 +366,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
service_name: request.serviceName || '', | ||
@@ -380,3 +388,3 @@ config_id: request.configId || '', | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
service_name: request.serviceName || '', | ||
@@ -401,3 +409,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
service_name: request.serviceName || '', | ||
@@ -454,5 +462,5 @@ rollout_id: request.rolloutId || '', | ||
async checkCreateServiceProgress(name) { | ||
const request = new google_gax_1.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.createService, this._gaxModule.createDefaultBackoffSettings()); | ||
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createService, this._gaxModule.createDefaultBackoffSettings()); | ||
return decodeOperation; | ||
@@ -474,3 +482,3 @@ } | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
service_name: request.serviceName || '', | ||
@@ -494,5 +502,5 @@ }); | ||
async checkDeleteServiceProgress(name) { | ||
const request = new google_gax_1.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.deleteService, this._gaxModule.createDefaultBackoffSettings()); | ||
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteService, this._gaxModule.createDefaultBackoffSettings()); | ||
return decodeOperation; | ||
@@ -514,3 +522,3 @@ } | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
service_name: request.serviceName || '', | ||
@@ -534,5 +542,5 @@ }); | ||
async checkUndeleteServiceProgress(name) { | ||
const request = new google_gax_1.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.undeleteService, this._gaxModule.createDefaultBackoffSettings()); | ||
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.undeleteService, this._gaxModule.createDefaultBackoffSettings()); | ||
return decodeOperation; | ||
@@ -554,3 +562,3 @@ } | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
service_name: request.serviceName || '', | ||
@@ -574,5 +582,5 @@ }); | ||
async checkSubmitConfigSourceProgress(name) { | ||
const request = new google_gax_1.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.submitConfigSource, this._gaxModule.createDefaultBackoffSettings()); | ||
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.submitConfigSource, this._gaxModule.createDefaultBackoffSettings()); | ||
return decodeOperation; | ||
@@ -594,3 +602,3 @@ } | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
service_name: request.serviceName || '', | ||
@@ -614,5 +622,5 @@ }); | ||
async checkCreateServiceRolloutProgress(name) { | ||
const request = new google_gax_1.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.createServiceRollout, this._gaxModule.createDefaultBackoffSettings()); | ||
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createServiceRollout, this._gaxModule.createDefaultBackoffSettings()); | ||
return decodeOperation; | ||
@@ -733,3 +741,3 @@ } | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
service_name: request.serviceName || '', | ||
@@ -771,3 +779,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
service_name: request.serviceName || '', | ||
@@ -814,3 +822,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
service_name: request.serviceName || '', | ||
@@ -837,3 +845,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
service_name: request.serviceName || '', | ||
@@ -884,3 +892,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
service_name: request.serviceName || '', | ||
@@ -936,3 +944,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
service_name: request.serviceName || '', | ||
@@ -939,0 +947,0 @@ }); |
# Changelog | ||
## [1.1.2](https://github.com/googleapis/nodejs-service-management/compare/v1.1.1...v1.1.2) (2022-09-01) | ||
### Bug Fixes | ||
* Allow passing gax instance to client constructor ([#166](https://github.com/googleapis/nodejs-service-management/issues/166)) ([deda310](https://github.com/googleapis/nodejs-service-management/commit/deda3102c60ed95a03de5f4ae123c858d9af1cf4)) | ||
* Do not import the whole google-gax from proto JS ([#1553](https://github.com/googleapis/nodejs-service-management/issues/1553)) ([#165](https://github.com/googleapis/nodejs-service-management/issues/165)) ([aa21cf2](https://github.com/googleapis/nodejs-service-management/commit/aa21cf2c463c6410be8f9dc8906493dc78f131c1)) | ||
## [1.1.1](https://github.com/googleapis/nodejs-service-management/compare/v1.1.0...v1.1.1) (2022-08-23) | ||
@@ -4,0 +12,0 @@ |
{ | ||
"name": "@google-cloud/service-management", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Service management client for Node.js", | ||
@@ -42,3 +42,3 @@ "repository": "googleapis/nodejs-service-management", | ||
"dependencies": { | ||
"google-gax": "^3.0.1" | ||
"google-gax": "^3.3.0" | ||
}, | ||
@@ -45,0 +45,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
3235269
0.39%56143
0.33%+ Added
+ Added
- Removed
- Removed
Updated