Skip to content

Commit 380e7b7

Browse files
authored
feat: update typescript generator for beyond corp app (#3309)
1 parent 6fad7f0 commit 380e7b7

24 files changed

Lines changed: 458 additions & 375 deletions

File tree

packages/google-cloud-beyondcorp-appconnectors/samples/generated/v1/app_connectors_service.create_app_connector.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
function main(parent, appConnector) {
2424
// [START beyondcorp_v1_generated_AppConnectorsService_CreateAppConnector_async]
2525
/**
26+
* This snippet has been automatically generated and should be regarded as a code template only.
27+
* It will require modifications to work.
28+
* It may require correct/in-range values for request initialization.
2629
* TODO(developer): Uncomment these variables before running the sample.
2730
*/
2831
/**

packages/google-cloud-beyondcorp-appconnectors/samples/generated/v1/app_connectors_service.delete_app_connector.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
function main(name) {
2424
// [START beyondcorp_v1_generated_AppConnectorsService_DeleteAppConnector_async]
2525
/**
26+
* This snippet has been automatically generated and should be regarded as a code template only.
27+
* It will require modifications to work.
28+
* It may require correct/in-range values for request initialization.
2629
* TODO(developer): Uncomment these variables before running the sample.
2730
*/
2831
/**

packages/google-cloud-beyondcorp-appconnectors/samples/generated/v1/app_connectors_service.get_app_connector.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
function main(name) {
2424
// [START beyondcorp_v1_generated_AppConnectorsService_GetAppConnector_async]
2525
/**
26+
* This snippet has been automatically generated and should be regarded as a code template only.
27+
* It will require modifications to work.
28+
* It may require correct/in-range values for request initialization.
2629
* TODO(developer): Uncomment these variables before running the sample.
2730
*/
2831
/**

packages/google-cloud-beyondcorp-appconnectors/samples/generated/v1/app_connectors_service.list_app_connectors.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
function main(parent) {
2424
// [START beyondcorp_v1_generated_AppConnectorsService_ListAppConnectors_async]
2525
/**
26+
* This snippet has been automatically generated and should be regarded as a code template only.
27+
* It will require modifications to work.
28+
* It may require correct/in-range values for request initialization.
2629
* TODO(developer): Uncomment these variables before running the sample.
2730
*/
2831
/**

packages/google-cloud-beyondcorp-appconnectors/samples/generated/v1/app_connectors_service.report_status.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
function main(appConnector, resourceInfo) {
2424
// [START beyondcorp_v1_generated_AppConnectorsService_ReportStatus_async]
2525
/**
26+
* This snippet has been automatically generated and should be regarded as a code template only.
27+
* It will require modifications to work.
28+
* It may require correct/in-range values for request initialization.
2629
* TODO(developer): Uncomment these variables before running the sample.
2730
*/
2831
/**

packages/google-cloud-beyondcorp-appconnectors/samples/generated/v1/app_connectors_service.update_app_connector.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
function main(updateMask, appConnector) {
2424
// [START beyondcorp_v1_generated_AppConnectorsService_UpdateAppConnector_async]
2525
/**
26+
* This snippet has been automatically generated and should be regarded as a code template only.
27+
* It will require modifications to work.
28+
* It may require correct/in-range values for request initialization.
2629
* TODO(developer): Uncomment these variables before running the sample.
2730
*/
2831
/**

packages/google-cloud-beyondcorp-appconnectors/samples/generated/v1/snippet_metadata.google.cloud.beyondcorp.appconnectors.v1.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"segments": [
2323
{
2424
"start": 25,
25-
"end": 78,
25+
"end": 81,
2626
"type": "FULL"
2727
}
2828
],
@@ -78,7 +78,7 @@
7878
"segments": [
7979
{
8080
"start": 25,
81-
"end": 51,
81+
"end": 54,
8282
"type": "FULL"
8383
}
8484
],
@@ -118,7 +118,7 @@
118118
"segments": [
119119
{
120120
"start": 25,
121-
"end": 83,
121+
"end": 86,
122122
"type": "FULL"
123123
}
124124
],
@@ -174,7 +174,7 @@
174174
"segments": [
175175
{
176176
"start": 25,
177-
"end": 80,
177+
"end": 83,
178178
"type": "FULL"
179179
}
180180
],
@@ -226,7 +226,7 @@
226226
"segments": [
227227
{
228228
"start": 25,
229-
"end": 71,
229+
"end": 74,
230230
"type": "FULL"
231231
}
232232
],
@@ -274,7 +274,7 @@
274274
"segments": [
275275
{
276276
"start": 25,
277-
"end": 76,
277+
"end": 79,
278278
"type": "FULL"
279279
}
280280
],

packages/google-cloud-beyondcorp-appconnectors/src/v1/app_connectors_service_client.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import {
3434
} from 'google-gax';
3535

3636
import {Transform} from 'stream';
37-
import {RequestType} from 'google-gax/build/src/apitypes';
3837
import * as protos from '../../protos/protos';
3938
import jsonProtos = require('../../protos/protos.json');
4039
/**
@@ -443,7 +442,8 @@ export class AppConnectorsServiceClient {
443442
const apiCall = this._gaxModule.createApiCall(
444443
callPromise,
445444
this._defaults[methodName],
446-
descriptor
445+
descriptor,
446+
this._opts.fallback
447447
);
448448

449449
this.innerApiCalls[methodName] = apiCall;
@@ -760,7 +760,7 @@ export class AppConnectorsServiceClient {
760760
const decodeOperation = new gax.Operation(
761761
operation,
762762
this.descriptors.longrunning.createAppConnector,
763-
gax.createDefaultBackoffSettings()
763+
this._gaxModule.createDefaultBackoffSettings()
764764
);
765765
return decodeOperation as LROperation<
766766
protos.google.cloud.beyondcorp.appconnectors.v1.AppConnector,
@@ -921,7 +921,7 @@ export class AppConnectorsServiceClient {
921921
const decodeOperation = new gax.Operation(
922922
operation,
923923
this.descriptors.longrunning.updateAppConnector,
924-
gax.createDefaultBackoffSettings()
924+
this._gaxModule.createDefaultBackoffSettings()
925925
);
926926
return decodeOperation as LROperation<
927927
protos.google.cloud.beyondcorp.appconnectors.v1.AppConnector,
@@ -1076,7 +1076,7 @@ export class AppConnectorsServiceClient {
10761076
const decodeOperation = new gax.Operation(
10771077
operation,
10781078
this.descriptors.longrunning.deleteAppConnector,
1079-
gax.createDefaultBackoffSettings()
1079+
this._gaxModule.createDefaultBackoffSettings()
10801080
);
10811081
return decodeOperation as LROperation<
10821082
protos.google.protobuf.Empty,
@@ -1233,7 +1233,7 @@ export class AppConnectorsServiceClient {
12331233
const decodeOperation = new gax.Operation(
12341234
operation,
12351235
this.descriptors.longrunning.reportStatus,
1236-
gax.createDefaultBackoffSettings()
1236+
this._gaxModule.createDefaultBackoffSettings()
12371237
);
12381238
return decodeOperation as LROperation<
12391239
protos.google.cloud.beyondcorp.appconnectors.v1.AppConnector,
@@ -1405,7 +1405,7 @@ export class AppConnectorsServiceClient {
14051405
const callSettings = defaultCallSettings.merge(options);
14061406
this.initialize();
14071407
return this.descriptors.page.listAppConnectors.createStream(
1408-
this.innerApiCalls.listAppConnectors as gax.GaxCall,
1408+
this.innerApiCalls.listAppConnectors as GaxCall,
14091409
request,
14101410
callSettings
14111411
);
@@ -1467,7 +1467,7 @@ export class AppConnectorsServiceClient {
14671467
this.initialize();
14681468
return this.descriptors.page.listAppConnectors.asyncIterate(
14691469
this.innerApiCalls['listAppConnectors'] as GaxCall,
1470-
request as unknown as RequestType,
1470+
request as {},
14711471
callSettings
14721472
) as AsyncIterable<protos.google.cloud.beyondcorp.appconnectors.v1.IAppConnector>;
14731473
}

packages/google-cloud-beyondcorp-appconnectors/test/gapic_app_connectors_service_v1.ts

Lines changed: 92 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -151,114 +151,111 @@ function stubAsyncIterationCall<ResponseType>(
151151
}
152152

153153
describe('v1.AppConnectorsServiceClient', () => {
154-
it('has servicePath', () => {
155-
const servicePath =
156-
appconnectorsserviceModule.v1.AppConnectorsServiceClient.servicePath;
157-
assert(servicePath);
158-
});
154+
describe('Common methods', () => {
155+
it('has servicePath', () => {
156+
const servicePath =
157+
appconnectorsserviceModule.v1.AppConnectorsServiceClient.servicePath;
158+
assert(servicePath);
159+
});
159160

160-
it('has apiEndpoint', () => {
161-
const apiEndpoint =
162-
appconnectorsserviceModule.v1.AppConnectorsServiceClient.apiEndpoint;
163-
assert(apiEndpoint);
164-
});
161+
it('has apiEndpoint', () => {
162+
const apiEndpoint =
163+
appconnectorsserviceModule.v1.AppConnectorsServiceClient.apiEndpoint;
164+
assert(apiEndpoint);
165+
});
165166

166-
it('has port', () => {
167-
const port = appconnectorsserviceModule.v1.AppConnectorsServiceClient.port;
168-
assert(port);
169-
assert(typeof port === 'number');
170-
});
167+
it('has port', () => {
168+
const port =
169+
appconnectorsserviceModule.v1.AppConnectorsServiceClient.port;
170+
assert(port);
171+
assert(typeof port === 'number');
172+
});
171173

172-
it('should create a client with no option', () => {
173-
const client =
174-
new appconnectorsserviceModule.v1.AppConnectorsServiceClient();
175-
assert(client);
176-
});
174+
it('should create a client with no option', () => {
175+
const client =
176+
new appconnectorsserviceModule.v1.AppConnectorsServiceClient();
177+
assert(client);
178+
});
177179

178-
it('should create a client with gRPC fallback', () => {
179-
const client = new appconnectorsserviceModule.v1.AppConnectorsServiceClient(
180-
{
181-
fallback: true,
182-
}
183-
);
184-
assert(client);
185-
});
180+
it('should create a client with gRPC fallback', () => {
181+
const client =
182+
new appconnectorsserviceModule.v1.AppConnectorsServiceClient({
183+
fallback: true,
184+
});
185+
assert(client);
186+
});
186187

187-
it('has initialize method and supports deferred initialization', async () => {
188-
const client = new appconnectorsserviceModule.v1.AppConnectorsServiceClient(
189-
{
190-
credentials: {client_email: 'bogus', private_key: 'bogus'},
191-
projectId: 'bogus',
192-
}
193-
);
194-
assert.strictEqual(client.appConnectorsServiceStub, undefined);
195-
await client.initialize();
196-
assert(client.appConnectorsServiceStub);
197-
});
188+
it('has initialize method and supports deferred initialization', async () => {
189+
const client =
190+
new appconnectorsserviceModule.v1.AppConnectorsServiceClient({
191+
credentials: {client_email: 'bogus', private_key: 'bogus'},
192+
projectId: 'bogus',
193+
});
194+
assert.strictEqual(client.appConnectorsServiceStub, undefined);
195+
await client.initialize();
196+
assert(client.appConnectorsServiceStub);
197+
});
198198

199-
it('has close method for the initialized client', done => {
200-
const client = new appconnectorsserviceModule.v1.AppConnectorsServiceClient(
201-
{
202-
credentials: {client_email: 'bogus', private_key: 'bogus'},
203-
projectId: 'bogus',
204-
}
205-
);
206-
client.initialize();
207-
assert(client.appConnectorsServiceStub);
208-
client.close().then(() => {
209-
done();
199+
it('has close method for the initialized client', done => {
200+
const client =
201+
new appconnectorsserviceModule.v1.AppConnectorsServiceClient({
202+
credentials: {client_email: 'bogus', private_key: 'bogus'},
203+
projectId: 'bogus',
204+
});
205+
client.initialize();
206+
assert(client.appConnectorsServiceStub);
207+
client.close().then(() => {
208+
done();
209+
});
210210
});
211-
});
212211

213-
it('has close method for the non-initialized client', done => {
214-
const client = new appconnectorsserviceModule.v1.AppConnectorsServiceClient(
215-
{
216-
credentials: {client_email: 'bogus', private_key: 'bogus'},
217-
projectId: 'bogus',
218-
}
219-
);
220-
assert.strictEqual(client.appConnectorsServiceStub, undefined);
221-
client.close().then(() => {
222-
done();
212+
it('has close method for the non-initialized client', done => {
213+
const client =
214+
new appconnectorsserviceModule.v1.AppConnectorsServiceClient({
215+
credentials: {client_email: 'bogus', private_key: 'bogus'},
216+
projectId: 'bogus',
217+
});
218+
assert.strictEqual(client.appConnectorsServiceStub, undefined);
219+
client.close().then(() => {
220+
done();
221+
});
223222
});
224-
});
225223

226-
it('has getProjectId method', async () => {
227-
const fakeProjectId = 'fake-project-id';
228-
const client = new appconnectorsserviceModule.v1.AppConnectorsServiceClient(
229-
{
230-
credentials: {client_email: 'bogus', private_key: 'bogus'},
231-
projectId: 'bogus',
232-
}
233-
);
234-
client.auth.getProjectId = sinon.stub().resolves(fakeProjectId);
235-
const result = await client.getProjectId();
236-
assert.strictEqual(result, fakeProjectId);
237-
assert((client.auth.getProjectId as SinonStub).calledWithExactly());
238-
});
224+
it('has getProjectId method', async () => {
225+
const fakeProjectId = 'fake-project-id';
226+
const client =
227+
new appconnectorsserviceModule.v1.AppConnectorsServiceClient({
228+
credentials: {client_email: 'bogus', private_key: 'bogus'},
229+
projectId: 'bogus',
230+
});
231+
client.auth.getProjectId = sinon.stub().resolves(fakeProjectId);
232+
const result = await client.getProjectId();
233+
assert.strictEqual(result, fakeProjectId);
234+
assert((client.auth.getProjectId as SinonStub).calledWithExactly());
235+
});
239236

240-
it('has getProjectId method with callback', async () => {
241-
const fakeProjectId = 'fake-project-id';
242-
const client = new appconnectorsserviceModule.v1.AppConnectorsServiceClient(
243-
{
244-
credentials: {client_email: 'bogus', private_key: 'bogus'},
245-
projectId: 'bogus',
246-
}
247-
);
248-
client.auth.getProjectId = sinon
249-
.stub()
250-
.callsArgWith(0, null, fakeProjectId);
251-
const promise = new Promise((resolve, reject) => {
252-
client.getProjectId((err?: Error | null, projectId?: string | null) => {
253-
if (err) {
254-
reject(err);
255-
} else {
256-
resolve(projectId);
257-
}
237+
it('has getProjectId method with callback', async () => {
238+
const fakeProjectId = 'fake-project-id';
239+
const client =
240+
new appconnectorsserviceModule.v1.AppConnectorsServiceClient({
241+
credentials: {client_email: 'bogus', private_key: 'bogus'},
242+
projectId: 'bogus',
243+
});
244+
client.auth.getProjectId = sinon
245+
.stub()
246+
.callsArgWith(0, null, fakeProjectId);
247+
const promise = new Promise((resolve, reject) => {
248+
client.getProjectId((err?: Error | null, projectId?: string | null) => {
249+
if (err) {
250+
reject(err);
251+
} else {
252+
resolve(projectId);
253+
}
254+
});
258255
});
256+
const result = await promise;
257+
assert.strictEqual(result, fakeProjectId);
259258
});
260-
const result = await promise;
261-
assert.strictEqual(result, fakeProjectId);
262259
});
263260

264261
describe('getAppConnector', () => {

0 commit comments

Comments
 (0)