diff --git a/packages/google-cloud-asset/protos/protos.d.ts b/packages/google-cloud-asset/protos/protos.d.ts index c30e22437d19..1805359ec45f 100644 --- a/packages/google-cloud-asset/protos/protos.d.ts +++ b/packages/google-cloud-asset/protos/protos.d.ts @@ -1555,10 +1555,10 @@ export namespace google { constructor(properties?: google.cloud.asset.v1.IGcsDestination); /** GcsDestination uri. */ - public uri: string; + public uri?: (string|null); /** GcsDestination uriPrefix. */ - public uriPrefix: string; + public uriPrefix?: (string|null); /** GcsDestination objectUri. */ public objectUri?: ("uri"|"uriPrefix"); @@ -5156,10 +5156,10 @@ export namespace google { constructor(properties?: google.cloud.asset.v1.IamPolicyAnalysisResult.IAccess); /** Access role. */ - public role: string; + public role?: (string|null); /** Access permission. */ - public permission: string; + public permission?: (string|null); /** Access analysisState. */ public analysisState?: (google.cloud.asset.v1.IIamPolicyAnalysisState|null); @@ -7349,7 +7349,7 @@ export namespace google { constructor(properties?: google.cloud.asset.v1p2beta1.IGcsDestination); /** GcsDestination uri. */ - public uri: string; + public uri?: (string|null); /** GcsDestination objectUri. */ public objectUri?: "uri"; @@ -9888,10 +9888,10 @@ export namespace google { constructor(properties?: google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult.IAccess); /** Access role. */ - public role: string; + public role?: (string|null); /** Access permission. */ - public permission: string; + public permission?: (string|null); /** Access analysisState. */ public analysisState?: (google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult.IAnalysisState|null); @@ -12563,19 +12563,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); @@ -16539,16 +16539,16 @@ export namespace google { constructor(properties?: google.protobuf.IValue); /** Value nullValue. */ - public nullValue: (google.protobuf.NullValue|keyof typeof google.protobuf.NullValue); + public nullValue?: (google.protobuf.NullValue|keyof typeof google.protobuf.NullValue|null); /** Value numberValue. */ - public numberValue: number; + public numberValue?: (number|null); /** Value stringValue. */ - public stringValue: string; + public stringValue?: (string|null); /** Value boolValue. */ - public boolValue: boolean; + public boolValue?: (boolean|null); /** Value structValue. */ public structValue?: (google.protobuf.IStruct|null); diff --git a/packages/google-cloud-asset/protos/protos.js b/packages/google-cloud-asset/protos/protos.js index 87a84853102e..948a7f075f30 100644 --- a/packages/google-cloud-asset/protos/protos.js +++ b/packages/google-cloud-asset/protos/protos.js @@ -3476,19 +3476,19 @@ /** * GcsDestination uri. - * @member {string} uri + * @member {string|null|undefined} uri * @memberof google.cloud.asset.v1.GcsDestination * @instance */ - GcsDestination.prototype.uri = ""; + GcsDestination.prototype.uri = null; /** * GcsDestination uriPrefix. - * @member {string} uriPrefix + * @member {string|null|undefined} uriPrefix * @memberof google.cloud.asset.v1.GcsDestination * @instance */ - GcsDestination.prototype.uriPrefix = ""; + GcsDestination.prototype.uriPrefix = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -12459,19 +12459,19 @@ /** * Access role. - * @member {string} role + * @member {string|null|undefined} role * @memberof google.cloud.asset.v1.IamPolicyAnalysisResult.Access * @instance */ - Access.prototype.role = ""; + Access.prototype.role = null; /** * Access permission. - * @member {string} permission + * @member {string|null|undefined} permission * @memberof google.cloud.asset.v1.IamPolicyAnalysisResult.Access * @instance */ - Access.prototype.permission = ""; + Access.prototype.permission = null; /** * Access analysisState. @@ -17616,11 +17616,11 @@ /** * GcsDestination uri. - * @member {string} uri + * @member {string|null|undefined} uri * @memberof google.cloud.asset.v1p2beta1.GcsDestination * @instance */ - GcsDestination.prototype.uri = ""; + GcsDestination.prototype.uri = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -23696,19 +23696,19 @@ /** * Access role. - * @member {string} role + * @member {string|null|undefined} role * @memberof google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult.Access * @instance */ - Access.prototype.role = ""; + Access.prototype.role = null; /** * Access permission. - * @member {string} permission + * @member {string|null|undefined} permission * @memberof google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult.Access * @instance */ - Access.prototype.permission = ""; + Access.prototype.permission = null; /** * Access analysisState. @@ -30646,43 +30646,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. @@ -41516,35 +41516,35 @@ /** * Value nullValue. - * @member {google.protobuf.NullValue} nullValue + * @member {google.protobuf.NullValue|null|undefined} nullValue * @memberof google.protobuf.Value * @instance */ - Value.prototype.nullValue = 0; + Value.prototype.nullValue = null; /** * Value numberValue. - * @member {number} numberValue + * @member {number|null|undefined} numberValue * @memberof google.protobuf.Value * @instance */ - Value.prototype.numberValue = 0; + Value.prototype.numberValue = null; /** * Value stringValue. - * @member {string} stringValue + * @member {string|null|undefined} stringValue * @memberof google.protobuf.Value * @instance */ - Value.prototype.stringValue = ""; + Value.prototype.stringValue = null; /** * Value boolValue. - * @member {boolean} boolValue + * @member {boolean|null|undefined} boolValue * @memberof google.protobuf.Value * @instance */ - Value.prototype.boolValue = false; + Value.prototype.boolValue = null; /** * Value structValue. diff --git a/packages/google-cloud-asset/src/v1/asset_service_client.ts b/packages/google-cloud-asset/src/v1/asset_service_client.ts index cfb9c1d126a6..e79c94cac941 100644 --- a/packages/google-cloud-asset/src/v1/asset_service_client.ts +++ b/packages/google-cloud-asset/src/v1/asset_service_client.ts @@ -301,13 +301,14 @@ export class AssetServiceClient { ]; for (const methodName of assetServiceStubMethods) { const callPromise = this.assetServiceStub.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; } @@ -492,11 +493,10 @@ export class AssetServiceClient { 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.batchGetAssetsHistory(request, options, callback); } @@ -590,11 +590,10 @@ export class AssetServiceClient { 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.createFeed(request, options, callback); } @@ -677,11 +676,10 @@ export class AssetServiceClient { 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.getFeed(request, options, callback); } @@ -763,11 +761,10 @@ export class AssetServiceClient { 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.listFeeds(request, options, callback); } @@ -855,11 +852,10 @@ export class AssetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'feed.name': request.feed!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'feed.name': request.feed!.name || '', + }); this.initialize(); return this.innerApiCalls.updateFeed(request, options, callback); } @@ -942,11 +938,10 @@ export class AssetServiceClient { 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.deleteFeed(request, options, callback); } @@ -1040,11 +1035,10 @@ export class AssetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'analysis_query.scope': request.analysisQuery!.scope || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'analysis_query.scope': request.analysisQuery!.scope || '', + }); this.initialize(); return this.innerApiCalls.analyzeIamPolicy(request, options, callback); } @@ -1188,11 +1182,10 @@ export class AssetServiceClient { 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.exportAssets(request, options, callback); } @@ -1340,11 +1333,10 @@ export class AssetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'analysis_query.scope': request.analysisQuery!.scope || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'analysis_query.scope': request.analysisQuery!.scope || '', + }); this.initialize(); return this.innerApiCalls.analyzeIamPolicyLongrunning( request, @@ -1548,11 +1540,10 @@ export class AssetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - scope: request.scope || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + scope: request.scope || '', + }); this.initialize(); return this.innerApiCalls.searchAllResources(request, options, callback); } @@ -1652,11 +1643,10 @@ export class AssetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - scope: request.scope || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + scope: request.scope || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.searchAllResources.createStream( @@ -1767,17 +1757,16 @@ export class AssetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - scope: request.scope || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + scope: request.scope || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.searchAllResources.asyncIterate( this.innerApiCalls['searchAllResources'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -1919,11 +1908,10 @@ export class AssetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - scope: request.scope || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + scope: request.scope || '', + }); this.initialize(); return this.innerApiCalls.searchAllIamPolicies(request, options, callback); } @@ -2002,11 +1990,10 @@ export class AssetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - scope: request.scope || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + scope: request.scope || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.searchAllIamPolicies.createStream( @@ -2096,17 +2083,16 @@ export class AssetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - scope: request.scope || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + scope: request.scope || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.searchAllIamPolicies.asyncIterate( this.innerApiCalls['searchAllIamPolicies'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-asset/src/v1p1beta1/asset_service_client.ts b/packages/google-cloud-asset/src/v1p1beta1/asset_service_client.ts index 11ca20e3d5b7..b409b71d0519 100644 --- a/packages/google-cloud-asset/src/v1p1beta1/asset_service_client.ts +++ b/packages/google-cloud-asset/src/v1p1beta1/asset_service_client.ts @@ -228,13 +228,14 @@ export class AssetServiceClient { ]; for (const methodName of assetServiceStubMethods) { const callPromise = this.assetServiceStub.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; } @@ -424,11 +425,10 @@ export class AssetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - scope: request.scope || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + scope: request.scope || '', + }); this.initialize(); return this.innerApiCalls.searchAllResources(request, options, callback); } @@ -484,11 +484,10 @@ export class AssetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - scope: request.scope || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + scope: request.scope || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.searchAllResources.createStream( @@ -555,17 +554,16 @@ export class AssetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - scope: request.scope || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + scope: request.scope || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.searchAllResources.asyncIterate( this.innerApiCalls['searchAllResources'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -681,11 +679,10 @@ export class AssetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - scope: request.scope || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + scope: request.scope || '', + }); this.initialize(); return this.innerApiCalls.searchAllIamPolicies(request, options, callback); } @@ -736,11 +733,10 @@ export class AssetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - scope: request.scope || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + scope: request.scope || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.searchAllIamPolicies.createStream( @@ -802,17 +798,16 @@ export class AssetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - scope: request.scope || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + scope: request.scope || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.searchAllIamPolicies.asyncIterate( this.innerApiCalls['searchAllIamPolicies'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-asset/src/v1p2beta1/asset_service_client.ts b/packages/google-cloud-asset/src/v1p2beta1/asset_service_client.ts index 211169485d05..17a6b3554724 100644 --- a/packages/google-cloud-asset/src/v1p2beta1/asset_service_client.ts +++ b/packages/google-cloud-asset/src/v1p2beta1/asset_service_client.ts @@ -222,13 +222,14 @@ export class AssetServiceClient { ]; for (const methodName of assetServiceStubMethods) { const callPromise = this.assetServiceStub.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; } @@ -392,11 +393,10 @@ export class AssetServiceClient { 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.createFeed(request, options, callback); } @@ -481,11 +481,10 @@ export class AssetServiceClient { 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.getFeed(request, options, callback); } @@ -569,11 +568,10 @@ export class AssetServiceClient { 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.listFeeds(request, options, callback); } @@ -663,11 +661,10 @@ export class AssetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'feed.name': request.feed!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'feed.name': request.feed!.name || '', + }); this.initialize(); return this.innerApiCalls.updateFeed(request, options, callback); } @@ -752,11 +749,10 @@ export class AssetServiceClient { 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.deleteFeed(request, options, callback); } diff --git a/packages/google-cloud-asset/src/v1p4beta1/asset_service_client.ts b/packages/google-cloud-asset/src/v1p4beta1/asset_service_client.ts index 3e67e0543f71..1cfe587e733a 100644 --- a/packages/google-cloud-asset/src/v1p4beta1/asset_service_client.ts +++ b/packages/google-cloud-asset/src/v1p4beta1/asset_service_client.ts @@ -245,13 +245,14 @@ export class AssetServiceClient { ]; for (const methodName of assetServiceStubMethods) { const callPromise = this.assetServiceStub.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; } @@ -410,11 +411,10 @@ export class AssetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'analysis_query.parent': request.analysisQuery!.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'analysis_query.parent': request.analysisQuery!.parent || '', + }); this.initialize(); return this.innerApiCalls.analyzeIamPolicy(request, options, callback); } @@ -523,11 +523,10 @@ export class AssetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'analysis_query.parent': request.analysisQuery!.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'analysis_query.parent': request.analysisQuery!.parent || '', + }); this.initialize(); return this.innerApiCalls.exportIamPolicyAnalysis( request, diff --git a/packages/google-cloud-asset/src/v1p5beta1/asset_service_client.ts b/packages/google-cloud-asset/src/v1p5beta1/asset_service_client.ts index 437c5d3a7eaa..b7f5150806e2 100644 --- a/packages/google-cloud-asset/src/v1p5beta1/asset_service_client.ts +++ b/packages/google-cloud-asset/src/v1p5beta1/asset_service_client.ts @@ -220,13 +220,14 @@ export class AssetServiceClient { const assetServiceStubMethods = ['listAssets']; for (const methodName of assetServiceStubMethods) { const callPromise = this.assetServiceStub.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; } @@ -412,11 +413,10 @@ export class AssetServiceClient { 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.listAssets(request, options, callback); } @@ -472,11 +472,10 @@ export class AssetServiceClient { 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.listAssets.createStream( @@ -543,17 +542,16 @@ export class AssetServiceClient { 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.listAssets.asyncIterate( this.innerApiCalls['listAssets'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-asset/test/gapic_asset_service_v1.ts b/packages/google-cloud-asset/test/gapic_asset_service_v1.ts index 53a1913e6a5c..8bf238571a5f 100644 --- a/packages/google-cloud-asset/test/gapic_asset_service_v1.ts +++ b/packages/google-cloud-asset/test/gapic_asset_service_v1.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; @@ -248,9 +247,8 @@ describe('v1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.asset.v1.BatchGetAssetsHistoryResponse() ); - client.innerApiCalls.batchGetAssetsHistory = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.batchGetAssetsHistory = + stubSimpleCall(expectedResponse); const [response] = await client.batchGetAssetsHistory(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -281,9 +279,8 @@ describe('v1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.asset.v1.BatchGetAssetsHistoryResponse() ); - client.innerApiCalls.batchGetAssetsHistory = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.batchGetAssetsHistory = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.batchGetAssetsHistory( request, @@ -396,9 +393,8 @@ describe('v1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.asset.v1.Feed() ); - client.innerApiCalls.createFeed = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createFeed = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createFeed( request, @@ -508,9 +504,8 @@ describe('v1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.asset.v1.Feed() ); - client.innerApiCalls.getFeed = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getFeed = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getFeed( request, @@ -617,9 +612,8 @@ describe('v1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.asset.v1.ListFeedsResponse() ); - client.innerApiCalls.listFeeds = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listFeeds = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listFeeds( request, @@ -728,9 +722,8 @@ describe('v1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.asset.v1.Feed() ); - client.innerApiCalls.updateFeed = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateFeed = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateFeed( request, @@ -841,9 +834,8 @@ describe('v1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.deleteFeed = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteFeed = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteFeed( request, @@ -955,9 +947,8 @@ describe('v1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.asset.v1.AnalyzeIamPolicyResponse() ); - client.innerApiCalls.analyzeIamPolicy = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.analyzeIamPolicy = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.analyzeIamPolicy( request, @@ -1069,9 +1060,8 @@ describe('v1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.exportAssets = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.exportAssets = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.exportAssets( request, @@ -1229,9 +1219,8 @@ describe('v1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.analyzeIamPolicyLongrunning = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.analyzeIamPolicyLongrunning = + stubLongRunningCall(expectedResponse); const [operation] = await client.analyzeIamPolicyLongrunning(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -1264,9 +1253,8 @@ describe('v1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.analyzeIamPolicyLongrunning = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.analyzeIamPolicyLongrunning = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.analyzeIamPolicyLongrunning( request, @@ -1381,9 +1369,10 @@ describe('v1.AssetServiceClient', () => { expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkAnalyzeIamPolicyLongrunningProgress( - expectedResponse.name - ); + const decodedOperation = + await client.checkAnalyzeIamPolicyLongrunningProgress( + expectedResponse.name + ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); assert(decodedOperation.metadata); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); @@ -1439,9 +1428,8 @@ describe('v1.AssetServiceClient', () => { new protos.google.cloud.asset.v1.ResourceSearchResult() ), ]; - client.innerApiCalls.searchAllResources = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.searchAllResources = + stubSimpleCall(expectedResponse); const [response] = await client.searchAllResources(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1480,9 +1468,8 @@ describe('v1.AssetServiceClient', () => { new protos.google.cloud.asset.v1.ResourceSearchResult() ), ]; - client.innerApiCalls.searchAllResources = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.searchAllResources = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.searchAllResources( request, @@ -1560,12 +1547,12 @@ describe('v1.AssetServiceClient', () => { new protos.google.cloud.asset.v1.ResourceSearchResult() ), ]; - client.descriptors.page.searchAllResources.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.searchAllResources.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.searchAllResourcesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1.ResourceSearchResult[] = []; + const responses: protos.google.cloud.asset.v1.ResourceSearchResult[] = + []; stream.on( 'data', (response: protos.google.cloud.asset.v1.ResourceSearchResult) => { @@ -1587,10 +1574,9 @@ describe('v1.AssetServiceClient', () => { .calledWith(client.innerApiCalls.searchAllResources, request) ); assert.strictEqual( - (client.descriptors.page.searchAllResources - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchAllResources.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1607,13 +1593,12 @@ describe('v1.AssetServiceClient', () => { request.scope = ''; const expectedHeaderRequestParams = 'scope='; const expectedError = new Error('expected'); - client.descriptors.page.searchAllResources.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.searchAllResources.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.searchAllResourcesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1.ResourceSearchResult[] = []; + const responses: protos.google.cloud.asset.v1.ResourceSearchResult[] = + []; stream.on( 'data', (response: protos.google.cloud.asset.v1.ResourceSearchResult) => { @@ -1634,10 +1619,9 @@ describe('v1.AssetServiceClient', () => { .calledWith(client.innerApiCalls.searchAllResources, request) ); assert.strictEqual( - (client.descriptors.page.searchAllResources - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchAllResources.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1664,25 +1648,25 @@ describe('v1.AssetServiceClient', () => { new protos.google.cloud.asset.v1.ResourceSearchResult() ), ]; - client.descriptors.page.searchAllResources.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.asset.v1.IResourceSearchResult[] = []; + client.descriptors.page.searchAllResources.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.asset.v1.IResourceSearchResult[] = + []; const iterable = client.searchAllResourcesAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.searchAllResources - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.searchAllResources.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.searchAllResources - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchAllResources.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1699,27 +1683,26 @@ describe('v1.AssetServiceClient', () => { request.scope = ''; const expectedHeaderRequestParams = 'scope='; const expectedError = new Error('expected'); - client.descriptors.page.searchAllResources.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.searchAllResources.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.searchAllResourcesAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.asset.v1.IResourceSearchResult[] = []; + const responses: protos.google.cloud.asset.v1.IResourceSearchResult[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.searchAllResources - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.searchAllResources.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.searchAllResources - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchAllResources.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1755,9 +1738,8 @@ describe('v1.AssetServiceClient', () => { new protos.google.cloud.asset.v1.IamPolicySearchResult() ), ]; - client.innerApiCalls.searchAllIamPolicies = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.searchAllIamPolicies = + stubSimpleCall(expectedResponse); const [response] = await client.searchAllIamPolicies(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1796,9 +1778,8 @@ describe('v1.AssetServiceClient', () => { new protos.google.cloud.asset.v1.IamPolicySearchResult() ), ]; - client.innerApiCalls.searchAllIamPolicies = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.searchAllIamPolicies = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.searchAllIamPolicies( request, @@ -1878,12 +1859,12 @@ describe('v1.AssetServiceClient', () => { new protos.google.cloud.asset.v1.IamPolicySearchResult() ), ]; - client.descriptors.page.searchAllIamPolicies.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.searchAllIamPolicies.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.searchAllIamPoliciesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1.IamPolicySearchResult[] = []; + const responses: protos.google.cloud.asset.v1.IamPolicySearchResult[] = + []; stream.on( 'data', (response: protos.google.cloud.asset.v1.IamPolicySearchResult) => { @@ -1905,10 +1886,9 @@ describe('v1.AssetServiceClient', () => { .calledWith(client.innerApiCalls.searchAllIamPolicies, request) ); assert.strictEqual( - (client.descriptors.page.searchAllIamPolicies - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchAllIamPolicies.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1925,13 +1905,12 @@ describe('v1.AssetServiceClient', () => { request.scope = ''; const expectedHeaderRequestParams = 'scope='; const expectedError = new Error('expected'); - client.descriptors.page.searchAllIamPolicies.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.searchAllIamPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.searchAllIamPoliciesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1.IamPolicySearchResult[] = []; + const responses: protos.google.cloud.asset.v1.IamPolicySearchResult[] = + []; stream.on( 'data', (response: protos.google.cloud.asset.v1.IamPolicySearchResult) => { @@ -1952,10 +1931,9 @@ describe('v1.AssetServiceClient', () => { .calledWith(client.innerApiCalls.searchAllIamPolicies, request) ); assert.strictEqual( - (client.descriptors.page.searchAllIamPolicies - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchAllIamPolicies.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1982,25 +1960,25 @@ describe('v1.AssetServiceClient', () => { new protos.google.cloud.asset.v1.IamPolicySearchResult() ), ]; - client.descriptors.page.searchAllIamPolicies.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.asset.v1.IIamPolicySearchResult[] = []; + client.descriptors.page.searchAllIamPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.asset.v1.IIamPolicySearchResult[] = + []; const iterable = client.searchAllIamPoliciesAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.searchAllIamPolicies - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.searchAllIamPolicies - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2017,27 +1995,26 @@ describe('v1.AssetServiceClient', () => { request.scope = ''; const expectedHeaderRequestParams = 'scope='; const expectedError = new Error('expected'); - client.descriptors.page.searchAllIamPolicies.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.searchAllIamPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.searchAllIamPoliciesAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.asset.v1.IIamPolicySearchResult[] = []; + const responses: protos.google.cloud.asset.v1.IIamPolicySearchResult[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.searchAllIamPolicies - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.searchAllIamPolicies - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2118,17 +2095,18 @@ describe('v1.AssetServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.organizationFeedPathTemplate - .render as SinonStub) + ( + client.pathTemplates.organizationFeedPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchOrganizationFromOrganizationFeedName', () => { - const result = client.matchOrganizationFromOrganizationFeedName( - fakePath - ); + const result = + client.matchOrganizationFromOrganizationFeedName(fakePath); assert.strictEqual(result, 'organizationValue'); assert( (client.pathTemplates.organizationFeedPathTemplate.match as SinonStub) diff --git a/packages/google-cloud-asset/test/gapic_asset_service_v1p1beta1.ts b/packages/google-cloud-asset/test/gapic_asset_service_v1p1beta1.ts index b1ad49ac34f3..ffdf6762df3d 100644 --- a/packages/google-cloud-asset/test/gapic_asset_service_v1p1beta1.ts +++ b/packages/google-cloud-asset/test/gapic_asset_service_v1p1beta1.ts @@ -28,10 +28,9 @@ import {PassThrough} from 'stream'; import {protobuf} 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; @@ -226,9 +225,8 @@ describe('v1p1beta1.AssetServiceClient', () => { new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata() ), ]; - client.innerApiCalls.searchAllResources = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.searchAllResources = + stubSimpleCall(expectedResponse); const [response] = await client.searchAllResources(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -267,9 +265,8 @@ describe('v1p1beta1.AssetServiceClient', () => { new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata() ), ]; - client.innerApiCalls.searchAllResources = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.searchAllResources = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.searchAllResources( request, @@ -349,12 +346,12 @@ describe('v1p1beta1.AssetServiceClient', () => { new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata() ), ]; - client.descriptors.page.searchAllResources.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.searchAllResources.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.searchAllResourcesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata[] = []; + const responses: protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata[] = + []; stream.on( 'data', ( @@ -378,10 +375,9 @@ describe('v1p1beta1.AssetServiceClient', () => { .calledWith(client.innerApiCalls.searchAllResources, request) ); assert.strictEqual( - (client.descriptors.page.searchAllResources - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchAllResources.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -398,13 +394,12 @@ describe('v1p1beta1.AssetServiceClient', () => { request.scope = ''; const expectedHeaderRequestParams = 'scope='; const expectedError = new Error('expected'); - client.descriptors.page.searchAllResources.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.searchAllResources.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.searchAllResourcesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata[] = []; + const responses: protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata[] = + []; stream.on( 'data', ( @@ -427,10 +422,9 @@ describe('v1p1beta1.AssetServiceClient', () => { .calledWith(client.innerApiCalls.searchAllResources, request) ); assert.strictEqual( - (client.descriptors.page.searchAllResources - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchAllResources.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -457,25 +451,25 @@ describe('v1p1beta1.AssetServiceClient', () => { new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata() ), ]; - client.descriptors.page.searchAllResources.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata[] = []; + client.descriptors.page.searchAllResources.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata[] = + []; const iterable = client.searchAllResourcesAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.searchAllResources - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.searchAllResources.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.searchAllResources - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchAllResources.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -492,27 +486,26 @@ describe('v1p1beta1.AssetServiceClient', () => { request.scope = ''; const expectedHeaderRequestParams = 'scope='; const expectedError = new Error('expected'); - client.descriptors.page.searchAllResources.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.searchAllResources.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.searchAllResourcesAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata[] = []; + const responses: protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.searchAllResources - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.searchAllResources.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.searchAllResources - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchAllResources.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -548,9 +541,8 @@ describe('v1p1beta1.AssetServiceClient', () => { new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult() ), ]; - client.innerApiCalls.searchAllIamPolicies = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.searchAllIamPolicies = + stubSimpleCall(expectedResponse); const [response] = await client.searchAllIamPolicies(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -589,9 +581,8 @@ describe('v1p1beta1.AssetServiceClient', () => { new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult() ), ]; - client.innerApiCalls.searchAllIamPolicies = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.searchAllIamPolicies = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.searchAllIamPolicies( request, @@ -671,12 +662,12 @@ describe('v1p1beta1.AssetServiceClient', () => { new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult() ), ]; - client.descriptors.page.searchAllIamPolicies.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.searchAllIamPolicies.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.searchAllIamPoliciesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult[] = []; + const responses: protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult[] = + []; stream.on( 'data', ( @@ -700,10 +691,9 @@ describe('v1p1beta1.AssetServiceClient', () => { .calledWith(client.innerApiCalls.searchAllIamPolicies, request) ); assert.strictEqual( - (client.descriptors.page.searchAllIamPolicies - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchAllIamPolicies.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -720,13 +710,12 @@ describe('v1p1beta1.AssetServiceClient', () => { request.scope = ''; const expectedHeaderRequestParams = 'scope='; const expectedError = new Error('expected'); - client.descriptors.page.searchAllIamPolicies.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.searchAllIamPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.searchAllIamPoliciesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult[] = []; + const responses: protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult[] = + []; stream.on( 'data', ( @@ -749,10 +738,9 @@ describe('v1p1beta1.AssetServiceClient', () => { .calledWith(client.innerApiCalls.searchAllIamPolicies, request) ); assert.strictEqual( - (client.descriptors.page.searchAllIamPolicies - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchAllIamPolicies.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -779,25 +767,25 @@ describe('v1p1beta1.AssetServiceClient', () => { new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult() ), ]; - client.descriptors.page.searchAllIamPolicies.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult[] = []; + client.descriptors.page.searchAllIamPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult[] = + []; const iterable = client.searchAllIamPoliciesAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.searchAllIamPolicies - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.searchAllIamPolicies - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -814,27 +802,26 @@ describe('v1p1beta1.AssetServiceClient', () => { request.scope = ''; const expectedHeaderRequestParams = 'scope='; const expectedError = new Error('expected'); - client.descriptors.page.searchAllIamPolicies.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.searchAllIamPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.searchAllIamPoliciesAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult[] = []; + const responses: protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.searchAllIamPolicies - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.searchAllIamPolicies - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); diff --git a/packages/google-cloud-asset/test/gapic_asset_service_v1p2beta1.ts b/packages/google-cloud-asset/test/gapic_asset_service_v1p2beta1.ts index cff6c54b53c4..2e391e2c83b7 100644 --- a/packages/google-cloud-asset/test/gapic_asset_service_v1p2beta1.ts +++ b/packages/google-cloud-asset/test/gapic_asset_service_v1p2beta1.ts @@ -26,10 +26,9 @@ import * as assetserviceModule from '../src'; import {protobuf} 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; @@ -186,9 +185,8 @@ describe('v1p2beta1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.asset.v1p2beta1.Feed() ); - client.innerApiCalls.createFeed = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createFeed = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createFeed( request, @@ -298,9 +296,8 @@ describe('v1p2beta1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.asset.v1p2beta1.Feed() ); - client.innerApiCalls.getFeed = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getFeed = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getFeed( request, @@ -407,9 +404,8 @@ describe('v1p2beta1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.asset.v1p2beta1.ListFeedsResponse() ); - client.innerApiCalls.listFeeds = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listFeeds = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listFeeds( request, @@ -518,9 +514,8 @@ describe('v1p2beta1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.asset.v1p2beta1.Feed() ); - client.innerApiCalls.updateFeed = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateFeed = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateFeed( request, @@ -631,9 +626,8 @@ describe('v1p2beta1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.deleteFeed = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteFeed = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteFeed( request, @@ -765,17 +759,18 @@ describe('v1p2beta1.AssetServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.organizationFeedPathTemplate - .render as SinonStub) + ( + client.pathTemplates.organizationFeedPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchOrganizationFromOrganizationFeedName', () => { - const result = client.matchOrganizationFromOrganizationFeedName( - fakePath - ); + const result = + client.matchOrganizationFromOrganizationFeedName(fakePath); assert.strictEqual(result, 'organizationValue'); assert( (client.pathTemplates.organizationFeedPathTemplate.match as SinonStub) diff --git a/packages/google-cloud-asset/test/gapic_asset_service_v1p4beta1.ts b/packages/google-cloud-asset/test/gapic_asset_service_v1p4beta1.ts index 4b48aa3472cf..a61c35005b6d 100644 --- a/packages/google-cloud-asset/test/gapic_asset_service_v1p4beta1.ts +++ b/packages/google-cloud-asset/test/gapic_asset_service_v1p4beta1.ts @@ -26,10 +26,9 @@ import * as assetserviceModule from '../src'; 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; @@ -220,9 +219,8 @@ describe('v1p4beta1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.asset.v1p4beta1.AnalyzeIamPolicyResponse() ); - client.innerApiCalls.analyzeIamPolicy = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.analyzeIamPolicy = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.analyzeIamPolicy( request, @@ -303,9 +301,8 @@ describe('v1p4beta1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.exportIamPolicyAnalysis = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.exportIamPolicyAnalysis = + stubLongRunningCall(expectedResponse); const [operation] = await client.exportIamPolicyAnalysis(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -338,9 +335,8 @@ describe('v1p4beta1.AssetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.exportIamPolicyAnalysis = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.exportIamPolicyAnalysis = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.exportIamPolicyAnalysis( request, @@ -455,9 +451,10 @@ describe('v1p4beta1.AssetServiceClient', () => { expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportIamPolicyAnalysisProgress( - expectedResponse.name - ); + const decodedOperation = + await client.checkExportIamPolicyAnalysisProgress( + expectedResponse.name + ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); assert(decodedOperation.metadata); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); diff --git a/packages/google-cloud-asset/test/gapic_asset_service_v1p5beta1.ts b/packages/google-cloud-asset/test/gapic_asset_service_v1p5beta1.ts index 3c6106303455..afba2ecd1bb2 100644 --- a/packages/google-cloud-asset/test/gapic_asset_service_v1p5beta1.ts +++ b/packages/google-cloud-asset/test/gapic_asset_service_v1p5beta1.ts @@ -28,10 +28,9 @@ import {PassThrough} from 'stream'; import {protobuf} 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; @@ -253,9 +252,8 @@ describe('v1p5beta1.AssetServiceClient', () => { generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), ]; - client.innerApiCalls.listAssets = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listAssets = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listAssets( request, @@ -327,9 +325,8 @@ describe('v1p5beta1.AssetServiceClient', () => { generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), ]; - client.descriptors.page.listAssets.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listAssets.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listAssetsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.asset.v1p5beta1.Asset[] = []; @@ -423,9 +420,8 @@ describe('v1p5beta1.AssetServiceClient', () => { generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), ]; - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listAssets.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.asset.v1p5beta1.IAsset[] = []; const iterable = client.listAssetsAsync(request); for await (const resource of iterable) {