@google-cloud/run
Advanced tools
Comparing version
@@ -19,2 +19,3 @@ import type * as gax from 'google-gax'; | ||
private _servicePath; | ||
private _log; | ||
auth: gax.GoogleAuth; | ||
@@ -55,3 +56,3 @@ descriptors: Descriptors; | ||
* app is running in an environment which supports | ||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, | ||
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, | ||
* your project ID will be detected automatically. | ||
@@ -58,0 +59,0 @@ * @param {string} [options.apiEndpoint] - The domain name of the |
@@ -22,2 +22,3 @@ "use strict"; | ||
const jsonProtos = require("../../protos/protos.json"); | ||
const google_gax_1 = require("google-gax"); | ||
/** | ||
@@ -36,2 +37,24 @@ * Client JSON configuration object, loaded from | ||
class BuildsClient { | ||
_terminated = false; | ||
_opts; | ||
_providedCustomServicePath; | ||
_gaxModule; | ||
_gaxGrpc; | ||
_protos; | ||
_defaults; | ||
_universeDomain; | ||
_servicePath; | ||
_log = google_gax_1.loggingUtils.log('run'); | ||
auth; | ||
descriptors = { | ||
page: {}, | ||
stream: {}, | ||
longrunning: {}, | ||
batching: {}, | ||
}; | ||
warn; | ||
innerApiCalls; | ||
locationsClient; | ||
pathTemplates; | ||
buildsStub; | ||
/** | ||
@@ -59,3 +82,3 @@ * Construct an instance of BuildsClient. | ||
* app is running in an environment which supports | ||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, | ||
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, | ||
* your project ID will be detected automatically. | ||
@@ -78,15 +101,7 @@ * @param {string} [options.apiEndpoint] - The domain name of the | ||
constructor(opts, gaxInstance) { | ||
var _a, _b, _c, _d, _e; | ||
this._terminated = false; | ||
this.descriptors = { | ||
page: {}, | ||
stream: {}, | ||
longrunning: {}, | ||
batching: {}, | ||
}; | ||
// Ensure that options include all the required fields. | ||
const staticMembers = this.constructor; | ||
if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) && | ||
(opts === null || opts === void 0 ? void 0 : opts.universeDomain) && | ||
(opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) { | ||
if (opts?.universe_domain && | ||
opts?.universeDomain && | ||
opts?.universe_domain !== opts?.universeDomain) { | ||
throw new Error('Please set either universe_domain or universeDomain, but not both.'); | ||
@@ -98,9 +113,13 @@ } | ||
this._universeDomain = | ||
(_c = (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com'; | ||
opts?.universeDomain ?? | ||
opts?.universe_domain ?? | ||
universeDomainEnvVar ?? | ||
'googleapis.com'; | ||
this._servicePath = 'run.' + this._universeDomain; | ||
const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath; | ||
this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint)); | ||
const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port; | ||
const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {}; | ||
const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function'); | ||
const servicePath = opts?.servicePath || opts?.apiEndpoint || this._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); | ||
@@ -275,3 +294,2 @@ // Request numeric enum values if REST transport is used. | ||
submitBuild(request, optionsOrCallback, callback) { | ||
var _a; | ||
request = request || {}; | ||
@@ -291,6 +309,18 @@ let options; | ||
this._gaxModule.routingHeader.fromParams({ | ||
parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', | ||
parent: request.parent ?? '', | ||
}); | ||
this.initialize(); | ||
return this.innerApiCalls.submitBuild(request, options, callback); | ||
this._log.info('submitBuild request %j', request); | ||
const wrappedCallback = callback | ||
? (error, response, options, rawResponse) => { | ||
this._log.info('submitBuild response %j', response); | ||
callback(error, response, options, rawResponse); // We verified callback above. | ||
} | ||
: undefined; | ||
return this.innerApiCalls | ||
.submitBuild(request, options, wrappedCallback) | ||
?.then(([response, options, rawResponse]) => { | ||
this._log.info('submitBuild response %j', response); | ||
return [response, options, rawResponse]; | ||
}); | ||
} | ||
@@ -688,2 +718,3 @@ /** | ||
return this.buildsStub.then(stub => { | ||
this._log.info('ending gRPC channel'); | ||
this._terminated = true; | ||
@@ -690,0 +721,0 @@ stub.close(); |
@@ -20,2 +20,3 @@ import type * as gax from 'google-gax'; | ||
private _servicePath; | ||
private _log; | ||
auth: gax.GoogleAuth; | ||
@@ -57,3 +58,3 @@ descriptors: Descriptors; | ||
* app is running in an environment which supports | ||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, | ||
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, | ||
* your project ID will be detected automatically. | ||
@@ -60,0 +61,0 @@ * @param {string} [options.apiEndpoint] - The domain name of the |
@@ -22,2 +22,3 @@ "use strict"; | ||
const jsonProtos = require("../../protos/protos.json"); | ||
const google_gax_1 = require("google-gax"); | ||
/** | ||
@@ -36,2 +37,25 @@ * Client JSON configuration object, loaded from | ||
class ExecutionsClient { | ||
_terminated = false; | ||
_opts; | ||
_providedCustomServicePath; | ||
_gaxModule; | ||
_gaxGrpc; | ||
_protos; | ||
_defaults; | ||
_universeDomain; | ||
_servicePath; | ||
_log = google_gax_1.loggingUtils.log('run'); | ||
auth; | ||
descriptors = { | ||
page: {}, | ||
stream: {}, | ||
longrunning: {}, | ||
batching: {}, | ||
}; | ||
warn; | ||
innerApiCalls; | ||
locationsClient; | ||
pathTemplates; | ||
operationsClient; | ||
executionsStub; | ||
/** | ||
@@ -59,3 +83,3 @@ * Construct an instance of ExecutionsClient. | ||
* app is running in an environment which supports | ||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, | ||
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, | ||
* your project ID will be detected automatically. | ||
@@ -78,15 +102,7 @@ * @param {string} [options.apiEndpoint] - The domain name of the | ||
constructor(opts, gaxInstance) { | ||
var _a, _b, _c, _d, _e; | ||
this._terminated = false; | ||
this.descriptors = { | ||
page: {}, | ||
stream: {}, | ||
longrunning: {}, | ||
batching: {}, | ||
}; | ||
// Ensure that options include all the required fields. | ||
const staticMembers = this.constructor; | ||
if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) && | ||
(opts === null || opts === void 0 ? void 0 : opts.universeDomain) && | ||
(opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) { | ||
if (opts?.universe_domain && | ||
opts?.universeDomain && | ||
opts?.universe_domain !== opts?.universeDomain) { | ||
throw new Error('Please set either universe_domain or universeDomain, but not both.'); | ||
@@ -98,9 +114,13 @@ } | ||
this._universeDomain = | ||
(_c = (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com'; | ||
opts?.universeDomain ?? | ||
opts?.universe_domain ?? | ||
universeDomainEnvVar ?? | ||
'googleapis.com'; | ||
this._servicePath = 'run.' + this._universeDomain; | ||
const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath; | ||
this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint)); | ||
const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port; | ||
const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {}; | ||
const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function'); | ||
const servicePath = opts?.servicePath || opts?.apiEndpoint || this._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); | ||
@@ -330,3 +350,2 @@ // Request numeric enum values if REST transport is used. | ||
getExecution(request, optionsOrCallback, callback) { | ||
var _a; | ||
request = request || {}; | ||
@@ -346,9 +365,20 @@ let options; | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: (_a = request.name) !== null && _a !== void 0 ? _a : '', | ||
name: request.name ?? '', | ||
}); | ||
this.initialize(); | ||
return this.innerApiCalls.getExecution(request, options, callback); | ||
this._log.info('getExecution request %j', request); | ||
const wrappedCallback = callback | ||
? (error, response, options, rawResponse) => { | ||
this._log.info('getExecution response %j', response); | ||
callback(error, response, options, rawResponse); // We verified callback above. | ||
} | ||
: undefined; | ||
return this.innerApiCalls | ||
.getExecution(request, options, wrappedCallback) | ||
?.then(([response, options, rawResponse]) => { | ||
this._log.info('getExecution response %j', response); | ||
return [response, options, rawResponse]; | ||
}); | ||
} | ||
deleteExecution(request, optionsOrCallback, callback) { | ||
var _a; | ||
request = request || {}; | ||
@@ -368,6 +398,18 @@ let options; | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: (_a = request.name) !== null && _a !== void 0 ? _a : '', | ||
name: request.name ?? '', | ||
}); | ||
this.initialize(); | ||
return this.innerApiCalls.deleteExecution(request, options, callback); | ||
const wrappedCallback = callback | ||
? (error, response, rawResponse, _) => { | ||
this._log.info('deleteExecution response %j', rawResponse); | ||
callback(error, response, rawResponse, _); // We verified callback above. | ||
} | ||
: undefined; | ||
this._log.info('deleteExecution request %j', request); | ||
return this.innerApiCalls | ||
.deleteExecution(request, options, wrappedCallback) | ||
?.then(([response, rawResponse, _]) => { | ||
this._log.info('deleteExecution response %j', rawResponse); | ||
return [response, rawResponse, _]; | ||
}); | ||
} | ||
@@ -386,2 +428,3 @@ /** | ||
async checkDeleteExecutionProgress(name) { | ||
this._log.info('deleteExecution long-running'); | ||
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name }); | ||
@@ -393,3 +436,2 @@ const [operation] = await this.operationsClient.getOperation(request); | ||
cancelExecution(request, optionsOrCallback, callback) { | ||
var _a; | ||
request = request || {}; | ||
@@ -409,6 +451,18 @@ let options; | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: (_a = request.name) !== null && _a !== void 0 ? _a : '', | ||
name: request.name ?? '', | ||
}); | ||
this.initialize(); | ||
return this.innerApiCalls.cancelExecution(request, options, callback); | ||
const wrappedCallback = callback | ||
? (error, response, rawResponse, _) => { | ||
this._log.info('cancelExecution response %j', rawResponse); | ||
callback(error, response, rawResponse, _); // We verified callback above. | ||
} | ||
: undefined; | ||
this._log.info('cancelExecution request %j', request); | ||
return this.innerApiCalls | ||
.cancelExecution(request, options, wrappedCallback) | ||
?.then(([response, rawResponse, _]) => { | ||
this._log.info('cancelExecution response %j', rawResponse); | ||
return [response, rawResponse, _]; | ||
}); | ||
} | ||
@@ -427,2 +481,3 @@ /** | ||
async checkCancelExecutionProgress(name) { | ||
this._log.info('cancelExecution long-running'); | ||
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name }); | ||
@@ -434,3 +489,2 @@ const [operation] = await this.operationsClient.getOperation(request); | ||
listExecutions(request, optionsOrCallback, callback) { | ||
var _a; | ||
request = request || {}; | ||
@@ -450,6 +504,18 @@ let options; | ||
this._gaxModule.routingHeader.fromParams({ | ||
parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', | ||
parent: request.parent ?? '', | ||
}); | ||
this.initialize(); | ||
return this.innerApiCalls.listExecutions(request, options, callback); | ||
const wrappedCallback = callback | ||
? (error, values, nextPageRequest, rawResponse) => { | ||
this._log.info('listExecutions values %j', values); | ||
callback(error, values, nextPageRequest, rawResponse); // We verified callback above. | ||
} | ||
: undefined; | ||
this._log.info('listExecutions request %j', request); | ||
return this.innerApiCalls | ||
.listExecutions(request, options, wrappedCallback) | ||
?.then(([response, input, output]) => { | ||
this._log.info('listExecutions values %j', response); | ||
return [response, input, output]; | ||
}); | ||
} | ||
@@ -484,3 +550,2 @@ /** | ||
listExecutionsStream(request, options) { | ||
var _a; | ||
request = request || {}; | ||
@@ -492,3 +557,3 @@ options = options || {}; | ||
this._gaxModule.routingHeader.fromParams({ | ||
parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', | ||
parent: request.parent ?? '', | ||
}); | ||
@@ -498,2 +563,3 @@ const defaultCallSettings = this._defaults['listExecutions']; | ||
this.initialize(); | ||
this._log.info('listExecutions stream %j', request); | ||
return this.descriptors.page.listExecutions.createStream(this.innerApiCalls.listExecutions, request, callSettings); | ||
@@ -532,3 +598,2 @@ } | ||
listExecutionsAsync(request, options) { | ||
var _a; | ||
request = request || {}; | ||
@@ -540,3 +605,3 @@ options = options || {}; | ||
this._gaxModule.routingHeader.fromParams({ | ||
parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', | ||
parent: request.parent ?? '', | ||
}); | ||
@@ -546,2 +611,3 @@ const defaultCallSettings = this._defaults['listExecutions']; | ||
this.initialize(); | ||
this._log.info('listExecutions iterate %j', request); | ||
return this.descriptors.page.listExecutions.asyncIterate(this.innerApiCalls['listExecutions'], request, callSettings); | ||
@@ -635,3 +701,2 @@ } | ||
getOperation(request, optionsOrCallback, callback) { | ||
var _a; | ||
let options; | ||
@@ -650,3 +715,3 @@ if (typeof optionsOrCallback === 'function' && callback === undefined) { | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: (_a = request.name) !== null && _a !== void 0 ? _a : '', | ||
name: request.name ?? '', | ||
}); | ||
@@ -686,3 +751,2 @@ return this.operationsClient.getOperation(request, options, callback); | ||
listOperationsAsync(request, options) { | ||
var _a; | ||
options = options || {}; | ||
@@ -693,3 +757,3 @@ options.otherArgs = options.otherArgs || {}; | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: (_a = request.name) !== null && _a !== void 0 ? _a : '', | ||
name: request.name ?? '', | ||
}); | ||
@@ -730,3 +794,2 @@ return this.operationsClient.listOperationsAsync(request, options); | ||
cancelOperation(request, optionsOrCallback, callback) { | ||
var _a; | ||
let options; | ||
@@ -745,3 +808,3 @@ if (typeof optionsOrCallback === 'function' && callback === undefined) { | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: (_a = request.name) !== null && _a !== void 0 ? _a : '', | ||
name: request.name ?? '', | ||
}); | ||
@@ -776,3 +839,2 @@ return this.operationsClient.cancelOperation(request, options, callback); | ||
deleteOperation(request, optionsOrCallback, callback) { | ||
var _a; | ||
let options; | ||
@@ -791,3 +853,3 @@ if (typeof optionsOrCallback === 'function' && callback === undefined) { | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: (_a = request.name) !== null && _a !== void 0 ? _a : '', | ||
name: request.name ?? '', | ||
}); | ||
@@ -1138,2 +1200,3 @@ return this.operationsClient.deleteOperation(request, options, callback); | ||
return this.executionsStub.then(stub => { | ||
this._log.info('ending gRPC channel'); | ||
this._terminated = true; | ||
@@ -1140,0 +1203,0 @@ stub.close(); |
@@ -20,2 +20,3 @@ import type * as gax from 'google-gax'; | ||
private _servicePath; | ||
private _log; | ||
auth: gax.GoogleAuth; | ||
@@ -57,3 +58,3 @@ descriptors: Descriptors; | ||
* app is running in an environment which supports | ||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, | ||
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, | ||
* your project ID will be detected automatically. | ||
@@ -60,0 +61,0 @@ * @param {string} [options.apiEndpoint] - The domain name of the |
@@ -20,2 +20,3 @@ import type * as gax from 'google-gax'; | ||
private _servicePath; | ||
private _log; | ||
auth: gax.GoogleAuth; | ||
@@ -57,3 +58,3 @@ descriptors: Descriptors; | ||
* app is running in an environment which supports | ||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, | ||
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, | ||
* your project ID will be detected automatically. | ||
@@ -60,0 +61,0 @@ * @param {string} [options.apiEndpoint] - The domain name of the |
@@ -22,2 +22,3 @@ "use strict"; | ||
const jsonProtos = require("../../protos/protos.json"); | ||
const google_gax_1 = require("google-gax"); | ||
/** | ||
@@ -36,2 +37,25 @@ * Client JSON configuration object, loaded from | ||
class RevisionsClient { | ||
_terminated = false; | ||
_opts; | ||
_providedCustomServicePath; | ||
_gaxModule; | ||
_gaxGrpc; | ||
_protos; | ||
_defaults; | ||
_universeDomain; | ||
_servicePath; | ||
_log = google_gax_1.loggingUtils.log('run'); | ||
auth; | ||
descriptors = { | ||
page: {}, | ||
stream: {}, | ||
longrunning: {}, | ||
batching: {}, | ||
}; | ||
warn; | ||
innerApiCalls; | ||
locationsClient; | ||
pathTemplates; | ||
operationsClient; | ||
revisionsStub; | ||
/** | ||
@@ -59,3 +83,3 @@ * Construct an instance of RevisionsClient. | ||
* app is running in an environment which supports | ||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, | ||
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, | ||
* your project ID will be detected automatically. | ||
@@ -78,15 +102,7 @@ * @param {string} [options.apiEndpoint] - The domain name of the | ||
constructor(opts, gaxInstance) { | ||
var _a, _b, _c, _d, _e; | ||
this._terminated = false; | ||
this.descriptors = { | ||
page: {}, | ||
stream: {}, | ||
longrunning: {}, | ||
batching: {}, | ||
}; | ||
// Ensure that options include all the required fields. | ||
const staticMembers = this.constructor; | ||
if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) && | ||
(opts === null || opts === void 0 ? void 0 : opts.universeDomain) && | ||
(opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) { | ||
if (opts?.universe_domain && | ||
opts?.universeDomain && | ||
opts?.universe_domain !== opts?.universeDomain) { | ||
throw new Error('Please set either universe_domain or universeDomain, but not both.'); | ||
@@ -98,9 +114,13 @@ } | ||
this._universeDomain = | ||
(_c = (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com'; | ||
opts?.universeDomain ?? | ||
opts?.universe_domain ?? | ||
universeDomainEnvVar ?? | ||
'googleapis.com'; | ||
this._servicePath = 'run.' + this._universeDomain; | ||
const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath; | ||
this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint)); | ||
const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port; | ||
const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {}; | ||
const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function'); | ||
const servicePath = opts?.servicePath || opts?.apiEndpoint || this._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); | ||
@@ -327,3 +347,2 @@ // Request numeric enum values if REST transport is used. | ||
getRevision(request, optionsOrCallback, callback) { | ||
var _a, _b; | ||
request = request || {}; | ||
@@ -349,3 +368,3 @@ let options; | ||
if (match) { | ||
const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['location']) !== null && _b !== void 0 ? _b : fieldValue; | ||
const parameterValue = match.groups?.['location'] ?? fieldValue; | ||
Object.assign(routingParameter, { location: parameterValue }); | ||
@@ -358,6 +377,17 @@ } | ||
this.initialize(); | ||
return this.innerApiCalls.getRevision(request, options, callback); | ||
this._log.info('getRevision request %j', request); | ||
const wrappedCallback = callback | ||
? (error, response, options, rawResponse) => { | ||
this._log.info('getRevision response %j', response); | ||
callback(error, response, options, rawResponse); // We verified callback above. | ||
} | ||
: undefined; | ||
return this.innerApiCalls | ||
.getRevision(request, options, wrappedCallback) | ||
?.then(([response, options, rawResponse]) => { | ||
this._log.info('getRevision response %j', response); | ||
return [response, options, rawResponse]; | ||
}); | ||
} | ||
deleteRevision(request, optionsOrCallback, callback) { | ||
var _a, _b; | ||
request = request || {}; | ||
@@ -383,3 +413,3 @@ let options; | ||
if (match) { | ||
const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['location']) !== null && _b !== void 0 ? _b : fieldValue; | ||
const parameterValue = match.groups?.['location'] ?? fieldValue; | ||
Object.assign(routingParameter, { location: parameterValue }); | ||
@@ -392,3 +422,15 @@ } | ||
this.initialize(); | ||
return this.innerApiCalls.deleteRevision(request, options, callback); | ||
const wrappedCallback = callback | ||
? (error, response, rawResponse, _) => { | ||
this._log.info('deleteRevision response %j', rawResponse); | ||
callback(error, response, rawResponse, _); // We verified callback above. | ||
} | ||
: undefined; | ||
this._log.info('deleteRevision request %j', request); | ||
return this.innerApiCalls | ||
.deleteRevision(request, options, wrappedCallback) | ||
?.then(([response, rawResponse, _]) => { | ||
this._log.info('deleteRevision response %j', rawResponse); | ||
return [response, rawResponse, _]; | ||
}); | ||
} | ||
@@ -407,2 +449,3 @@ /** | ||
async checkDeleteRevisionProgress(name) { | ||
this._log.info('deleteRevision long-running'); | ||
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name }); | ||
@@ -414,3 +457,2 @@ const [operation] = await this.operationsClient.getOperation(request); | ||
listRevisions(request, optionsOrCallback, callback) { | ||
var _a, _b; | ||
request = request || {}; | ||
@@ -436,3 +478,3 @@ let options; | ||
if (match) { | ||
const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['location']) !== null && _b !== void 0 ? _b : fieldValue; | ||
const parameterValue = match.groups?.['location'] ?? fieldValue; | ||
Object.assign(routingParameter, { location: parameterValue }); | ||
@@ -445,3 +487,15 @@ } | ||
this.initialize(); | ||
return this.innerApiCalls.listRevisions(request, options, callback); | ||
const wrappedCallback = callback | ||
? (error, values, nextPageRequest, rawResponse) => { | ||
this._log.info('listRevisions values %j', values); | ||
callback(error, values, nextPageRequest, rawResponse); // We verified callback above. | ||
} | ||
: undefined; | ||
this._log.info('listRevisions request %j', request); | ||
return this.innerApiCalls | ||
.listRevisions(request, options, wrappedCallback) | ||
?.then(([response, input, output]) => { | ||
this._log.info('listRevisions values %j', response); | ||
return [response, input, output]; | ||
}); | ||
} | ||
@@ -476,3 +530,2 @@ /** | ||
listRevisionsStream(request, options) { | ||
var _a, _b; | ||
request = request || {}; | ||
@@ -490,3 +543,3 @@ options = options || {}; | ||
if (match) { | ||
const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['location']) !== null && _b !== void 0 ? _b : fieldValue; | ||
const parameterValue = match.groups?.['location'] ?? fieldValue; | ||
Object.assign(routingParameter, { location: parameterValue }); | ||
@@ -501,2 +554,3 @@ } | ||
this.initialize(); | ||
this._log.info('listRevisions stream %j', request); | ||
return this.descriptors.page.listRevisions.createStream(this.innerApiCalls.listRevisions, request, callSettings); | ||
@@ -535,3 +589,2 @@ } | ||
listRevisionsAsync(request, options) { | ||
var _a, _b; | ||
request = request || {}; | ||
@@ -549,3 +602,3 @@ options = options || {}; | ||
if (match) { | ||
const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['location']) !== null && _b !== void 0 ? _b : fieldValue; | ||
const parameterValue = match.groups?.['location'] ?? fieldValue; | ||
Object.assign(routingParameter, { location: parameterValue }); | ||
@@ -560,2 +613,3 @@ } | ||
this.initialize(); | ||
this._log.info('listRevisions iterate %j', request); | ||
return this.descriptors.page.listRevisions.asyncIterate(this.innerApiCalls['listRevisions'], request, callSettings); | ||
@@ -649,3 +703,2 @@ } | ||
getOperation(request, optionsOrCallback, callback) { | ||
var _a; | ||
let options; | ||
@@ -664,3 +717,3 @@ if (typeof optionsOrCallback === 'function' && callback === undefined) { | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: (_a = request.name) !== null && _a !== void 0 ? _a : '', | ||
name: request.name ?? '', | ||
}); | ||
@@ -700,3 +753,2 @@ return this.operationsClient.getOperation(request, options, callback); | ||
listOperationsAsync(request, options) { | ||
var _a; | ||
options = options || {}; | ||
@@ -707,3 +759,3 @@ options.otherArgs = options.otherArgs || {}; | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: (_a = request.name) !== null && _a !== void 0 ? _a : '', | ||
name: request.name ?? '', | ||
}); | ||
@@ -744,3 +796,2 @@ return this.operationsClient.listOperationsAsync(request, options); | ||
cancelOperation(request, optionsOrCallback, callback) { | ||
var _a; | ||
let options; | ||
@@ -759,3 +810,3 @@ if (typeof optionsOrCallback === 'function' && callback === undefined) { | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: (_a = request.name) !== null && _a !== void 0 ? _a : '', | ||
name: request.name ?? '', | ||
}); | ||
@@ -790,3 +841,2 @@ return this.operationsClient.cancelOperation(request, options, callback); | ||
deleteOperation(request, optionsOrCallback, callback) { | ||
var _a; | ||
let options; | ||
@@ -805,3 +855,3 @@ if (typeof optionsOrCallback === 'function' && callback === undefined) { | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: (_a = request.name) !== null && _a !== void 0 ? _a : '', | ||
name: request.name ?? '', | ||
}); | ||
@@ -1213,2 +1263,3 @@ return this.operationsClient.deleteOperation(request, options, callback); | ||
return this.revisionsStub.then(stub => { | ||
this._log.info('ending gRPC channel'); | ||
this._terminated = true; | ||
@@ -1215,0 +1266,0 @@ stub.close(); |
@@ -20,2 +20,3 @@ import type * as gax from 'google-gax'; | ||
private _servicePath; | ||
private _log; | ||
auth: gax.GoogleAuth; | ||
@@ -57,3 +58,3 @@ descriptors: Descriptors; | ||
* app is running in an environment which supports | ||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, | ||
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, | ||
* your project ID will be detected automatically. | ||
@@ -60,0 +61,0 @@ * @param {string} [options.apiEndpoint] - The domain name of the |
@@ -22,2 +22,3 @@ "use strict"; | ||
const jsonProtos = require("../../protos/protos.json"); | ||
const google_gax_1 = require("google-gax"); | ||
/** | ||
@@ -36,2 +37,25 @@ * Client JSON configuration object, loaded from | ||
class ServicesClient { | ||
_terminated = false; | ||
_opts; | ||
_providedCustomServicePath; | ||
_gaxModule; | ||
_gaxGrpc; | ||
_protos; | ||
_defaults; | ||
_universeDomain; | ||
_servicePath; | ||
_log = google_gax_1.loggingUtils.log('run'); | ||
auth; | ||
descriptors = { | ||
page: {}, | ||
stream: {}, | ||
longrunning: {}, | ||
batching: {}, | ||
}; | ||
warn; | ||
innerApiCalls; | ||
locationsClient; | ||
pathTemplates; | ||
operationsClient; | ||
servicesStub; | ||
/** | ||
@@ -59,3 +83,3 @@ * Construct an instance of ServicesClient. | ||
* app is running in an environment which supports | ||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, | ||
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, | ||
* your project ID will be detected automatically. | ||
@@ -78,15 +102,7 @@ * @param {string} [options.apiEndpoint] - The domain name of the | ||
constructor(opts, gaxInstance) { | ||
var _a, _b, _c, _d, _e; | ||
this._terminated = false; | ||
this.descriptors = { | ||
page: {}, | ||
stream: {}, | ||
longrunning: {}, | ||
batching: {}, | ||
}; | ||
// Ensure that options include all the required fields. | ||
const staticMembers = this.constructor; | ||
if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) && | ||
(opts === null || opts === void 0 ? void 0 : opts.universeDomain) && | ||
(opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) { | ||
if (opts?.universe_domain && | ||
opts?.universeDomain && | ||
opts?.universe_domain !== opts?.universeDomain) { | ||
throw new Error('Please set either universe_domain or universeDomain, but not both.'); | ||
@@ -98,9 +114,13 @@ } | ||
this._universeDomain = | ||
(_c = (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com'; | ||
opts?.universeDomain ?? | ||
opts?.universe_domain ?? | ||
universeDomainEnvVar ?? | ||
'googleapis.com'; | ||
this._servicePath = 'run.' + this._universeDomain; | ||
const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath; | ||
this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint)); | ||
const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port; | ||
const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {}; | ||
const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function'); | ||
const servicePath = opts?.servicePath || opts?.apiEndpoint || this._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); | ||
@@ -337,3 +357,2 @@ // Request numeric enum values if REST transport is used. | ||
getService(request, optionsOrCallback, callback) { | ||
var _a, _b; | ||
request = request || {}; | ||
@@ -359,3 +378,3 @@ let options; | ||
if (match) { | ||
const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['location']) !== null && _b !== void 0 ? _b : fieldValue; | ||
const parameterValue = match.groups?.['location'] ?? fieldValue; | ||
Object.assign(routingParameter, { location: parameterValue }); | ||
@@ -368,6 +387,17 @@ } | ||
this.initialize(); | ||
return this.innerApiCalls.getService(request, options, callback); | ||
this._log.info('getService request %j', request); | ||
const wrappedCallback = callback | ||
? (error, response, options, rawResponse) => { | ||
this._log.info('getService response %j', response); | ||
callback(error, response, options, rawResponse); // We verified callback above. | ||
} | ||
: undefined; | ||
return this.innerApiCalls | ||
.getService(request, options, wrappedCallback) | ||
?.then(([response, options, rawResponse]) => { | ||
this._log.info('getService response %j', response); | ||
return [response, options, rawResponse]; | ||
}); | ||
} | ||
getIamPolicy(request, optionsOrCallback, callback) { | ||
var _a; | ||
request = request || {}; | ||
@@ -387,9 +417,20 @@ let options; | ||
this._gaxModule.routingHeader.fromParams({ | ||
resource: (_a = request.resource) !== null && _a !== void 0 ? _a : '', | ||
resource: request.resource ?? '', | ||
}); | ||
this.initialize(); | ||
return this.innerApiCalls.getIamPolicy(request, options, callback); | ||
this._log.info('getIamPolicy request %j', request); | ||
const wrappedCallback = callback | ||
? (error, response, options, rawResponse) => { | ||
this._log.info('getIamPolicy response %j', response); | ||
callback(error, response, options, rawResponse); // We verified callback above. | ||
} | ||
: undefined; | ||
return this.innerApiCalls | ||
.getIamPolicy(request, options, wrappedCallback) | ||
?.then(([response, options, rawResponse]) => { | ||
this._log.info('getIamPolicy response %j', response); | ||
return [response, options, rawResponse]; | ||
}); | ||
} | ||
setIamPolicy(request, optionsOrCallback, callback) { | ||
var _a; | ||
request = request || {}; | ||
@@ -409,9 +450,20 @@ let options; | ||
this._gaxModule.routingHeader.fromParams({ | ||
resource: (_a = request.resource) !== null && _a !== void 0 ? _a : '', | ||
resource: request.resource ?? '', | ||
}); | ||
this.initialize(); | ||
return this.innerApiCalls.setIamPolicy(request, options, callback); | ||
this._log.info('setIamPolicy request %j', request); | ||
const wrappedCallback = callback | ||
? (error, response, options, rawResponse) => { | ||
this._log.info('setIamPolicy response %j', response); | ||
callback(error, response, options, rawResponse); // We verified callback above. | ||
} | ||
: undefined; | ||
return this.innerApiCalls | ||
.setIamPolicy(request, options, wrappedCallback) | ||
?.then(([response, options, rawResponse]) => { | ||
this._log.info('setIamPolicy response %j', response); | ||
return [response, options, rawResponse]; | ||
}); | ||
} | ||
testIamPermissions(request, optionsOrCallback, callback) { | ||
var _a; | ||
request = request || {}; | ||
@@ -431,9 +483,20 @@ let options; | ||
this._gaxModule.routingHeader.fromParams({ | ||
resource: (_a = request.resource) !== null && _a !== void 0 ? _a : '', | ||
resource: request.resource ?? '', | ||
}); | ||
this.initialize(); | ||
return this.innerApiCalls.testIamPermissions(request, options, callback); | ||
this._log.info('testIamPermissions request %j', request); | ||
const wrappedCallback = callback | ||
? (error, response, options, rawResponse) => { | ||
this._log.info('testIamPermissions response %j', response); | ||
callback(error, response, options, rawResponse); // We verified callback above. | ||
} | ||
: undefined; | ||
return this.innerApiCalls | ||
.testIamPermissions(request, options, wrappedCallback) | ||
?.then(([response, options, rawResponse]) => { | ||
this._log.info('testIamPermissions response %j', response); | ||
return [response, options, rawResponse]; | ||
}); | ||
} | ||
createService(request, optionsOrCallback, callback) { | ||
var _a, _b; | ||
request = request || {}; | ||
@@ -459,3 +522,3 @@ let options; | ||
if (match) { | ||
const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['location']) !== null && _b !== void 0 ? _b : fieldValue; | ||
const parameterValue = match.groups?.['location'] ?? fieldValue; | ||
Object.assign(routingParameter, { location: parameterValue }); | ||
@@ -468,3 +531,15 @@ } | ||
this.initialize(); | ||
return this.innerApiCalls.createService(request, options, callback); | ||
const wrappedCallback = callback | ||
? (error, response, rawResponse, _) => { | ||
this._log.info('createService response %j', rawResponse); | ||
callback(error, response, rawResponse, _); // We verified callback above. | ||
} | ||
: undefined; | ||
this._log.info('createService request %j', request); | ||
return this.innerApiCalls | ||
.createService(request, options, wrappedCallback) | ||
?.then(([response, rawResponse, _]) => { | ||
this._log.info('createService response %j', rawResponse); | ||
return [response, rawResponse, _]; | ||
}); | ||
} | ||
@@ -483,2 +558,3 @@ /** | ||
async checkCreateServiceProgress(name) { | ||
this._log.info('createService long-running'); | ||
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name }); | ||
@@ -490,3 +566,2 @@ const [operation] = await this.operationsClient.getOperation(request); | ||
updateService(request, optionsOrCallback, callback) { | ||
var _a, _b, _c; | ||
request = request || {}; | ||
@@ -506,3 +581,3 @@ let options; | ||
{ | ||
const fieldValue = (_a = request.service) === null || _a === void 0 ? void 0 : _a.name; | ||
const fieldValue = request.service?.name; | ||
if (fieldValue !== undefined && fieldValue !== null) { | ||
@@ -513,3 +588,3 @@ const match = fieldValue | ||
if (match) { | ||
const parameterValue = (_c = (_b = match.groups) === null || _b === void 0 ? void 0 : _b['location']) !== null && _c !== void 0 ? _c : fieldValue; | ||
const parameterValue = match.groups?.['location'] ?? fieldValue; | ||
Object.assign(routingParameter, { location: parameterValue }); | ||
@@ -522,3 +597,15 @@ } | ||
this.initialize(); | ||
return this.innerApiCalls.updateService(request, options, callback); | ||
const wrappedCallback = callback | ||
? (error, response, rawResponse, _) => { | ||
this._log.info('updateService response %j', rawResponse); | ||
callback(error, response, rawResponse, _); // We verified callback above. | ||
} | ||
: undefined; | ||
this._log.info('updateService request %j', request); | ||
return this.innerApiCalls | ||
.updateService(request, options, wrappedCallback) | ||
?.then(([response, rawResponse, _]) => { | ||
this._log.info('updateService response %j', rawResponse); | ||
return [response, rawResponse, _]; | ||
}); | ||
} | ||
@@ -537,2 +624,3 @@ /** | ||
async checkUpdateServiceProgress(name) { | ||
this._log.info('updateService long-running'); | ||
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name }); | ||
@@ -544,3 +632,2 @@ const [operation] = await this.operationsClient.getOperation(request); | ||
deleteService(request, optionsOrCallback, callback) { | ||
var _a, _b; | ||
request = request || {}; | ||
@@ -566,3 +653,3 @@ let options; | ||
if (match) { | ||
const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['location']) !== null && _b !== void 0 ? _b : fieldValue; | ||
const parameterValue = match.groups?.['location'] ?? fieldValue; | ||
Object.assign(routingParameter, { location: parameterValue }); | ||
@@ -575,3 +662,15 @@ } | ||
this.initialize(); | ||
return this.innerApiCalls.deleteService(request, options, callback); | ||
const wrappedCallback = callback | ||
? (error, response, rawResponse, _) => { | ||
this._log.info('deleteService response %j', rawResponse); | ||
callback(error, response, rawResponse, _); // We verified callback above. | ||
} | ||
: undefined; | ||
this._log.info('deleteService request %j', request); | ||
return this.innerApiCalls | ||
.deleteService(request, options, wrappedCallback) | ||
?.then(([response, rawResponse, _]) => { | ||
this._log.info('deleteService response %j', rawResponse); | ||
return [response, rawResponse, _]; | ||
}); | ||
} | ||
@@ -590,2 +689,3 @@ /** | ||
async checkDeleteServiceProgress(name) { | ||
this._log.info('deleteService long-running'); | ||
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name }); | ||
@@ -597,3 +697,2 @@ const [operation] = await this.operationsClient.getOperation(request); | ||
listServices(request, optionsOrCallback, callback) { | ||
var _a, _b; | ||
request = request || {}; | ||
@@ -619,3 +718,3 @@ let options; | ||
if (match) { | ||
const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['location']) !== null && _b !== void 0 ? _b : fieldValue; | ||
const parameterValue = match.groups?.['location'] ?? fieldValue; | ||
Object.assign(routingParameter, { location: parameterValue }); | ||
@@ -628,3 +727,15 @@ } | ||
this.initialize(); | ||
return this.innerApiCalls.listServices(request, options, callback); | ||
const wrappedCallback = callback | ||
? (error, values, nextPageRequest, rawResponse) => { | ||
this._log.info('listServices values %j', values); | ||
callback(error, values, nextPageRequest, rawResponse); // We verified callback above. | ||
} | ||
: undefined; | ||
this._log.info('listServices request %j', request); | ||
return this.innerApiCalls | ||
.listServices(request, options, wrappedCallback) | ||
?.then(([response, input, output]) => { | ||
this._log.info('listServices values %j', response); | ||
return [response, input, output]; | ||
}); | ||
} | ||
@@ -659,3 +770,2 @@ /** | ||
listServicesStream(request, options) { | ||
var _a, _b; | ||
request = request || {}; | ||
@@ -673,3 +783,3 @@ options = options || {}; | ||
if (match) { | ||
const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['location']) !== null && _b !== void 0 ? _b : fieldValue; | ||
const parameterValue = match.groups?.['location'] ?? fieldValue; | ||
Object.assign(routingParameter, { location: parameterValue }); | ||
@@ -684,2 +794,3 @@ } | ||
this.initialize(); | ||
this._log.info('listServices stream %j', request); | ||
return this.descriptors.page.listServices.createStream(this.innerApiCalls.listServices, request, callSettings); | ||
@@ -718,3 +829,2 @@ } | ||
listServicesAsync(request, options) { | ||
var _a, _b; | ||
request = request || {}; | ||
@@ -732,3 +842,3 @@ options = options || {}; | ||
if (match) { | ||
const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['location']) !== null && _b !== void 0 ? _b : fieldValue; | ||
const parameterValue = match.groups?.['location'] ?? fieldValue; | ||
Object.assign(routingParameter, { location: parameterValue }); | ||
@@ -743,2 +853,3 @@ } | ||
this.initialize(); | ||
this._log.info('listServices iterate %j', request); | ||
return this.descriptors.page.listServices.asyncIterate(this.innerApiCalls['listServices'], request, callSettings); | ||
@@ -832,3 +943,2 @@ } | ||
getOperation(request, optionsOrCallback, callback) { | ||
var _a; | ||
let options; | ||
@@ -847,3 +957,3 @@ if (typeof optionsOrCallback === 'function' && callback === undefined) { | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: (_a = request.name) !== null && _a !== void 0 ? _a : '', | ||
name: request.name ?? '', | ||
}); | ||
@@ -883,3 +993,2 @@ return this.operationsClient.getOperation(request, options, callback); | ||
listOperationsAsync(request, options) { | ||
var _a; | ||
options = options || {}; | ||
@@ -890,3 +999,3 @@ options.otherArgs = options.otherArgs || {}; | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: (_a = request.name) !== null && _a !== void 0 ? _a : '', | ||
name: request.name ?? '', | ||
}); | ||
@@ -927,3 +1036,2 @@ return this.operationsClient.listOperationsAsync(request, options); | ||
cancelOperation(request, optionsOrCallback, callback) { | ||
var _a; | ||
let options; | ||
@@ -942,3 +1050,3 @@ if (typeof optionsOrCallback === 'function' && callback === undefined) { | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: (_a = request.name) !== null && _a !== void 0 ? _a : '', | ||
name: request.name ?? '', | ||
}); | ||
@@ -973,3 +1081,2 @@ return this.operationsClient.cancelOperation(request, options, callback); | ||
deleteOperation(request, optionsOrCallback, callback) { | ||
var _a; | ||
let options; | ||
@@ -988,3 +1095,3 @@ if (typeof optionsOrCallback === 'function' && callback === undefined) { | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: (_a = request.name) !== null && _a !== void 0 ? _a : '', | ||
name: request.name ?? '', | ||
}); | ||
@@ -1335,2 +1442,3 @@ return this.operationsClient.deleteOperation(request, options, callback); | ||
return this.servicesStub.then(stub => { | ||
this._log.info('ending gRPC channel'); | ||
this._terminated = true; | ||
@@ -1337,0 +1445,0 @@ stub.close(); |
@@ -20,2 +20,3 @@ import type * as gax from 'google-gax'; | ||
private _servicePath; | ||
private _log; | ||
auth: gax.GoogleAuth; | ||
@@ -56,3 +57,3 @@ descriptors: Descriptors; | ||
* app is running in an environment which supports | ||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, | ||
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, | ||
* your project ID will be detected automatically. | ||
@@ -59,0 +60,0 @@ * @param {string} [options.apiEndpoint] - The domain name of the |
@@ -22,2 +22,3 @@ "use strict"; | ||
const jsonProtos = require("../../protos/protos.json"); | ||
const google_gax_1 = require("google-gax"); | ||
/** | ||
@@ -36,2 +37,24 @@ * Client JSON configuration object, loaded from | ||
class TasksClient { | ||
_terminated = false; | ||
_opts; | ||
_providedCustomServicePath; | ||
_gaxModule; | ||
_gaxGrpc; | ||
_protos; | ||
_defaults; | ||
_universeDomain; | ||
_servicePath; | ||
_log = google_gax_1.loggingUtils.log('run'); | ||
auth; | ||
descriptors = { | ||
page: {}, | ||
stream: {}, | ||
longrunning: {}, | ||
batching: {}, | ||
}; | ||
warn; | ||
innerApiCalls; | ||
locationsClient; | ||
pathTemplates; | ||
tasksStub; | ||
/** | ||
@@ -59,3 +82,3 @@ * Construct an instance of TasksClient. | ||
* app is running in an environment which supports | ||
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, | ||
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, | ||
* your project ID will be detected automatically. | ||
@@ -78,15 +101,7 @@ * @param {string} [options.apiEndpoint] - The domain name of the | ||
constructor(opts, gaxInstance) { | ||
var _a, _b, _c, _d, _e; | ||
this._terminated = false; | ||
this.descriptors = { | ||
page: {}, | ||
stream: {}, | ||
longrunning: {}, | ||
batching: {}, | ||
}; | ||
// Ensure that options include all the required fields. | ||
const staticMembers = this.constructor; | ||
if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) && | ||
(opts === null || opts === void 0 ? void 0 : opts.universeDomain) && | ||
(opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) { | ||
if (opts?.universe_domain && | ||
opts?.universeDomain && | ||
opts?.universe_domain !== opts?.universeDomain) { | ||
throw new Error('Please set either universe_domain or universeDomain, but not both.'); | ||
@@ -98,9 +113,13 @@ } | ||
this._universeDomain = | ||
(_c = (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com'; | ||
opts?.universeDomain ?? | ||
opts?.universe_domain ?? | ||
universeDomainEnvVar ?? | ||
'googleapis.com'; | ||
this._servicePath = 'run.' + this._universeDomain; | ||
const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath; | ||
this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint)); | ||
const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port; | ||
const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {}; | ||
const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function'); | ||
const servicePath = opts?.servicePath || opts?.apiEndpoint || this._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); | ||
@@ -283,3 +302,2 @@ // Request numeric enum values if REST transport is used. | ||
getTask(request, optionsOrCallback, callback) { | ||
var _a; | ||
request = request || {}; | ||
@@ -299,9 +317,20 @@ let options; | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: (_a = request.name) !== null && _a !== void 0 ? _a : '', | ||
name: request.name ?? '', | ||
}); | ||
this.initialize(); | ||
return this.innerApiCalls.getTask(request, options, callback); | ||
this._log.info('getTask request %j', request); | ||
const wrappedCallback = callback | ||
? (error, response, options, rawResponse) => { | ||
this._log.info('getTask response %j', response); | ||
callback(error, response, options, rawResponse); // We verified callback above. | ||
} | ||
: undefined; | ||
return this.innerApiCalls | ||
.getTask(request, options, wrappedCallback) | ||
?.then(([response, options, rawResponse]) => { | ||
this._log.info('getTask response %j', response); | ||
return [response, options, rawResponse]; | ||
}); | ||
} | ||
listTasks(request, optionsOrCallback, callback) { | ||
var _a; | ||
request = request || {}; | ||
@@ -321,6 +350,18 @@ let options; | ||
this._gaxModule.routingHeader.fromParams({ | ||
parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', | ||
parent: request.parent ?? '', | ||
}); | ||
this.initialize(); | ||
return this.innerApiCalls.listTasks(request, options, callback); | ||
const wrappedCallback = callback | ||
? (error, values, nextPageRequest, rawResponse) => { | ||
this._log.info('listTasks values %j', values); | ||
callback(error, values, nextPageRequest, rawResponse); // We verified callback above. | ||
} | ||
: undefined; | ||
this._log.info('listTasks request %j', request); | ||
return this.innerApiCalls | ||
.listTasks(request, options, wrappedCallback) | ||
?.then(([response, input, output]) => { | ||
this._log.info('listTasks values %j', response); | ||
return [response, input, output]; | ||
}); | ||
} | ||
@@ -355,3 +396,2 @@ /** | ||
listTasksStream(request, options) { | ||
var _a; | ||
request = request || {}; | ||
@@ -363,3 +403,3 @@ options = options || {}; | ||
this._gaxModule.routingHeader.fromParams({ | ||
parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', | ||
parent: request.parent ?? '', | ||
}); | ||
@@ -369,2 +409,3 @@ const defaultCallSettings = this._defaults['listTasks']; | ||
this.initialize(); | ||
this._log.info('listTasks stream %j', request); | ||
return this.descriptors.page.listTasks.createStream(this.innerApiCalls.listTasks, request, callSettings); | ||
@@ -403,3 +444,2 @@ } | ||
listTasksAsync(request, options) { | ||
var _a; | ||
request = request || {}; | ||
@@ -411,3 +451,3 @@ options = options || {}; | ||
this._gaxModule.routingHeader.fromParams({ | ||
parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', | ||
parent: request.parent ?? '', | ||
}); | ||
@@ -417,2 +457,3 @@ const defaultCallSettings = this._defaults['listTasks']; | ||
this.initialize(); | ||
this._log.info('listTasks iterate %j', request); | ||
return this.descriptors.page.listTasks.asyncIterate(this.innerApiCalls['listTasks'], request, callSettings); | ||
@@ -878,2 +919,3 @@ } | ||
return this.tasksStub.then(stub => { | ||
this._log.info('ending gRPC channel'); | ||
this._terminated = true; | ||
@@ -880,0 +922,0 @@ stub.close(); |
# Changelog | ||
## [2.0.0](https://github.com/googleapis/google-cloud-node/compare/run-v1.5.1...run-v2.0.0) (2025-03-18) | ||
### ⚠ BREAKING CHANGES | ||
* upgrade to Node 18 ([#6096](https://github.com/googleapis/google-cloud-node/issues/6096)) | ||
### Features | ||
* [Many APIs] add request/response debug logging to gapics ([b99c5f8](https://github.com/googleapis/google-cloud-node/commit/b99c5f8269a8401c72e9c913971c7e90467209e2)) | ||
### Miscellaneous Chores | ||
* Upgrade to Node 18 ([#6096](https://github.com/googleapis/google-cloud-node/issues/6096)) ([eadae64](https://github.com/googleapis/google-cloud-node/commit/eadae64d54e07aa2c65097ea52e65008d4e87436)) | ||
## [1.5.1](https://github.com/googleapis/google-cloud-node/compare/run-v1.5.0...run-v1.5.1) (2025-02-12) | ||
@@ -4,0 +20,0 @@ |
{ | ||
"name": "@google-cloud/run", | ||
"version": "1.5.1", | ||
"version": "2.0.0", | ||
"description": "Cloud Run Admin API", | ||
@@ -44,25 +44,25 @@ "repository": { | ||
"dependencies": { | ||
"google-gax": "^4.0.3" | ||
"google-gax": "^5.0.0-rc.0" | ||
}, | ||
"devDependencies": { | ||
"@types/mocha": "^10.0.0", | ||
"@types/node": "^22.0.0", | ||
"@types/sinon": "^17.0.0", | ||
"c8": "^9.0.0", | ||
"gapic-tools": "^0.4.0", | ||
"gts": "^5.0.0", | ||
"jsdoc": "^4.0.0", | ||
"@types/mocha": "^10.0.10", | ||
"@types/node": "^22.13.9", | ||
"@types/sinon": "^17.0.4", | ||
"c8": "^10.1.3", | ||
"gapic-tools": "^1.0.0", | ||
"gts": "^6.0.2", | ||
"jsdoc": "^4.0.4", | ||
"jsdoc-fresh": "^3.0.0", | ||
"jsdoc-region-tag": "^3.0.0", | ||
"linkinator": "4.1.2", | ||
"long": "^5.2.3", | ||
"mocha": "^10.0.0", | ||
"pack-n-play": "^2.0.0", | ||
"sinon": "^18.0.0", | ||
"typescript": "^5.1.6" | ||
"linkinator": "^6.1.2", | ||
"long": "^5.3.1", | ||
"mocha": "^11.1.0", | ||
"pack-n-play": "^3.0.0", | ||
"sinon": "^19.0.2", | ||
"typescript": "^5.8.2" | ||
}, | ||
"engines": { | ||
"node": ">=14.0.0" | ||
"node": ">=18" | ||
}, | ||
"homepage": "https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-run" | ||
} |
@@ -47,3 +47,3 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost." | ||
1. [Enable the Cloud Run API][enable_api]. | ||
1. [Set up authentication][auth] so you can access the | ||
1. [Set up authentication with a service account][auth] so you can access the | ||
API from your local workstation. | ||
@@ -212,2 +212,2 @@ | ||
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=run.googleapis.com | ||
[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local | ||
[auth]: https://cloud.google.com/docs/authentication/getting-started |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
4940417
0.59%50
16.28%83433
1.09%0
-100%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated