diff --git a/packages/google-cloud-networkconnectivity/protos/protos.d.ts b/packages/google-cloud-networkconnectivity/protos/protos.d.ts index ad7526e80c1..c174eb16b26 100644 --- a/packages/google-cloud-networkconnectivity/protos/protos.d.ts +++ b/packages/google-cloud-networkconnectivity/protos/protos.d.ts @@ -2162,19 +2162,19 @@ export namespace google { public selector: string; /** HttpRule get. */ - public get: string; + public get?: (string|null); /** HttpRule put. */ - public put: string; + public put?: (string|null); /** HttpRule post. */ - public post: string; + public post?: (string|null); /** HttpRule delete. */ - public delete: string; + public delete?: (string|null); /** HttpRule patch. */ - public patch: string; + public patch?: (string|null); /** HttpRule custom. */ public custom?: (google.api.ICustomHttpPattern|null); diff --git a/packages/google-cloud-networkconnectivity/protos/protos.js b/packages/google-cloud-networkconnectivity/protos/protos.js index bebd113634a..e5a6c554b62 100644 --- a/packages/google-cloud-networkconnectivity/protos/protos.js +++ b/packages/google-cloud-networkconnectivity/protos/protos.js @@ -5176,43 +5176,43 @@ /** * HttpRule get. - * @member {string} get + * @member {string|null|undefined} get * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.get = ""; + HttpRule.prototype.get = null; /** * HttpRule put. - * @member {string} put + * @member {string|null|undefined} put * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.put = ""; + HttpRule.prototype.put = null; /** * HttpRule post. - * @member {string} post + * @member {string|null|undefined} post * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.post = ""; + HttpRule.prototype.post = null; /** * HttpRule delete. - * @member {string} delete + * @member {string|null|undefined} delete * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype["delete"] = ""; + HttpRule.prototype["delete"] = null; /** * HttpRule patch. - * @member {string} patch + * @member {string|null|undefined} patch * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.patch = ""; + HttpRule.prototype.patch = null; /** * HttpRule custom. diff --git a/packages/google-cloud-networkconnectivity/src/v1alpha1/hub_service_client.ts b/packages/google-cloud-networkconnectivity/src/v1alpha1/hub_service_client.ts index a0ee8bce98c..284312af8ad 100644 --- a/packages/google-cloud-networkconnectivity/src/v1alpha1/hub_service_client.ts +++ b/packages/google-cloud-networkconnectivity/src/v1alpha1/hub_service_client.ts @@ -353,13 +353,14 @@ export class HubServiceClient { ]; for (const methodName of hubServiceStubMethods) { const callPromise = this.hubServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } @@ -524,11 +525,10 @@ export class HubServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.getHub(request, options, callback); } @@ -622,11 +622,10 @@ export class HubServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.getSpoke(request, options, callback); } @@ -746,11 +745,10 @@ export class HubServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.createHub(request, options, callback); } @@ -908,11 +906,10 @@ export class HubServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'hub.name': request.hub!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'hub.name': request.hub!.name || '', + }); this.initialize(); return this.innerApiCalls.updateHub(request, options, callback); } @@ -1064,11 +1061,10 @@ export class HubServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.deleteHub(request, options, callback); } @@ -1224,11 +1220,10 @@ export class HubServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.createSpoke(request, options, callback); } @@ -1386,11 +1381,10 @@ export class HubServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'spoke.name': request.spoke!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'spoke.name': request.spoke!.name || '', + }); this.initialize(); return this.innerApiCalls.updateSpoke(request, options, callback); } @@ -1542,11 +1536,10 @@ export class HubServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.deleteSpoke(request, options, callback); } @@ -1682,11 +1675,10 @@ export class HubServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.listHubs(request, options, callback); } @@ -1725,11 +1717,10 @@ export class HubServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listHubs.createStream( @@ -1779,17 +1770,16 @@ export class HubServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listHubs.asyncIterate( this.innerApiCalls['listHubs'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -1888,11 +1878,10 @@ export class HubServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.listSpokes(request, options, callback); } @@ -1931,11 +1920,10 @@ export class HubServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listSpokes.createStream( @@ -1985,17 +1973,16 @@ export class HubServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listSpokes.asyncIterate( this.innerApiCalls['listSpokes'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-networkconnectivity/test/gapic_hub_service_v1alpha1.ts b/packages/google-cloud-networkconnectivity/test/gapic_hub_service_v1alpha1.ts index 0169be36a22..3066057cdd4 100644 --- a/packages/google-cloud-networkconnectivity/test/gapic_hub_service_v1alpha1.ts +++ b/packages/google-cloud-networkconnectivity/test/gapic_hub_service_v1alpha1.ts @@ -28,10 +28,9 @@ import {PassThrough} from 'stream'; import {protobuf, LROperation, operationsProtos} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -279,9 +278,8 @@ describe('v1alpha1.HubServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.networkconnectivity.v1alpha1.Hub() ); - client.innerApiCalls.getHub = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getHub = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getHub( request, @@ -388,9 +386,8 @@ describe('v1alpha1.HubServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.networkconnectivity.v1alpha1.Spoke() ); - client.innerApiCalls.getSpoke = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getSpoke = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getSpoke( request, @@ -498,9 +495,8 @@ describe('v1alpha1.HubServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createHub = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createHub = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createHub( request, @@ -691,9 +687,8 @@ describe('v1alpha1.HubServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.updateHub = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateHub = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateHub( request, @@ -884,9 +879,8 @@ describe('v1alpha1.HubServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteHub = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteHub = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteHub( request, @@ -1075,9 +1069,8 @@ describe('v1alpha1.HubServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createSpoke = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createSpoke = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createSpoke( request, @@ -1268,9 +1261,8 @@ describe('v1alpha1.HubServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.updateSpoke = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateSpoke = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateSpoke( request, @@ -1461,9 +1453,8 @@ describe('v1alpha1.HubServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteSpoke = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteSpoke = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteSpoke( request, @@ -1667,9 +1658,8 @@ describe('v1alpha1.HubServiceClient', () => { new protos.google.cloud.networkconnectivity.v1alpha1.Hub() ), ]; - client.innerApiCalls.listHubs = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listHubs = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listHubs( request, @@ -1746,12 +1736,12 @@ describe('v1alpha1.HubServiceClient', () => { new protos.google.cloud.networkconnectivity.v1alpha1.Hub() ), ]; - client.descriptors.page.listHubs.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listHubs.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listHubsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1alpha1.Hub[] = []; + const responses: protos.google.cloud.networkconnectivity.v1alpha1.Hub[] = + []; stream.on( 'data', (response: protos.google.cloud.networkconnectivity.v1alpha1.Hub) => { @@ -1797,7 +1787,8 @@ describe('v1alpha1.HubServiceClient', () => { ); const stream = client.listHubsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1alpha1.Hub[] = []; + const responses: protos.google.cloud.networkconnectivity.v1alpha1.Hub[] = + []; stream.on( 'data', (response: protos.google.cloud.networkconnectivity.v1alpha1.Hub) => { @@ -1846,10 +1837,10 @@ describe('v1alpha1.HubServiceClient', () => { new protos.google.cloud.networkconnectivity.v1alpha1.Hub() ), ]; - client.descriptors.page.listHubs.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.networkconnectivity.v1alpha1.IHub[] = []; + client.descriptors.page.listHubs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networkconnectivity.v1alpha1.IHub[] = + []; const iterable = client.listHubsAsync(request); for await (const resource of iterable) { responses.push(resource!); @@ -1885,7 +1876,8 @@ describe('v1alpha1.HubServiceClient', () => { ); const iterable = client.listHubsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.networkconnectivity.v1alpha1.IHub[] = []; + const responses: protos.google.cloud.networkconnectivity.v1alpha1.IHub[] = + []; for await (const resource of iterable) { responses.push(resource!); } @@ -1972,9 +1964,8 @@ describe('v1alpha1.HubServiceClient', () => { new protos.google.cloud.networkconnectivity.v1alpha1.Spoke() ), ]; - client.innerApiCalls.listSpokes = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listSpokes = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listSpokes( request, @@ -2054,12 +2045,12 @@ describe('v1alpha1.HubServiceClient', () => { new protos.google.cloud.networkconnectivity.v1alpha1.Spoke() ), ]; - client.descriptors.page.listSpokes.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listSpokes.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listSpokesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1alpha1.Spoke[] = []; + const responses: protos.google.cloud.networkconnectivity.v1alpha1.Spoke[] = + []; stream.on( 'data', ( @@ -2108,7 +2099,8 @@ describe('v1alpha1.HubServiceClient', () => { ); const stream = client.listSpokesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1alpha1.Spoke[] = []; + const responses: protos.google.cloud.networkconnectivity.v1alpha1.Spoke[] = + []; stream.on( 'data', ( @@ -2160,10 +2152,10 @@ describe('v1alpha1.HubServiceClient', () => { new protos.google.cloud.networkconnectivity.v1alpha1.Spoke() ), ]; - client.descriptors.page.listSpokes.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[] = []; + client.descriptors.page.listSpokes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[] = + []; const iterable = client.listSpokesAsync(request); for await (const resource of iterable) { responses.push(resource!); @@ -2201,7 +2193,8 @@ describe('v1alpha1.HubServiceClient', () => { ); const iterable = client.listSpokesAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[] = []; + const responses: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[] = + []; for await (const resource of iterable) { responses.push(resource!); } @@ -2362,47 +2355,52 @@ describe('v1alpha1.HubServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.interconnectAttachmentPathTemplate - .render as SinonStub) + ( + client.pathTemplates.interconnectAttachmentPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromInterconnectAttachmentName', () => { - const result = client.matchProjectFromInterconnectAttachmentName( - fakePath - ); + const result = + client.matchProjectFromInterconnectAttachmentName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.interconnectAttachmentPathTemplate - .match as SinonStub) + ( + client.pathTemplates.interconnectAttachmentPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchRegionFromInterconnectAttachmentName', () => { - const result = client.matchRegionFromInterconnectAttachmentName( - fakePath - ); + const result = + client.matchRegionFromInterconnectAttachmentName(fakePath); assert.strictEqual(result, 'regionValue'); assert( - (client.pathTemplates.interconnectAttachmentPathTemplate - .match as SinonStub) + ( + client.pathTemplates.interconnectAttachmentPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchResourceIdFromInterconnectAttachmentName', () => { - const result = client.matchResourceIdFromInterconnectAttachmentName( - fakePath - ); + const result = + client.matchResourceIdFromInterconnectAttachmentName(fakePath); assert.strictEqual(result, 'resourceIdValue'); assert( - (client.pathTemplates.interconnectAttachmentPathTemplate - .match as SinonStub) + ( + client.pathTemplates.interconnectAttachmentPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) );