Skip to content

Commit 9a969ad

Browse files
fix: use require() to load JSON protos (#442)
The library is regenerated with gapic-generator-typescript v1.3.1. Committer: @alexander-fenster PiperOrigin-RevId: 372468161 Source-Link: googleapis/googleapis@75880c3 Source-Link: googleapis/googleapis-gen@77b1804
1 parent 888c86f commit 9a969ad

9 files changed

+3224
-3242
lines changed

packages/google-cloud-oslogin/protos/protos.d.ts

+614-614
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/google-cloud-oslogin/protos/protos.js

+2,378-2,378
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

+204-204
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

+2-16
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax';
2222
import * as path from 'path';
2323

2424
import * as protos from '../../protos/protos';
25+
import jsonProtos = require('../../protos/protos.json');
2526
/**
2627
* Client JSON configuration object, loaded from
2728
* `src/v1/os_login_service_client_config.json`.
@@ -139,22 +140,7 @@ export class OsLoginServiceClient {
139140
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
140141
}
141142
// Load the applicable protos.
142-
// For Node.js, pass the path to JSON proto file.
143-
// For browsers, pass the JSON content.
144-
145-
const nodejsProtoPath = path.join(
146-
__dirname,
147-
'..',
148-
'..',
149-
'protos',
150-
'protos.json'
151-
);
152-
this._protos = this._gaxGrpc.loadProto(
153-
opts.fallback
154-
? // eslint-disable-next-line @typescript-eslint/no-var-requires
155-
require('../../protos/protos.json')
156-
: nodejsProtoPath
157-
);
143+
this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
158144

159145
// This API contains "path templates"; forward-slash-separated
160146
// identifiers to uniquely identify resources within the API.

packages/google-cloud-oslogin/src/v1/os_login_service_client_config.json

+12-6
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,33 @@
2121
},
2222
"methods": {
2323
"DeletePosixAccount": {
24-
"retry_codes_name": "non_idempotent",
24+
"timeout_millis": 10000,
25+
"retry_codes_name": "idempotent",
2526
"retry_params_name": "default"
2627
},
2728
"DeleteSshPublicKey": {
28-
"retry_codes_name": "non_idempotent",
29+
"timeout_millis": 10000,
30+
"retry_codes_name": "idempotent",
2931
"retry_params_name": "default"
3032
},
3133
"GetLoginProfile": {
32-
"retry_codes_name": "non_idempotent",
34+
"timeout_millis": 10000,
35+
"retry_codes_name": "idempotent",
3336
"retry_params_name": "default"
3437
},
3538
"GetSshPublicKey": {
36-
"retry_codes_name": "non_idempotent",
39+
"timeout_millis": 10000,
40+
"retry_codes_name": "idempotent",
3741
"retry_params_name": "default"
3842
},
3943
"ImportSshPublicKey": {
40-
"retry_codes_name": "non_idempotent",
44+
"timeout_millis": 10000,
45+
"retry_codes_name": "idempotent",
4146
"retry_params_name": "default"
4247
},
4348
"UpdateSshPublicKey": {
44-
"retry_codes_name": "non_idempotent",
49+
"timeout_millis": 10000,
50+
"retry_codes_name": "idempotent",
4551
"retry_params_name": "default"
4652
}
4753
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
[
2-
"../../protos/google/cloud/oslogin/common/common.proto",
32
"../../protos/google/cloud/oslogin/v1/oslogin.proto"
43
]

packages/google-cloud-oslogin/src/v1beta/os_login_service_client.ts

+2-16
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax';
2222
import * as path from 'path';
2323

2424
import * as protos from '../../protos/protos';
25+
import jsonProtos = require('../../protos/protos.json');
2526
/**
2627
* Client JSON configuration object, loaded from
2728
* `src/v1beta/os_login_service_client_config.json`.
@@ -139,22 +140,7 @@ export class OsLoginServiceClient {
139140
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
140141
}
141142
// Load the applicable protos.
142-
// For Node.js, pass the path to JSON proto file.
143-
// For browsers, pass the JSON content.
144-
145-
const nodejsProtoPath = path.join(
146-
__dirname,
147-
'..',
148-
'..',
149-
'protos',
150-
'protos.json'
151-
);
152-
this._protos = this._gaxGrpc.loadProto(
153-
opts.fallback
154-
? // eslint-disable-next-line @typescript-eslint/no-var-requires
155-
require('../../protos/protos.json')
156-
: nodejsProtoPath
157-
);
143+
this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
158144

159145
// This API contains "path templates"; forward-slash-separated
160146
// identifiers to uniquely identify resources within the API.

packages/google-cloud-oslogin/src/v1beta/os_login_service_client_config.json

+12-6
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,33 @@
2121
},
2222
"methods": {
2323
"DeletePosixAccount": {
24-
"retry_codes_name": "non_idempotent",
24+
"timeout_millis": 10000,
25+
"retry_codes_name": "idempotent",
2526
"retry_params_name": "default"
2627
},
2728
"DeleteSshPublicKey": {
28-
"retry_codes_name": "non_idempotent",
29+
"timeout_millis": 10000,
30+
"retry_codes_name": "idempotent",
2931
"retry_params_name": "default"
3032
},
3133
"GetLoginProfile": {
32-
"retry_codes_name": "non_idempotent",
34+
"timeout_millis": 10000,
35+
"retry_codes_name": "idempotent",
3336
"retry_params_name": "default"
3437
},
3538
"GetSshPublicKey": {
36-
"retry_codes_name": "non_idempotent",
39+
"timeout_millis": 10000,
40+
"retry_codes_name": "idempotent",
3741
"retry_params_name": "default"
3842
},
3943
"ImportSshPublicKey": {
40-
"retry_codes_name": "non_idempotent",
44+
"timeout_millis": 10000,
45+
"retry_codes_name": "idempotent",
4146
"retry_params_name": "default"
4247
},
4348
"UpdateSshPublicKey": {
44-
"retry_codes_name": "non_idempotent",
49+
"timeout_millis": 10000,
50+
"retry_codes_name": "idempotent",
4551
"retry_params_name": "default"
4652
}
4753
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
[
2-
"../../protos/google/cloud/oslogin/common/common.proto",
32
"../../protos/google/cloud/oslogin/v1beta/oslogin.proto"
43
]

0 commit comments

Comments
 (0)