Skip to content

Commit b99c5f8

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: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW9zbG9naW4vLk93bEJvdC55YW1sIiwiaCI6ImYzNWJhMTE0MmY0ZTE2ODIyMjMyN2Q4OTJiNWY2ZWU5MDhlNWQ0NjEifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXBhcmFsbGVsc3RvcmUvLk93bEJvdC55YW1sIiwiaCI6ImYzNWJhMTE0MmY0ZTE2ODIyMjMyN2Q4OTJiNWY2ZWU5MDhlNWQ0NjEifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXBhcmFtZXRlcm1hbmFnZXIvLk93bEJvdC55YW1sIiwiaCI6ImYzNWJhMTE0MmY0ZTE2ODIyMjMyN2Q4OTJiNWY2ZWU5MDhlNWQ0NjEifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXBoaXNoaW5ncHJvdGVjdGlvbi8uT3dsQm90LnlhbWwiLCJoIjoiZjM1YmExMTQyZjRlMTY4MjIyMzI3ZDg5MmI1ZjZlZTkwOGU1ZDQ2MSJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXBvbGljeXNpbXVsYXRvci8uT3dsQm90LnlhbWwiLCJoIjoiZjM1YmExMTQyZjRlMTY4MjIyMzI3ZDg5MmI1ZjZlZTkwOGU1ZDQ2MSJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXBvbGljeXRyb3VibGVzaG9vdGVyLWlhbS8uT3dsQm90LnlhbWw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hbWwiLCJoIjoiZjM1YmExMTQyZjRlMTY4MjIyMzI3ZDg5MmI1ZjZlZTkwOGU1ZDQ2MSJ9 * 🦉 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 2f96b1f commit b99c5f8

136 files changed

Lines changed: 16370 additions & 1097 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-oslogin/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 Google Cloud OS Login 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
@@ -187,4 +187,4 @@ See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE)
187187
[projects]: https://console.cloud.google.com/project
188188
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
189189
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=oslogin.googleapis.com
190-
[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local
190+
[auth]: https://cloud.google.com/docs/authentication/getting-started

packages/google-cloud-oslogin/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-oslogin/src/v1/os_login_service_client.ts

Lines changed: 194 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import type {
2727

2828
import * as protos from '../../protos/protos';
2929
import jsonProtos = require('../../protos/protos.json');
30+
import {loggingUtils as logging} from 'google-gax';
3031

3132
/**
3233
* Client JSON configuration object, loaded from
@@ -54,6 +55,8 @@ export class OsLoginServiceClient {
5455
private _defaults: {[method: string]: gax.CallSettings};
5556
private _universeDomain: string;
5657
private _servicePath: string;
58+
private _log = logging.log('os-login');
59+
5760
auth: gax.GoogleAuth;
5861
descriptors: Descriptors = {
5962
page: {},
@@ -88,7 +91,7 @@ export class OsLoginServiceClient {
8891
* Developer's Console, e.g. 'grape-spaceship-123'. We will also check
8992
* the environment variable GCLOUD_PROJECT for your project ID. If your
9093
* app is running in an environment which supports
91-
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
94+
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
9295
* your project ID will be detected automatically.
9396
* @param {string} [options.apiEndpoint] - The domain name of the
9497
* API remote host.
@@ -475,7 +478,33 @@ export class OsLoginServiceClient {
475478
parent: request.parent ?? '',
476479
});
477480
this.initialize();
478-
return this.innerApiCalls.createSshPublicKey(request, options, callback);
481+
this._log.info('createSshPublicKey request %j', request);
482+
const wrappedCallback:
483+
| Callback<
484+
protos.google.cloud.oslogin.common.ISshPublicKey,
485+
| protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest
486+
| null
487+
| undefined,
488+
{} | null | undefined
489+
>
490+
| undefined = callback
491+
? (error, response, options, rawResponse) => {
492+
this._log.info('createSshPublicKey response %j', response);
493+
callback!(error, response, options, rawResponse); // We verified callback above.
494+
}
495+
: undefined;
496+
return this.innerApiCalls
497+
.createSshPublicKey(request, options, wrappedCallback)
498+
?.then(
499+
([response, options, rawResponse]: [
500+
protos.google.cloud.oslogin.common.ISshPublicKey,
501+
protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest | undefined,
502+
{} | undefined,
503+
]) => {
504+
this._log.info('createSshPublicKey response %j', response);
505+
return [response, options, rawResponse];
506+
}
507+
);
479508
}
480509
/**
481510
* Deletes a POSIX account.
@@ -567,7 +596,33 @@ export class OsLoginServiceClient {
567596
name: request.name ?? '',
568597
});
569598
this.initialize();
570-
return this.innerApiCalls.deletePosixAccount(request, options, callback);
599+
this._log.info('deletePosixAccount request %j', request);
600+
const wrappedCallback:
601+
| Callback<
602+
protos.google.protobuf.IEmpty,
603+
| protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest
604+
| null
605+
| undefined,
606+
{} | null | undefined
607+
>
608+
| undefined = callback
609+
? (error, response, options, rawResponse) => {
610+
this._log.info('deletePosixAccount response %j', response);
611+
callback!(error, response, options, rawResponse); // We verified callback above.
612+
}
613+
: undefined;
614+
return this.innerApiCalls
615+
.deletePosixAccount(request, options, wrappedCallback)
616+
?.then(
617+
([response, options, rawResponse]: [
618+
protos.google.protobuf.IEmpty,
619+
protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest | undefined,
620+
{} | undefined,
621+
]) => {
622+
this._log.info('deletePosixAccount response %j', response);
623+
return [response, options, rawResponse];
624+
}
625+
);
571626
}
572627
/**
573628
* Deletes an SSH public key.
@@ -659,7 +714,33 @@ export class OsLoginServiceClient {
659714
name: request.name ?? '',
660715
});
661716
this.initialize();
662-
return this.innerApiCalls.deleteSshPublicKey(request, options, callback);
717+
this._log.info('deleteSshPublicKey request %j', request);
718+
const wrappedCallback:
719+
| Callback<
720+
protos.google.protobuf.IEmpty,
721+
| protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest
722+
| null
723+
| undefined,
724+
{} | null | undefined
725+
>
726+
| undefined = callback
727+
? (error, response, options, rawResponse) => {
728+
this._log.info('deleteSshPublicKey response %j', response);
729+
callback!(error, response, options, rawResponse); // We verified callback above.
730+
}
731+
: undefined;
732+
return this.innerApiCalls
733+
.deleteSshPublicKey(request, options, wrappedCallback)
734+
?.then(
735+
([response, options, rawResponse]: [
736+
protos.google.protobuf.IEmpty,
737+
protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest | undefined,
738+
{} | undefined,
739+
]) => {
740+
this._log.info('deleteSshPublicKey response %j', response);
741+
return [response, options, rawResponse];
742+
}
743+
);
663744
}
664745
/**
665746
* Retrieves the profile information used for logging in to a virtual machine
@@ -748,7 +829,33 @@ export class OsLoginServiceClient {
748829
name: request.name ?? '',
749830
});
750831
this.initialize();
751-
return this.innerApiCalls.getLoginProfile(request, options, callback);
832+
this._log.info('getLoginProfile request %j', request);
833+
const wrappedCallback:
834+
| Callback<
835+
protos.google.cloud.oslogin.v1.ILoginProfile,
836+
| protos.google.cloud.oslogin.v1.IGetLoginProfileRequest
837+
| null
838+
| undefined,
839+
{} | null | undefined
840+
>
841+
| undefined = callback
842+
? (error, response, options, rawResponse) => {
843+
this._log.info('getLoginProfile response %j', response);
844+
callback!(error, response, options, rawResponse); // We verified callback above.
845+
}
846+
: undefined;
847+
return this.innerApiCalls
848+
.getLoginProfile(request, options, wrappedCallback)
849+
?.then(
850+
([response, options, rawResponse]: [
851+
protos.google.cloud.oslogin.v1.ILoginProfile,
852+
protos.google.cloud.oslogin.v1.IGetLoginProfileRequest | undefined,
853+
{} | undefined,
854+
]) => {
855+
this._log.info('getLoginProfile response %j', response);
856+
return [response, options, rawResponse];
857+
}
858+
);
752859
}
753860
/**
754861
* Retrieves an SSH public key.
@@ -834,7 +941,33 @@ export class OsLoginServiceClient {
834941
name: request.name ?? '',
835942
});
836943
this.initialize();
837-
return this.innerApiCalls.getSshPublicKey(request, options, callback);
944+
this._log.info('getSshPublicKey request %j', request);
945+
const wrappedCallback:
946+
| Callback<
947+
protos.google.cloud.oslogin.common.ISshPublicKey,
948+
| protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest
949+
| null
950+
| undefined,
951+
{} | null | undefined
952+
>
953+
| undefined = callback
954+
? (error, response, options, rawResponse) => {
955+
this._log.info('getSshPublicKey response %j', response);
956+
callback!(error, response, options, rawResponse); // We verified callback above.
957+
}
958+
: undefined;
959+
return this.innerApiCalls
960+
.getSshPublicKey(request, options, wrappedCallback)
961+
?.then(
962+
([response, options, rawResponse]: [
963+
protos.google.cloud.oslogin.common.ISshPublicKey,
964+
protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest | undefined,
965+
{} | undefined,
966+
]) => {
967+
this._log.info('getSshPublicKey response %j', response);
968+
return [response, options, rawResponse];
969+
}
970+
);
838971
}
839972
/**
840973
* Adds an SSH public key and returns the profile information. Default POSIX
@@ -934,7 +1067,33 @@ export class OsLoginServiceClient {
9341067
parent: request.parent ?? '',
9351068
});
9361069
this.initialize();
937-
return this.innerApiCalls.importSshPublicKey(request, options, callback);
1070+
this._log.info('importSshPublicKey request %j', request);
1071+
const wrappedCallback:
1072+
| Callback<
1073+
protos.google.cloud.oslogin.v1.IImportSshPublicKeyResponse,
1074+
| protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest
1075+
| null
1076+
| undefined,
1077+
{} | null | undefined
1078+
>
1079+
| undefined = callback
1080+
? (error, response, options, rawResponse) => {
1081+
this._log.info('importSshPublicKey response %j', response);
1082+
callback!(error, response, options, rawResponse); // We verified callback above.
1083+
}
1084+
: undefined;
1085+
return this.innerApiCalls
1086+
.importSshPublicKey(request, options, wrappedCallback)
1087+
?.then(
1088+
([response, options, rawResponse]: [
1089+
protos.google.cloud.oslogin.v1.IImportSshPublicKeyResponse,
1090+
protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest | undefined,
1091+
{} | undefined,
1092+
]) => {
1093+
this._log.info('importSshPublicKey response %j', response);
1094+
return [response, options, rawResponse];
1095+
}
1096+
);
9381097
}
9391098
/**
9401099
* Updates an SSH public key and returns the profile information. This method
@@ -1031,7 +1190,33 @@ export class OsLoginServiceClient {
10311190
name: request.name ?? '',
10321191
});
10331192
this.initialize();
1034-
return this.innerApiCalls.updateSshPublicKey(request, options, callback);
1193+
this._log.info('updateSshPublicKey request %j', request);
1194+
const wrappedCallback:
1195+
| Callback<
1196+
protos.google.cloud.oslogin.common.ISshPublicKey,
1197+
| protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest
1198+
| null
1199+
| undefined,
1200+
{} | null | undefined
1201+
>
1202+
| undefined = callback
1203+
? (error, response, options, rawResponse) => {
1204+
this._log.info('updateSshPublicKey response %j', response);
1205+
callback!(error, response, options, rawResponse); // We verified callback above.
1206+
}
1207+
: undefined;
1208+
return this.innerApiCalls
1209+
.updateSshPublicKey(request, options, wrappedCallback)
1210+
?.then(
1211+
([response, options, rawResponse]: [
1212+
protos.google.cloud.oslogin.common.ISshPublicKey,
1213+
protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest | undefined,
1214+
{} | undefined,
1215+
]) => {
1216+
this._log.info('updateSshPublicKey response %j', response);
1217+
return [response, options, rawResponse];
1218+
}
1219+
);
10351220
}
10361221

10371222
// --------------------
@@ -1146,6 +1331,7 @@ export class OsLoginServiceClient {
11461331
close(): Promise<void> {
11471332
if (this.osLoginServiceStub && !this._terminated) {
11481333
return this.osLoginServiceStub.then(stub => {
1334+
this._log.info('ending gRPC channel');
11491335
this._terminated = true;
11501336
stub.close();
11511337
});

0 commit comments

Comments
 (0)