Skip to content

Commit 11bfd8d

Browse files
yoshi-automationJustinBeckwith
authored andcommitted
feat: support apiEndpoint override in client constructor (#204)
1 parent 6a175ec commit 11bfd8d

File tree

3 files changed

+33
-6
lines changed

3 files changed

+33
-6
lines changed

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

+12-1
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,15 @@ class OsLoginServiceClient {
6060
constructor(opts) {
6161
this._descriptors = {};
6262

63+
const servicePath =
64+
opts.servicePath || opts.apiEndpoint || this.constructor.servicePath;
65+
6366
// Ensure that options include the service address and port.
6467
opts = Object.assign(
6568
{
6669
clientConfig: {},
6770
port: this.constructor.port,
68-
servicePath: this.constructor.servicePath,
71+
servicePath,
6972
},
7073
opts
7174
);
@@ -164,6 +167,14 @@ class OsLoginServiceClient {
164167
return 'oslogin.googleapis.com';
165168
}
166169

170+
/**
171+
* The DNS address for this API service - same as servicePath(),
172+
* exists for compatibility reasons.
173+
*/
174+
static get apiEndpoint() {
175+
return 'oslogin.googleapis.com';
176+
}
177+
167178
/**
168179
* The port for this API service.
169180
*/

packages/google-cloud-oslogin/synth.metadata

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
2-
"updateTime": "2019-05-21T11:20:14.671818Z",
2+
"updateTime": "2019-06-04T19:38:15.784953Z",
33
"sources": [
44
{
55
"generator": {
66
"name": "artman",
7-
"version": "0.20.0",
8-
"dockerImage": "googleapis/artman@sha256:3246adac900f4bdbd62920e80de2e5877380e44036b3feae13667ec255ebf5ec"
7+
"version": "0.23.0",
8+
"dockerImage": "googleapis/artman@sha256:846102ebf7ea2239162deea69f64940443b4147f7c2e68d64b332416f74211ba"
99
}
1010
},
1111
{
1212
"git": {
1313
"name": "googleapis",
1414
"remote": "https://github.com/googleapis/googleapis.git",
15-
"sha": "32a10f69e2c9ce15bba13ab1ff928bacebb25160",
16-
"internalRef": "249058354"
15+
"sha": "0026f4b890ed9e2388fb0573c0727defa6f5b82e",
16+
"internalRef": "251265049"
1717
}
1818
},
1919
{

packages/google-cloud-oslogin/test/gapic-v1beta.js

+16
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,22 @@ const error = new Error();
2323
error.code = FAKE_STATUS_CODE;
2424

2525
describe('OsLoginServiceClient', () => {
26+
it('has servicePath', () => {
27+
const servicePath = osLoginModule.v1beta.OsLoginServiceClient.servicePath;
28+
assert(servicePath);
29+
});
30+
31+
it('has apiEndpoint', () => {
32+
const apiEndpoint = osLoginModule.v1beta.OsLoginServiceClient.apiEndpoint;
33+
assert(apiEndpoint);
34+
});
35+
36+
it('has port', () => {
37+
const port = osLoginModule.v1beta.OsLoginServiceClient.port;
38+
assert(port);
39+
assert(typeof port === 'number');
40+
});
41+
2642
describe('deletePosixAccount', () => {
2743
it('invokes deletePosixAccount without error', done => {
2844
const client = new osLoginModule.v1beta.OsLoginServiceClient({

0 commit comments

Comments
 (0)