Skip to content

Commit e7409c8

Browse files
feat: [Many APIs] add request/response debug logging to gapics
* chore: update typescript gapic generator to 4.8.1 feat: add request/response debug logging to gapics, update templates to gax 5 and node 18 (#1671) fix: add json files to tsconfig templates (#1692) (ba6be1d) PiperOrigin-RevId: 735896588 Source-Link: googleapis/googleapis@3419af7 Source-Link: googleapis/googleapis-gen@f35ba11 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJpbmFyeWF1dGhvcml6YXRpb24vLk93bEJvdC55YW1sIiwiaCI6ImYzNWJhMTE0MmY0ZTE2ODIyMjMyN2Q4OTJiNWY2ZWU5MDhlNWQ0NjEifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWNlcnRpZmljYXRlbWFuYWdlci8uT3dsQm90LnlhbWwiLCJoIjoiZjM1YmExMTQyZjRlMTY4MjIyMzI3ZDg5MmI1ZjZlZTkwOGU1ZDQ2MSJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWNoYW5uZWwvLk93bEJvdC55YW1sIiwiaCI6ImYzNWJhMTE0MmY0ZTE2ODIyMjMyN2Q4OTJiNWY2ZWU5MDhlNWQ0NjEifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWNsb3VkY29udHJvbHNwYXJ0bmVyLy5Pd2xCb3QueWFtbCIsImgiOiJmMzViYTExNDJmNGUxNjgyMjIzMjdkODkyYjVmNmVlOTA4ZTVkNDYxIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWNsb3VkZG1zLy5Pd2xCb3QueWFtbCIsImgiOiJmMzViYTExNDJmNGUxNjgyMjIzMjdkODkyYjVmNmVlOTA4ZTVkNDYxIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWNvbW1lcmNlLWNvbnN1bWVyLXByb2N1cmVtZW50Ly5Pd2xCb3QueWFtbCI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TY4MjIyMzI3ZDg5MmI1ZjZlZTkwOGU1ZDQ2MSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 32fff6f commit e7409c8

206 files changed

Lines changed: 35083 additions & 2564 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/google-cloud-binaryauthorization/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
4444
1. [Select or create a Cloud Platform project][projects].
4545
1. [Enable billing for your project][billing].
4646
1. [Enable the Binary Authorization API][enable_api].
47-
1. [Set up authentication][auth] so you can access the
47+
1. [Set up authentication with a service account][auth] so you can access the
4848
API from your local workstation.
4949

5050
### Installing the client library
@@ -173,4 +173,4 @@ See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE)
173173
[projects]: https://console.cloud.google.com/project
174174
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
175175
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=binaryauthorization.googleapis.com
176-
[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local
176+
[auth]: https://cloud.google.com/docs/authentication/getting-started

packages/google-cloud-binaryauthorization/protos/protos.json

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/google-cloud-binaryauthorization/src/v1/binauthz_management_service_v1_client.ts

Lines changed: 214 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import type {
2929
import {Transform} from 'stream';
3030
import * as protos from '../../protos/protos';
3131
import jsonProtos = require('../../protos/protos.json');
32+
import {loggingUtils as logging} from 'google-gax';
3233

3334
/**
3435
* Client JSON configuration object, loaded from
@@ -59,6 +60,8 @@ export class BinauthzManagementServiceV1Client {
5960
private _defaults: {[method: string]: gax.CallSettings};
6061
private _universeDomain: string;
6162
private _servicePath: string;
63+
private _log = logging.log('binary-authorization');
64+
6265
auth: gax.GoogleAuth;
6366
descriptors: Descriptors = {
6467
page: {},
@@ -93,7 +96,7 @@ export class BinauthzManagementServiceV1Client {
9396
* Developer's Console, e.g. 'grape-spaceship-123'. We will also check
9497
* the environment variable GCLOUD_PROJECT for your project ID. If your
9598
* app is running in an environment which supports
96-
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
99+
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
97100
* your project ID will be detected automatically.
98101
* @param {string} [options.apiEndpoint] - The domain name of the
99102
* API remote host.
@@ -498,7 +501,36 @@ export class BinauthzManagementServiceV1Client {
498501
name: request.name ?? '',
499502
});
500503
this.initialize();
501-
return this.innerApiCalls.getPolicy(request, options, callback);
504+
this._log.info('getPolicy request %j', request);
505+
const wrappedCallback:
506+
| Callback<
507+
protos.google.cloud.binaryauthorization.v1.IPolicy,
508+
| protos.google.cloud.binaryauthorization.v1.IGetPolicyRequest
509+
| null
510+
| undefined,
511+
{} | null | undefined
512+
>
513+
| undefined = callback
514+
? (error, response, options, rawResponse) => {
515+
this._log.info('getPolicy response %j', response);
516+
callback!(error, response, options, rawResponse); // We verified callback above.
517+
}
518+
: undefined;
519+
return this.innerApiCalls
520+
.getPolicy(request, options, wrappedCallback)
521+
?.then(
522+
([response, options, rawResponse]: [
523+
protos.google.cloud.binaryauthorization.v1.IPolicy,
524+
(
525+
| protos.google.cloud.binaryauthorization.v1.IGetPolicyRequest
526+
| undefined
527+
),
528+
{} | undefined,
529+
]) => {
530+
this._log.info('getPolicy response %j', response);
531+
return [response, options, rawResponse];
532+
}
533+
);
502534
}
503535
/**
504536
* Creates or updates a project's {@link protos.google.cloud.binaryauthorization.v1.Policy|policy}, and returns a copy of the
@@ -600,7 +632,36 @@ export class BinauthzManagementServiceV1Client {
600632
'policy.name': request.policy!.name ?? '',
601633
});
602634
this.initialize();
603-
return this.innerApiCalls.updatePolicy(request, options, callback);
635+
this._log.info('updatePolicy request %j', request);
636+
const wrappedCallback:
637+
| Callback<
638+
protos.google.cloud.binaryauthorization.v1.IPolicy,
639+
| protos.google.cloud.binaryauthorization.v1.IUpdatePolicyRequest
640+
| null
641+
| undefined,
642+
{} | null | undefined
643+
>
644+
| undefined = callback
645+
? (error, response, options, rawResponse) => {
646+
this._log.info('updatePolicy response %j', response);
647+
callback!(error, response, options, rawResponse); // We verified callback above.
648+
}
649+
: undefined;
650+
return this.innerApiCalls
651+
.updatePolicy(request, options, wrappedCallback)
652+
?.then(
653+
([response, options, rawResponse]: [
654+
protos.google.cloud.binaryauthorization.v1.IPolicy,
655+
(
656+
| protos.google.cloud.binaryauthorization.v1.IUpdatePolicyRequest
657+
| undefined
658+
),
659+
{} | undefined,
660+
]) => {
661+
this._log.info('updatePolicy response %j', response);
662+
return [response, options, rawResponse];
663+
}
664+
);
604665
}
605666
/**
606667
* Creates an {@link protos.google.cloud.binaryauthorization.v1.Attestor|attestor}, and returns a copy of the new
@@ -705,7 +766,36 @@ export class BinauthzManagementServiceV1Client {
705766
parent: request.parent ?? '',
706767
});
707768
this.initialize();
708-
return this.innerApiCalls.createAttestor(request, options, callback);
769+
this._log.info('createAttestor request %j', request);
770+
const wrappedCallback:
771+
| Callback<
772+
protos.google.cloud.binaryauthorization.v1.IAttestor,
773+
| protos.google.cloud.binaryauthorization.v1.ICreateAttestorRequest
774+
| null
775+
| undefined,
776+
{} | null | undefined
777+
>
778+
| undefined = callback
779+
? (error, response, options, rawResponse) => {
780+
this._log.info('createAttestor response %j', response);
781+
callback!(error, response, options, rawResponse); // We verified callback above.
782+
}
783+
: undefined;
784+
return this.innerApiCalls
785+
.createAttestor(request, options, wrappedCallback)
786+
?.then(
787+
([response, options, rawResponse]: [
788+
protos.google.cloud.binaryauthorization.v1.IAttestor,
789+
(
790+
| protos.google.cloud.binaryauthorization.v1.ICreateAttestorRequest
791+
| undefined
792+
),
793+
{} | undefined,
794+
]) => {
795+
this._log.info('createAttestor response %j', response);
796+
return [response, options, rawResponse];
797+
}
798+
);
709799
}
710800
/**
711801
* Gets an {@link protos.google.cloud.binaryauthorization.v1.Attestor|attestor}.
@@ -803,7 +893,36 @@ export class BinauthzManagementServiceV1Client {
803893
name: request.name ?? '',
804894
});
805895
this.initialize();
806-
return this.innerApiCalls.getAttestor(request, options, callback);
896+
this._log.info('getAttestor request %j', request);
897+
const wrappedCallback:
898+
| Callback<
899+
protos.google.cloud.binaryauthorization.v1.IAttestor,
900+
| protos.google.cloud.binaryauthorization.v1.IGetAttestorRequest
901+
| null
902+
| undefined,
903+
{} | null | undefined
904+
>
905+
| undefined = callback
906+
? (error, response, options, rawResponse) => {
907+
this._log.info('getAttestor response %j', response);
908+
callback!(error, response, options, rawResponse); // We verified callback above.
909+
}
910+
: undefined;
911+
return this.innerApiCalls
912+
.getAttestor(request, options, wrappedCallback)
913+
?.then(
914+
([response, options, rawResponse]: [
915+
protos.google.cloud.binaryauthorization.v1.IAttestor,
916+
(
917+
| protos.google.cloud.binaryauthorization.v1.IGetAttestorRequest
918+
| undefined
919+
),
920+
{} | undefined,
921+
]) => {
922+
this._log.info('getAttestor response %j', response);
923+
return [response, options, rawResponse];
924+
}
925+
);
807926
}
808927
/**
809928
* Updates an {@link protos.google.cloud.binaryauthorization.v1.Attestor|attestor}.
@@ -902,7 +1021,36 @@ export class BinauthzManagementServiceV1Client {
9021021
'attestor.name': request.attestor!.name ?? '',
9031022
});
9041023
this.initialize();
905-
return this.innerApiCalls.updateAttestor(request, options, callback);
1024+
this._log.info('updateAttestor request %j', request);
1025+
const wrappedCallback:
1026+
| Callback<
1027+
protos.google.cloud.binaryauthorization.v1.IAttestor,
1028+
| protos.google.cloud.binaryauthorization.v1.IUpdateAttestorRequest
1029+
| null
1030+
| undefined,
1031+
{} | null | undefined
1032+
>
1033+
| undefined = callback
1034+
? (error, response, options, rawResponse) => {
1035+
this._log.info('updateAttestor response %j', response);
1036+
callback!(error, response, options, rawResponse); // We verified callback above.
1037+
}
1038+
: undefined;
1039+
return this.innerApiCalls
1040+
.updateAttestor(request, options, wrappedCallback)
1041+
?.then(
1042+
([response, options, rawResponse]: [
1043+
protos.google.cloud.binaryauthorization.v1.IAttestor,
1044+
(
1045+
| protos.google.cloud.binaryauthorization.v1.IUpdateAttestorRequest
1046+
| undefined
1047+
),
1048+
{} | undefined,
1049+
]) => {
1050+
this._log.info('updateAttestor response %j', response);
1051+
return [response, options, rawResponse];
1052+
}
1053+
);
9061054
}
9071055
/**
9081056
* Deletes an {@link protos.google.cloud.binaryauthorization.v1.Attestor|attestor}. Returns NOT_FOUND if the
@@ -1000,7 +1148,36 @@ export class BinauthzManagementServiceV1Client {
10001148
name: request.name ?? '',
10011149
});
10021150
this.initialize();
1003-
return this.innerApiCalls.deleteAttestor(request, options, callback);
1151+
this._log.info('deleteAttestor request %j', request);
1152+
const wrappedCallback:
1153+
| Callback<
1154+
protos.google.protobuf.IEmpty,
1155+
| protos.google.cloud.binaryauthorization.v1.IDeleteAttestorRequest
1156+
| null
1157+
| undefined,
1158+
{} | null | undefined
1159+
>
1160+
| undefined = callback
1161+
? (error, response, options, rawResponse) => {
1162+
this._log.info('deleteAttestor response %j', response);
1163+
callback!(error, response, options, rawResponse); // We verified callback above.
1164+
}
1165+
: undefined;
1166+
return this.innerApiCalls
1167+
.deleteAttestor(request, options, wrappedCallback)
1168+
?.then(
1169+
([response, options, rawResponse]: [
1170+
protos.google.protobuf.IEmpty,
1171+
(
1172+
| protos.google.cloud.binaryauthorization.v1.IDeleteAttestorRequest
1173+
| undefined
1174+
),
1175+
{} | undefined,
1176+
]) => {
1177+
this._log.info('deleteAttestor response %j', response);
1178+
return [response, options, rawResponse];
1179+
}
1180+
);
10041181
}
10051182

10061183
/**
@@ -1103,7 +1280,33 @@ export class BinauthzManagementServiceV1Client {
11031280
parent: request.parent ?? '',
11041281
});
11051282
this.initialize();
1106-
return this.innerApiCalls.listAttestors(request, options, callback);
1283+
const wrappedCallback:
1284+
| PaginationCallback<
1285+
protos.google.cloud.binaryauthorization.v1.IListAttestorsRequest,
1286+
| protos.google.cloud.binaryauthorization.v1.IListAttestorsResponse
1287+
| null
1288+
| undefined,
1289+
protos.google.cloud.binaryauthorization.v1.IAttestor
1290+
>
1291+
| undefined = callback
1292+
? (error, values, nextPageRequest, rawResponse) => {
1293+
this._log.info('listAttestors values %j', values);
1294+
callback!(error, values, nextPageRequest, rawResponse); // We verified callback above.
1295+
}
1296+
: undefined;
1297+
this._log.info('listAttestors request %j', request);
1298+
return this.innerApiCalls
1299+
.listAttestors(request, options, wrappedCallback)
1300+
?.then(
1301+
([response, input, output]: [
1302+
protos.google.cloud.binaryauthorization.v1.IAttestor[],
1303+
protos.google.cloud.binaryauthorization.v1.IListAttestorsRequest | null,
1304+
protos.google.cloud.binaryauthorization.v1.IListAttestorsResponse,
1305+
]) => {
1306+
this._log.info('listAttestors values %j', response);
1307+
return [response, input, output];
1308+
}
1309+
);
11071310
}
11081311

11091312
/**
@@ -1146,6 +1349,7 @@ export class BinauthzManagementServiceV1Client {
11461349
const defaultCallSettings = this._defaults['listAttestors'];
11471350
const callSettings = defaultCallSettings.merge(options);
11481351
this.initialize();
1352+
this._log.info('listAttestors stream %j', request);
11491353
return this.descriptors.page.listAttestors.createStream(
11501354
this.innerApiCalls.listAttestors as GaxCall,
11511355
request,
@@ -1196,6 +1400,7 @@ export class BinauthzManagementServiceV1Client {
11961400
const defaultCallSettings = this._defaults['listAttestors'];
11971401
const callSettings = defaultCallSettings.merge(options);
11981402
this.initialize();
1403+
this._log.info('listAttestors iterate %j', request);
11991404
return this.descriptors.page.listAttestors.asyncIterate(
12001405
this.innerApiCalls['listAttestors'] as GaxCall,
12011406
request as {},
@@ -1323,6 +1528,7 @@ export class BinauthzManagementServiceV1Client {
13231528
close(): Promise<void> {
13241529
if (this.binauthzManagementServiceV1Stub && !this._terminated) {
13251530
return this.binauthzManagementServiceV1Stub.then(stub => {
1531+
this._log.info('ending gRPC channel');
13261532
this._terminated = true;
13271533
stub.close();
13281534
});

0 commit comments

Comments
 (0)