diff --git a/packages/google-storagetransfer/README.md b/packages/google-storagetransfer/README.md index 5b3744c3b50..4548db36064 100644 --- a/packages/google-storagetransfer/README.md +++ b/packages/google-storagetransfer/README.md @@ -44,7 +44,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained]. 1. [Select or create a Cloud Platform project][projects]. 1. [Enable billing for your project][billing]. 1. [Enable the Storage Transfer Service 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. ### Installing the client library @@ -205,4 +205,4 @@ See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [projects]: https://console.cloud.google.com/project [billing]: https://support.google.com/cloud/answer/6293499#enable-billing [enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=storagetransfer.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local +[auth]: https://cloud.google.com/docs/authentication/getting-started diff --git a/packages/google-storagetransfer/protos/protos.json b/packages/google-storagetransfer/protos/protos.json index 93928a93564..b9d20990fee 100644 --- a/packages/google-storagetransfer/protos/protos.json +++ b/packages/google-storagetransfer/protos/protos.json @@ -1,7 +1,4 @@ { - "options": { - "syntax": "proto3" - }, "nested": { "google": { "nested": { diff --git a/packages/google-storagetransfer/src/v1/storage_transfer_service_client.ts b/packages/google-storagetransfer/src/v1/storage_transfer_service_client.ts index 5c3d8a84303..e6ef8d3d72b 100644 --- a/packages/google-storagetransfer/src/v1/storage_transfer_service_client.ts +++ b/packages/google-storagetransfer/src/v1/storage_transfer_service_client.ts @@ -31,6 +31,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); +import {loggingUtils as logging} from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -57,6 +58,8 @@ export class StorageTransferServiceClient { private _defaults: {[method: string]: gax.CallSettings}; private _universeDomain: string; private _servicePath: string; + private _log = logging.log('storage-transfer'); + auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -92,7 +95,7 @@ export class StorageTransferServiceClient { * 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}, + * {@link https://cloud.google.com/docs/authentication/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. @@ -554,11 +557,36 @@ export class StorageTransferServiceClient { project_id: request.projectId ?? '', }); this.initialize(); - return this.innerApiCalls.getGoogleServiceAccount( - request, - options, - callback - ); + this._log.info('getGoogleServiceAccount request %j', request); + const wrappedCallback: + | Callback< + protos.google.storagetransfer.v1.IGoogleServiceAccount, + | protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getGoogleServiceAccount response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getGoogleServiceAccount(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.storagetransfer.v1.IGoogleServiceAccount, + ( + | protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getGoogleServiceAccount response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Creates a transfer job that runs periodically. @@ -644,7 +672,36 @@ export class StorageTransferServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; this.initialize(); - return this.innerApiCalls.createTransferJob(request, options, callback); + this._log.info('createTransferJob request %j', request); + const wrappedCallback: + | Callback< + protos.google.storagetransfer.v1.ITransferJob, + | protos.google.storagetransfer.v1.ICreateTransferJobRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createTransferJob response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .createTransferJob(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.storagetransfer.v1.ITransferJob, + ( + | protos.google.storagetransfer.v1.ICreateTransferJobRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createTransferJob response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Updates a transfer job. Updating a job's transfer spec does not affect @@ -769,7 +826,36 @@ export class StorageTransferServiceClient { job_name: request.jobName ?? '', }); this.initialize(); - return this.innerApiCalls.updateTransferJob(request, options, callback); + this._log.info('updateTransferJob request %j', request); + const wrappedCallback: + | Callback< + protos.google.storagetransfer.v1.ITransferJob, + | protos.google.storagetransfer.v1.IUpdateTransferJobRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('updateTransferJob response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .updateTransferJob(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.storagetransfer.v1.ITransferJob, + ( + | protos.google.storagetransfer.v1.IUpdateTransferJobRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('updateTransferJob response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Gets a transfer job. @@ -862,7 +948,33 @@ export class StorageTransferServiceClient { job_name: request.jobName ?? '', }); this.initialize(); - return this.innerApiCalls.getTransferJob(request, options, callback); + this._log.info('getTransferJob request %j', request); + const wrappedCallback: + | Callback< + protos.google.storagetransfer.v1.ITransferJob, + | protos.google.storagetransfer.v1.IGetTransferJobRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getTransferJob response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getTransferJob(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.storagetransfer.v1.ITransferJob, + protos.google.storagetransfer.v1.IGetTransferJobRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getTransferJob response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Pauses a transfer operation. @@ -958,11 +1070,36 @@ export class StorageTransferServiceClient { name: request.name ?? '', }); this.initialize(); - return this.innerApiCalls.pauseTransferOperation( - request, - options, - callback - ); + this._log.info('pauseTransferOperation request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.storagetransfer.v1.IPauseTransferOperationRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('pauseTransferOperation response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .pauseTransferOperation(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.storagetransfer.v1.IPauseTransferOperationRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('pauseTransferOperation response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Resumes a transfer operation that is paused. @@ -1058,11 +1195,36 @@ export class StorageTransferServiceClient { name: request.name ?? '', }); this.initialize(); - return this.innerApiCalls.resumeTransferOperation( - request, - options, - callback - ); + this._log.info('resumeTransferOperation request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.storagetransfer.v1.IResumeTransferOperationRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('resumeTransferOperation response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .resumeTransferOperation(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.storagetransfer.v1.IResumeTransferOperationRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('resumeTransferOperation response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Deletes a transfer job. Deleting a transfer job sets its status to @@ -1156,7 +1318,36 @@ export class StorageTransferServiceClient { job_name: request.jobName ?? '', }); this.initialize(); - return this.innerApiCalls.deleteTransferJob(request, options, callback); + this._log.info('deleteTransferJob request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.storagetransfer.v1.IDeleteTransferJobRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteTransferJob response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deleteTransferJob(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.storagetransfer.v1.IDeleteTransferJobRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('deleteTransferJob response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Creates an agent pool resource. @@ -1263,7 +1454,33 @@ export class StorageTransferServiceClient { project_id: request.projectId ?? '', }); this.initialize(); - return this.innerApiCalls.createAgentPool(request, options, callback); + this._log.info('createAgentPool request %j', request); + const wrappedCallback: + | Callback< + protos.google.storagetransfer.v1.IAgentPool, + | protos.google.storagetransfer.v1.ICreateAgentPoolRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createAgentPool response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .createAgentPool(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.ICreateAgentPoolRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createAgentPool response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Updates an existing agent pool resource. @@ -1371,7 +1588,33 @@ export class StorageTransferServiceClient { 'agent_pool.name': request.agentPool!.name ?? '', }); this.initialize(); - return this.innerApiCalls.updateAgentPool(request, options, callback); + this._log.info('updateAgentPool request %j', request); + const wrappedCallback: + | Callback< + protos.google.storagetransfer.v1.IAgentPool, + | protos.google.storagetransfer.v1.IUpdateAgentPoolRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('updateAgentPool response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .updateAgentPool(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IUpdateAgentPoolRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateAgentPool response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Gets an agent pool. @@ -1455,7 +1698,33 @@ export class StorageTransferServiceClient { name: request.name ?? '', }); this.initialize(); - return this.innerApiCalls.getAgentPool(request, options, callback); + this._log.info('getAgentPool request %j', request); + const wrappedCallback: + | Callback< + protos.google.storagetransfer.v1.IAgentPool, + | protos.google.storagetransfer.v1.IGetAgentPoolRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getAgentPool response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getAgentPool(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.storagetransfer.v1.IAgentPool, + protos.google.storagetransfer.v1.IGetAgentPoolRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getAgentPool response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Deletes an agent pool. @@ -1545,7 +1814,33 @@ export class StorageTransferServiceClient { name: request.name ?? '', }); this.initialize(); - return this.innerApiCalls.deleteAgentPool(request, options, callback); + this._log.info('deleteAgentPool request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.storagetransfer.v1.IDeleteAgentPoolRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteAgentPool response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deleteAgentPool(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.IDeleteAgentPoolRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteAgentPool response %j', response); + return [response, options, rawResponse]; + } + ); } /** @@ -1654,7 +1949,37 @@ export class StorageTransferServiceClient { job_name: request.jobName ?? '', }); this.initialize(); - return this.innerApiCalls.runTransferJob(request, options, callback); + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.ITransferOperation + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('runTransferJob response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('runTransferJob request %j', request); + return this.innerApiCalls + .runTransferJob(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.storagetransfer.v1.ITransferOperation + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('runTransferJob response %j', rawResponse); + return [response, rawResponse, _]; + } + ); } /** * Check the status of the long running operation returned by `runTransferJob()`. @@ -1675,6 +2000,7 @@ export class StorageTransferServiceClient { protos.google.storagetransfer.v1.TransferOperation > > { + this._log.info('runTransferJob long-running'); const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( {name} @@ -1807,7 +2133,33 @@ export class StorageTransferServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; this.initialize(); - return this.innerApiCalls.listTransferJobs(request, options, callback); + const wrappedCallback: + | PaginationCallback< + protos.google.storagetransfer.v1.IListTransferJobsRequest, + | protos.google.storagetransfer.v1.IListTransferJobsResponse + | null + | undefined, + protos.google.storagetransfer.v1.ITransferJob + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listTransferJobs values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listTransferJobs request %j', request); + return this.innerApiCalls + .listTransferJobs(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.storagetransfer.v1.ITransferJob[], + protos.google.storagetransfer.v1.IListTransferJobsRequest | null, + protos.google.storagetransfer.v1.IListTransferJobsResponse, + ]) => { + this._log.info('listTransferJobs values %j', response); + return [response, input, output]; + } + ); } /** @@ -1868,6 +2220,7 @@ export class StorageTransferServiceClient { const defaultCallSettings = this._defaults['listTransferJobs']; const callSettings = defaultCallSettings.merge(options); this.initialize(); + this._log.info('listTransferJobs stream %j', request); return this.descriptors.page.listTransferJobs.createStream( this.innerApiCalls.listTransferJobs as GaxCall, request, @@ -1936,6 +2289,7 @@ export class StorageTransferServiceClient { const defaultCallSettings = this._defaults['listTransferJobs']; const callSettings = defaultCallSettings.merge(options); this.initialize(); + this._log.info('listTransferJobs iterate %j', request); return this.descriptors.page.listTransferJobs.asyncIterate( this.innerApiCalls['listTransferJobs'] as GaxCall, request as {}, @@ -2046,7 +2400,33 @@ export class StorageTransferServiceClient { project_id: request.projectId ?? '', }); this.initialize(); - return this.innerApiCalls.listAgentPools(request, options, callback); + const wrappedCallback: + | PaginationCallback< + protos.google.storagetransfer.v1.IListAgentPoolsRequest, + | protos.google.storagetransfer.v1.IListAgentPoolsResponse + | null + | undefined, + protos.google.storagetransfer.v1.IAgentPool + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listAgentPools values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listAgentPools request %j', request); + return this.innerApiCalls + .listAgentPools(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.storagetransfer.v1.IAgentPool[], + protos.google.storagetransfer.v1.IListAgentPoolsRequest | null, + protos.google.storagetransfer.v1.IListAgentPoolsResponse, + ]) => { + this._log.info('listAgentPools values %j', response); + return [response, input, output]; + } + ); } /** @@ -2094,6 +2474,7 @@ export class StorageTransferServiceClient { const defaultCallSettings = this._defaults['listAgentPools']; const callSettings = defaultCallSettings.merge(options); this.initialize(); + this._log.info('listAgentPools stream %j', request); return this.descriptors.page.listAgentPools.createStream( this.innerApiCalls.listAgentPools as GaxCall, request, @@ -2149,6 +2530,7 @@ export class StorageTransferServiceClient { const defaultCallSettings = this._defaults['listAgentPools']; const callSettings = defaultCallSettings.merge(options); this.initialize(); + this._log.info('listAgentPools iterate %j', request); return this.descriptors.page.listAgentPools.asyncIterate( this.innerApiCalls['listAgentPools'] as GaxCall, request as {}, @@ -2430,6 +2812,7 @@ export class StorageTransferServiceClient { close(): Promise { if (this.storageTransferServiceStub && !this._terminated) { return this.storageTransferServiceStub.then(stub => { + this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-storagetransfer/tsconfig.json b/packages/google-storagetransfer/tsconfig.json index 8c2c889a70c..860d6bf027b 100644 --- a/packages/google-storagetransfer/tsconfig.json +++ b/packages/google-storagetransfer/tsconfig.json @@ -18,4 +18,4 @@ "src/**/*.json", "protos/protos.json" ] -} \ No newline at end of file +} diff --git a/packages/google-streetview-publish/README.md b/packages/google-streetview-publish/README.md index 839c01815e3..ee12a423f87 100644 --- a/packages/google-streetview-publish/README.md +++ b/packages/google-streetview-publish/README.md @@ -208,4 +208,4 @@ See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [projects]: https://console.cloud.google.com/project [billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local +[auth]: https://cloud.google.com/docs/authentication/getting-started diff --git a/packages/google-streetview-publish/protos/protos.json b/packages/google-streetview-publish/protos/protos.json index 02b865e6f4c..f689694b398 100644 --- a/packages/google-streetview-publish/protos/protos.json +++ b/packages/google-streetview-publish/protos/protos.json @@ -1,7 +1,4 @@ { - "options": { - "syntax": "proto3" - }, "nested": { "google": { "nested": { diff --git a/packages/google-streetview-publish/src/v1/street_view_publish_service_client.ts b/packages/google-streetview-publish/src/v1/street_view_publish_service_client.ts index 25237d59675..3da62d85be4 100644 --- a/packages/google-streetview-publish/src/v1/street_view_publish_service_client.ts +++ b/packages/google-streetview-publish/src/v1/street_view_publish_service_client.ts @@ -31,6 +31,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); +import {loggingUtils as logging} from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -55,6 +56,8 @@ export class StreetViewPublishServiceClient { private _defaults: {[method: string]: gax.CallSettings}; private _universeDomain: string; private _servicePath: string; + private _log = logging.log('streetview-publish'); + auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -89,7 +92,7 @@ export class StreetViewPublishServiceClient { * 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}, + * {@link https://cloud.google.com/docs/authentication/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. @@ -530,7 +533,31 @@ export class StreetViewPublishServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; this.initialize(); - return this.innerApiCalls.startUpload(request, options, callback); + this._log.info('startUpload request %j', request); + const wrappedCallback: + | Callback< + protos.google.streetview.publish.v1.IUploadRef, + protos.google.protobuf.IEmpty | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('startUpload response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .startUpload(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.streetview.publish.v1.IUploadRef, + protos.google.protobuf.IEmpty | undefined, + {} | undefined, + ]) => { + this._log.info('startUpload response %j', response); + return [response, options, rawResponse]; + } + ); } /** * After the client finishes uploading the photo with the returned @@ -635,7 +662,33 @@ export class StreetViewPublishServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; this.initialize(); - return this.innerApiCalls.createPhoto(request, options, callback); + this._log.info('createPhoto request %j', request); + const wrappedCallback: + | Callback< + protos.google.streetview.publish.v1.IPhoto, + | protos.google.streetview.publish.v1.ICreatePhotoRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createPhoto response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .createPhoto(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.streetview.publish.v1.IPhoto, + protos.google.streetview.publish.v1.ICreatePhotoRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createPhoto response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Gets the metadata of the specified @@ -740,7 +793,33 @@ export class StreetViewPublishServiceClient { photo_id: request.photoId ?? '', }); this.initialize(); - return this.innerApiCalls.getPhoto(request, options, callback); + this._log.info('getPhoto request %j', request); + const wrappedCallback: + | Callback< + protos.google.streetview.publish.v1.IPhoto, + | protos.google.streetview.publish.v1.IGetPhotoRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getPhoto response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getPhoto(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.streetview.publish.v1.IPhoto, + protos.google.streetview.publish.v1.IGetPhotoRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getPhoto response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Gets the metadata of the specified @@ -852,7 +931,36 @@ export class StreetViewPublishServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; this.initialize(); - return this.innerApiCalls.batchGetPhotos(request, options, callback); + this._log.info('batchGetPhotos request %j', request); + const wrappedCallback: + | Callback< + protos.google.streetview.publish.v1.IBatchGetPhotosResponse, + | protos.google.streetview.publish.v1.IBatchGetPhotosRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('batchGetPhotos response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .batchGetPhotos(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.streetview.publish.v1.IBatchGetPhotosResponse, + ( + | protos.google.streetview.publish.v1.IBatchGetPhotosRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('batchGetPhotos response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Updates the metadata of a {@link protos.google.streetview.publish.v1.Photo|Photo}, such @@ -989,7 +1097,33 @@ export class StreetViewPublishServiceClient { 'photo.photo_id.id': request.photo!.photoId!.id ?? '', }); this.initialize(); - return this.innerApiCalls.updatePhoto(request, options, callback); + this._log.info('updatePhoto request %j', request); + const wrappedCallback: + | Callback< + protos.google.streetview.publish.v1.IPhoto, + | protos.google.streetview.publish.v1.IUpdatePhotoRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('updatePhoto response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .updatePhoto(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.streetview.publish.v1.IPhoto, + protos.google.streetview.publish.v1.IUpdatePhotoRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updatePhoto response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Updates the metadata of {@link protos.google.streetview.publish.v1.Photo|Photos}, such @@ -1108,7 +1242,36 @@ export class StreetViewPublishServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; this.initialize(); - return this.innerApiCalls.batchUpdatePhotos(request, options, callback); + this._log.info('batchUpdatePhotos request %j', request); + const wrappedCallback: + | Callback< + protos.google.streetview.publish.v1.IBatchUpdatePhotosResponse, + | protos.google.streetview.publish.v1.IBatchUpdatePhotosRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('batchUpdatePhotos response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .batchUpdatePhotos(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.streetview.publish.v1.IBatchUpdatePhotosResponse, + ( + | protos.google.streetview.publish.v1.IBatchUpdatePhotosRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('batchUpdatePhotos response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Deletes a {@link protos.google.streetview.publish.v1.Photo|Photo} and its metadata. @@ -1205,7 +1368,33 @@ export class StreetViewPublishServiceClient { photo_id: request.photoId ?? '', }); this.initialize(); - return this.innerApiCalls.deletePhoto(request, options, callback); + this._log.info('deletePhoto request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.streetview.publish.v1.IDeletePhotoRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deletePhoto response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deletePhoto(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.streetview.publish.v1.IDeletePhotoRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deletePhoto response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Deletes a list of {@link protos.google.streetview.publish.v1.Photo|Photos} and their @@ -1308,7 +1497,36 @@ export class StreetViewPublishServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; this.initialize(); - return this.innerApiCalls.batchDeletePhotos(request, options, callback); + this._log.info('batchDeletePhotos request %j', request); + const wrappedCallback: + | Callback< + protos.google.streetview.publish.v1.IBatchDeletePhotosResponse, + | protos.google.streetview.publish.v1.IBatchDeletePhotosRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('batchDeletePhotos response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .batchDeletePhotos(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.streetview.publish.v1.IBatchDeletePhotosResponse, + ( + | protos.google.streetview.publish.v1.IBatchDeletePhotosRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('batchDeletePhotos response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Creates an upload session to start uploading photo sequence data. @@ -1393,11 +1611,31 @@ export class StreetViewPublishServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; this.initialize(); - return this.innerApiCalls.startPhotoSequenceUpload( - request, - options, - callback - ); + this._log.info('startPhotoSequenceUpload request %j', request); + const wrappedCallback: + | Callback< + protos.google.streetview.publish.v1.IUploadRef, + protos.google.protobuf.IEmpty | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('startPhotoSequenceUpload response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .startPhotoSequenceUpload(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.streetview.publish.v1.IUploadRef, + protos.google.protobuf.IEmpty | undefined, + {} | undefined, + ]) => { + this._log.info('startPhotoSequenceUpload response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Deletes a {@link protos.google.streetview.publish.v1.PhotoSequence|PhotoSequence} and @@ -1504,7 +1742,36 @@ export class StreetViewPublishServiceClient { sequence_id: request.sequenceId ?? '', }); this.initialize(); - return this.innerApiCalls.deletePhotoSequence(request, options, callback); + this._log.info('deletePhotoSequence request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.streetview.publish.v1.IDeletePhotoSequenceRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deletePhotoSequence response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deletePhotoSequence(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.streetview.publish.v1.IDeletePhotoSequenceRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('deletePhotoSequence response %j', response); + return [response, options, rawResponse]; + } + ); } /** @@ -1624,7 +1891,37 @@ export class StreetViewPublishServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; this.initialize(); - return this.innerApiCalls.createPhotoSequence(request, options, callback); + const wrappedCallback: + | Callback< + LROperation< + protos.google.streetview.publish.v1.IPhotoSequence, + protos.google.protobuf.IEmpty + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('createPhotoSequence response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('createPhotoSequence request %j', request); + return this.innerApiCalls + .createPhotoSequence(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.streetview.publish.v1.IPhotoSequence, + protos.google.protobuf.IEmpty + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createPhotoSequence response %j', rawResponse); + return [response, rawResponse, _]; + } + ); } /** * Check the status of the long running operation returned by `createPhotoSequence()`. @@ -1645,6 +1942,7 @@ export class StreetViewPublishServiceClient { protos.google.protobuf.Empty > > { + this._log.info('createPhotoSequence long-running'); const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( {name} @@ -1791,7 +2089,37 @@ export class StreetViewPublishServiceClient { sequence_id: request.sequenceId ?? '', }); this.initialize(); - return this.innerApiCalls.getPhotoSequence(request, options, callback); + const wrappedCallback: + | Callback< + LROperation< + protos.google.streetview.publish.v1.IPhotoSequence, + protos.google.protobuf.IEmpty + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('getPhotoSequence response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('getPhotoSequence request %j', request); + return this.innerApiCalls + .getPhotoSequence(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.streetview.publish.v1.IPhotoSequence, + protos.google.protobuf.IEmpty + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('getPhotoSequence response %j', rawResponse); + return [response, rawResponse, _]; + } + ); } /** * Check the status of the long running operation returned by `getPhotoSequence()`. @@ -1812,6 +2140,7 @@ export class StreetViewPublishServiceClient { protos.google.protobuf.Empty > > { + this._log.info('getPhotoSequence long-running'); const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( {name} @@ -1944,7 +2273,33 @@ export class StreetViewPublishServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; this.initialize(); - return this.innerApiCalls.listPhotos(request, options, callback); + const wrappedCallback: + | PaginationCallback< + protos.google.streetview.publish.v1.IListPhotosRequest, + | protos.google.streetview.publish.v1.IListPhotosResponse + | null + | undefined, + protos.google.streetview.publish.v1.IPhoto + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listPhotos values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listPhotos request %j', request); + return this.innerApiCalls + .listPhotos(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.streetview.publish.v1.IPhoto[], + protos.google.streetview.publish.v1.IListPhotosRequest | null, + protos.google.streetview.publish.v1.IListPhotosResponse, + ]) => { + this._log.info('listPhotos values %j', response); + return [response, input, output]; + } + ); } /** @@ -2001,6 +2356,7 @@ export class StreetViewPublishServiceClient { const defaultCallSettings = this._defaults['listPhotos']; const callSettings = defaultCallSettings.merge(options); this.initialize(); + this._log.info('listPhotos stream %j', request); return this.descriptors.page.listPhotos.createStream( this.innerApiCalls.listPhotos as GaxCall, request, @@ -2065,6 +2421,7 @@ export class StreetViewPublishServiceClient { const defaultCallSettings = this._defaults['listPhotos']; const callSettings = defaultCallSettings.merge(options); this.initialize(); + this._log.info('listPhotos iterate %j', request); return this.descriptors.page.listPhotos.asyncIterate( this.innerApiCalls['listPhotos'] as GaxCall, request as {}, @@ -2180,7 +2537,33 @@ export class StreetViewPublishServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; this.initialize(); - return this.innerApiCalls.listPhotoSequences(request, options, callback); + const wrappedCallback: + | PaginationCallback< + protos.google.streetview.publish.v1.IListPhotoSequencesRequest, + | protos.google.streetview.publish.v1.IListPhotoSequencesResponse + | null + | undefined, + protos.google.longrunning.IOperation + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listPhotoSequences values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listPhotoSequences request %j', request); + return this.innerApiCalls + .listPhotoSequences(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.longrunning.IOperation[], + protos.google.streetview.publish.v1.IListPhotoSequencesRequest | null, + protos.google.streetview.publish.v1.IListPhotoSequencesResponse, + ]) => { + this._log.info('listPhotoSequences values %j', response); + return [response, input, output]; + } + ); } /** @@ -2232,6 +2615,7 @@ export class StreetViewPublishServiceClient { const defaultCallSettings = this._defaults['listPhotoSequences']; const callSettings = defaultCallSettings.merge(options); this.initialize(); + this._log.info('listPhotoSequences stream %j', request); return this.descriptors.page.listPhotoSequences.createStream( this.innerApiCalls.listPhotoSequences as GaxCall, request, @@ -2291,6 +2675,7 @@ export class StreetViewPublishServiceClient { const defaultCallSettings = this._defaults['listPhotoSequences']; const callSettings = defaultCallSettings.merge(options); this.initialize(); + this._log.info('listPhotoSequences iterate %j', request); return this.descriptors.page.listPhotoSequences.asyncIterate( this.innerApiCalls['listPhotoSequences'] as GaxCall, request as {}, @@ -2307,6 +2692,7 @@ export class StreetViewPublishServiceClient { close(): Promise { if (this.streetViewPublishServiceStub && !this._terminated) { return this.streetViewPublishServiceStub.then(stub => { + this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-streetview-publish/tsconfig.json b/packages/google-streetview-publish/tsconfig.json index 8c2c889a70c..860d6bf027b 100644 --- a/packages/google-streetview-publish/tsconfig.json +++ b/packages/google-streetview-publish/tsconfig.json @@ -18,4 +18,4 @@ "src/**/*.json", "protos/protos.json" ] -} \ No newline at end of file +} diff --git a/packages/grafeas/README.md b/packages/grafeas/README.md index 0a9864b76ca..8ad5073701d 100644 --- a/packages/grafeas/README.md +++ b/packages/grafeas/README.md @@ -43,7 +43,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained]. 1. [Select or create a Cloud Platform project][projects]. 1. [Enable the Grafeas 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. ### Installing the client library @@ -172,4 +172,4 @@ See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [projects]: https://console.cloud.google.com/project [billing]: https://support.google.com/cloud/answer/6293499#enable-billing [enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=containeranalysis.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local +[auth]: https://cloud.google.com/docs/authentication/getting-started diff --git a/packages/grafeas/protos/protos.json b/packages/grafeas/protos/protos.json index 83ba3e57b70..a60b967ec7a 100644 --- a/packages/grafeas/protos/protos.json +++ b/packages/grafeas/protos/protos.json @@ -1,7 +1,4 @@ { - "options": { - "syntax": "proto3" - }, "nested": { "grafeas": { "nested": { diff --git a/packages/grafeas/src/v1/grafeas_client.ts b/packages/grafeas/src/v1/grafeas_client.ts index 559cc59df76..ae89ba5e2f3 100644 --- a/packages/grafeas/src/v1/grafeas_client.ts +++ b/packages/grafeas/src/v1/grafeas_client.ts @@ -29,6 +29,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); +import {loggingUtils as logging} from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -66,6 +67,8 @@ export class GrafeasClient { private _defaults: {[method: string]: gax.CallSettings}; private _universeDomain: string; private _servicePath: string; + private _log = logging.log('grafeas'); + auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -100,7 +103,7 @@ export class GrafeasClient { * 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}, + * {@link https://cloud.google.com/docs/authentication/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. @@ -501,7 +504,31 @@ export class GrafeasClient { name: request.name ?? '', }); this.initialize(); - return this.innerApiCalls.getOccurrence(request, options, callback); + this._log.info('getOccurrence request %j', request); + const wrappedCallback: + | Callback< + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.IGetOccurrenceRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getOccurrence response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getOccurrence(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.IGetOccurrenceRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getOccurrence response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Deletes the specified occurrence. For example, use this method to delete an @@ -586,7 +613,31 @@ export class GrafeasClient { name: request.name ?? '', }); this.initialize(); - return this.innerApiCalls.deleteOccurrence(request, options, callback); + this._log.info('deleteOccurrence request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + protos.grafeas.v1.IDeleteOccurrenceRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteOccurrence response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deleteOccurrence(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.grafeas.v1.IDeleteOccurrenceRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteOccurrence response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Creates a new occurrence. @@ -671,7 +722,31 @@ export class GrafeasClient { parent: request.parent ?? '', }); this.initialize(); - return this.innerApiCalls.createOccurrence(request, options, callback); + this._log.info('createOccurrence request %j', request); + const wrappedCallback: + | Callback< + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.ICreateOccurrenceRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createOccurrence response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .createOccurrence(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.ICreateOccurrenceRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createOccurrence response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Creates new occurrences in batch. @@ -756,11 +831,31 @@ export class GrafeasClient { parent: request.parent ?? '', }); this.initialize(); - return this.innerApiCalls.batchCreateOccurrences( - request, - options, - callback - ); + this._log.info('batchCreateOccurrences request %j', request); + const wrappedCallback: + | Callback< + protos.grafeas.v1.IBatchCreateOccurrencesResponse, + protos.grafeas.v1.IBatchCreateOccurrencesRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('batchCreateOccurrences response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .batchCreateOccurrences(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.grafeas.v1.IBatchCreateOccurrencesResponse, + protos.grafeas.v1.IBatchCreateOccurrencesRequest | undefined, + {} | undefined, + ]) => { + this._log.info('batchCreateOccurrences response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Updates the specified occurrence. @@ -847,7 +942,31 @@ export class GrafeasClient { name: request.name ?? '', }); this.initialize(); - return this.innerApiCalls.updateOccurrence(request, options, callback); + this._log.info('updateOccurrence request %j', request); + const wrappedCallback: + | Callback< + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.IUpdateOccurrenceRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('updateOccurrence response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .updateOccurrence(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.grafeas.v1.IOccurrence, + protos.grafeas.v1.IUpdateOccurrenceRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateOccurrence response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Gets the note attached to the specified occurrence. Consumer projects can @@ -931,7 +1050,31 @@ export class GrafeasClient { name: request.name ?? '', }); this.initialize(); - return this.innerApiCalls.getOccurrenceNote(request, options, callback); + this._log.info('getOccurrenceNote request %j', request); + const wrappedCallback: + | Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.IGetOccurrenceNoteRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getOccurrenceNote response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getOccurrenceNote(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.grafeas.v1.INote, + protos.grafeas.v1.IGetOccurrenceNoteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getOccurrenceNote response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Gets the specified note. @@ -1014,7 +1157,31 @@ export class GrafeasClient { name: request.name ?? '', }); this.initialize(); - return this.innerApiCalls.getNote(request, options, callback); + this._log.info('getNote request %j', request); + const wrappedCallback: + | Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.IGetNoteRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getNote response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getNote(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.grafeas.v1.INote, + protos.grafeas.v1.IGetNoteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getNote response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Deletes the specified note. @@ -1097,7 +1264,31 @@ export class GrafeasClient { name: request.name ?? '', }); this.initialize(); - return this.innerApiCalls.deleteNote(request, options, callback); + this._log.info('deleteNote request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + protos.grafeas.v1.IDeleteNoteRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteNote response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deleteNote(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.grafeas.v1.IDeleteNoteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteNote response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Creates a new note. @@ -1184,7 +1375,31 @@ export class GrafeasClient { parent: request.parent ?? '', }); this.initialize(); - return this.innerApiCalls.createNote(request, options, callback); + this._log.info('createNote request %j', request); + const wrappedCallback: + | Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.ICreateNoteRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createNote response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .createNote(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.grafeas.v1.INote, + protos.grafeas.v1.ICreateNoteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createNote response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Creates new notes in batch. @@ -1269,7 +1484,31 @@ export class GrafeasClient { parent: request.parent ?? '', }); this.initialize(); - return this.innerApiCalls.batchCreateNotes(request, options, callback); + this._log.info('batchCreateNotes request %j', request); + const wrappedCallback: + | Callback< + protos.grafeas.v1.IBatchCreateNotesResponse, + protos.grafeas.v1.IBatchCreateNotesRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('batchCreateNotes response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .batchCreateNotes(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.grafeas.v1.IBatchCreateNotesResponse, + protos.grafeas.v1.IBatchCreateNotesRequest | undefined, + {} | undefined, + ]) => { + this._log.info('batchCreateNotes response %j', response); + return [response, options, rawResponse]; + } + ); } /** * Updates the specified note. @@ -1356,7 +1595,31 @@ export class GrafeasClient { name: request.name ?? '', }); this.initialize(); - return this.innerApiCalls.updateNote(request, options, callback); + this._log.info('updateNote request %j', request); + const wrappedCallback: + | Callback< + protos.grafeas.v1.INote, + protos.grafeas.v1.IUpdateNoteRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('updateNote response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .updateNote(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.grafeas.v1.INote, + protos.grafeas.v1.IUpdateNoteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateNote response %j', response); + return [response, options, rawResponse]; + } + ); } /** @@ -1450,11 +1713,35 @@ export class GrafeasClient { parent: request.parent ?? '', }); this.initialize(); - return this.innerApiCalls.listOccurrences(request, options, callback); + const wrappedCallback: + | PaginationCallback< + protos.grafeas.v1.IListOccurrencesRequest, + protos.grafeas.v1.IListOccurrencesResponse | null | undefined, + protos.grafeas.v1.IOccurrence + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listOccurrences values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listOccurrences request %j', request); + return this.innerApiCalls + .listOccurrences(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.grafeas.v1.IOccurrence[], + protos.grafeas.v1.IListOccurrencesRequest | null, + protos.grafeas.v1.IListOccurrencesResponse, + ]) => { + this._log.info('listOccurrences values %j', response); + return [response, input, output]; + } + ); } /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * Equivalent to `listOccurrences`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -1493,6 +1780,7 @@ export class GrafeasClient { const defaultCallSettings = this._defaults['listOccurrences']; const callSettings = defaultCallSettings.merge(options); this.initialize(); + this._log.info('listOccurrences stream %j', request); return this.descriptors.page.listOccurrences.createStream( this.innerApiCalls.listOccurrences as GaxCall, request, @@ -1543,6 +1831,7 @@ export class GrafeasClient { const defaultCallSettings = this._defaults['listOccurrences']; const callSettings = defaultCallSettings.merge(options); this.initialize(); + this._log.info('listOccurrences iterate %j', request); return this.descriptors.page.listOccurrences.asyncIterate( this.innerApiCalls['listOccurrences'] as GaxCall, request as {}, @@ -1640,11 +1929,35 @@ export class GrafeasClient { parent: request.parent ?? '', }); this.initialize(); - return this.innerApiCalls.listNotes(request, options, callback); + const wrappedCallback: + | PaginationCallback< + protos.grafeas.v1.IListNotesRequest, + protos.grafeas.v1.IListNotesResponse | null | undefined, + protos.grafeas.v1.INote + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listNotes values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listNotes request %j', request); + return this.innerApiCalls + .listNotes(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.grafeas.v1.INote[], + protos.grafeas.v1.IListNotesRequest | null, + protos.grafeas.v1.IListNotesResponse, + ]) => { + this._log.info('listNotes values %j', response); + return [response, input, output]; + } + ); } /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * Equivalent to `listNotes`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -1683,6 +1996,7 @@ export class GrafeasClient { const defaultCallSettings = this._defaults['listNotes']; const callSettings = defaultCallSettings.merge(options); this.initialize(); + this._log.info('listNotes stream %j', request); return this.descriptors.page.listNotes.createStream( this.innerApiCalls.listNotes as GaxCall, request, @@ -1733,6 +2047,7 @@ export class GrafeasClient { const defaultCallSettings = this._defaults['listNotes']; const callSettings = defaultCallSettings.merge(options); this.initialize(); + this._log.info('listNotes iterate %j', request); return this.descriptors.page.listNotes.asyncIterate( this.innerApiCalls['listNotes'] as GaxCall, request as {}, @@ -1831,11 +2146,35 @@ export class GrafeasClient { name: request.name ?? '', }); this.initialize(); - return this.innerApiCalls.listNoteOccurrences(request, options, callback); + const wrappedCallback: + | PaginationCallback< + protos.grafeas.v1.IListNoteOccurrencesRequest, + protos.grafeas.v1.IListNoteOccurrencesResponse | null | undefined, + protos.grafeas.v1.IOccurrence + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listNoteOccurrences values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listNoteOccurrences request %j', request); + return this.innerApiCalls + .listNoteOccurrences(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.grafeas.v1.IOccurrence[], + protos.grafeas.v1.IListNoteOccurrencesRequest | null, + protos.grafeas.v1.IListNoteOccurrencesResponse, + ]) => { + this._log.info('listNoteOccurrences values %j', response); + return [response, input, output]; + } + ); } /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * Equivalent to `listNoteOccurrences`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.name @@ -1873,6 +2212,7 @@ export class GrafeasClient { const defaultCallSettings = this._defaults['listNoteOccurrences']; const callSettings = defaultCallSettings.merge(options); this.initialize(); + this._log.info('listNoteOccurrences stream %j', request); return this.descriptors.page.listNoteOccurrences.createStream( this.innerApiCalls.listNoteOccurrences as GaxCall, request, @@ -1922,6 +2262,7 @@ export class GrafeasClient { const defaultCallSettings = this._defaults['listNoteOccurrences']; const callSettings = defaultCallSettings.merge(options); this.initialize(); + this._log.info('listNoteOccurrences iterate %j', request); return this.descriptors.page.listNoteOccurrences.asyncIterate( this.innerApiCalls['listNoteOccurrences'] as GaxCall, request as {}, @@ -2038,6 +2379,7 @@ export class GrafeasClient { close(): Promise { if (this.grafeasStub && !this._terminated) { return this.grafeasStub.then(stub => { + this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); }); diff --git a/packages/grafeas/test/gapic_grafeas_v1.ts b/packages/grafeas/test/gapic_grafeas_v1.ts index 089922393ae..51bfb1daf65 100644 --- a/packages/grafeas/test/gapic_grafeas_v1.ts +++ b/packages/grafeas/test/gapic_grafeas_v1.ts @@ -321,7 +321,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.grafeas.v1.Occurrence() ); @@ -352,7 +352,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.grafeas.v1.Occurrence() ); @@ -399,7 +399,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.getOccurrence = stubSimpleCall( undefined, @@ -451,7 +451,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -482,7 +482,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -529,7 +529,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteOccurrence = stubSimpleCall( undefined, @@ -581,7 +581,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.grafeas.v1.Occurrence() ); @@ -612,7 +612,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.grafeas.v1.Occurrence() ); @@ -659,7 +659,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.createOccurrence = stubSimpleCall( undefined, @@ -711,7 +711,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.grafeas.v1.BatchCreateOccurrencesResponse() ); @@ -743,7 +743,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.grafeas.v1.BatchCreateOccurrencesResponse() ); @@ -790,7 +790,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.batchCreateOccurrences = stubSimpleCall( undefined, @@ -848,7 +848,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.grafeas.v1.Occurrence() ); @@ -879,7 +879,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.grafeas.v1.Occurrence() ); @@ -926,7 +926,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.updateOccurrence = stubSimpleCall( undefined, @@ -978,7 +978,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.grafeas.v1.Note() ); @@ -1009,7 +1009,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.grafeas.v1.Note() ); @@ -1053,7 +1053,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.getOccurrenceNote = stubSimpleCall( undefined, @@ -1104,7 +1104,7 @@ describe('v1.GrafeasClient', () => { 'name', ]); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.grafeas.v1.Note() ); @@ -1134,7 +1134,7 @@ describe('v1.GrafeasClient', () => { 'name', ]); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.grafeas.v1.Note() ); @@ -1177,7 +1177,7 @@ describe('v1.GrafeasClient', () => { 'name', ]); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.getNote = stubSimpleCall(undefined, expectedError); await assert.rejects(client.getNote(request), expectedError); @@ -1225,7 +1225,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -1256,7 +1256,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -1303,7 +1303,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteNote = stubSimpleCall( undefined, @@ -1355,7 +1355,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.grafeas.v1.Note() ); @@ -1386,7 +1386,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.grafeas.v1.Note() ); @@ -1430,7 +1430,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.createNote = stubSimpleCall( undefined, @@ -1482,7 +1482,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.grafeas.v1.BatchCreateNotesResponse() ); @@ -1513,7 +1513,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.grafeas.v1.BatchCreateNotesResponse() ); @@ -1560,7 +1560,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.batchCreateNotes = stubSimpleCall( undefined, @@ -1612,7 +1612,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.grafeas.v1.Note() ); @@ -1643,7 +1643,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.grafeas.v1.Note() ); @@ -1687,7 +1687,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.updateNote = stubSimpleCall( undefined, @@ -1739,7 +1739,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.grafeas.v1.Occurrence()), generateSampleMessage(new protos.grafeas.v1.Occurrence()), @@ -1772,7 +1772,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.grafeas.v1.Occurrence()), generateSampleMessage(new protos.grafeas.v1.Occurrence()), @@ -1821,7 +1821,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.listOccurrences = stubSimpleCall( undefined, @@ -1852,7 +1852,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.grafeas.v1.Occurrence()), generateSampleMessage(new protos.grafeas.v1.Occurrence()), @@ -1903,7 +1903,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listOccurrences.createStream = stubPageStreamingCall(undefined, expectedError); @@ -1949,7 +1949,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.grafeas.v1.Occurrence()), generateSampleMessage(new protos.grafeas.v1.Occurrence()), @@ -1992,7 +1992,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listOccurrences.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -2034,7 +2034,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.grafeas.v1.Note()), generateSampleMessage(new protos.grafeas.v1.Note()), @@ -2067,7 +2067,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.grafeas.v1.Note()), generateSampleMessage(new protos.grafeas.v1.Note()), @@ -2113,7 +2113,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.listNotes = stubSimpleCall(undefined, expectedError); await assert.rejects(client.listNotes(request), expectedError); @@ -2141,7 +2141,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.grafeas.v1.Note()), generateSampleMessage(new protos.grafeas.v1.Note()), @@ -2192,7 +2192,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listNotes.createStream = stubPageStreamingCall( undefined, @@ -2240,7 +2240,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.grafeas.v1.Note()), generateSampleMessage(new protos.grafeas.v1.Note()), @@ -2282,7 +2282,7 @@ describe('v1.GrafeasClient', () => { ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listNotes.asyncIterate = stubAsyncIterationCall( undefined, @@ -2325,7 +2325,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.grafeas.v1.Occurrence()), generateSampleMessage(new protos.grafeas.v1.Occurrence()), @@ -2359,7 +2359,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.grafeas.v1.Occurrence()), generateSampleMessage(new protos.grafeas.v1.Occurrence()), @@ -2408,7 +2408,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.listNoteOccurrences = stubSimpleCall( undefined, @@ -2439,7 +2439,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.grafeas.v1.Occurrence()), generateSampleMessage(new protos.grafeas.v1.Occurrence()), @@ -2490,7 +2490,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listNoteOccurrences.createStream = stubPageStreamingCall(undefined, expectedError); @@ -2536,7 +2536,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.grafeas.v1.Occurrence()), generateSampleMessage(new protos.grafeas.v1.Occurrence()), @@ -2579,7 +2579,7 @@ describe('v1.GrafeasClient', () => { ['name'] ); request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listNoteOccurrences.asyncIterate = stubAsyncIterationCall(undefined, expectedError); diff --git a/packages/grafeas/tsconfig.json b/packages/grafeas/tsconfig.json index 8c2c889a70c..860d6bf027b 100644 --- a/packages/grafeas/tsconfig.json +++ b/packages/grafeas/tsconfig.json @@ -18,4 +18,4 @@ "src/**/*.json", "protos/protos.json" ] -} \ No newline at end of file +}