From 28ae046a30b62a6f564442369ba4bb54111ef08c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 17:01:02 +0000 Subject: [PATCH] chore: new owl bot post processor docker image (#121) gcr.io/repo-automation-bots/owlbot-nodejs:latest@sha256:f93bb861d6f12574437bb9aee426b71eafd63b419669ff0ed029f4b7e7162e3f --- .../protos/protos.d.ts | 78 +- .../google-cloud-aiplatform/protos/protos.js | 156 ++-- .../google-cloud-aiplatform/src/decorator.ts | 7 +- .../google-cloud-aiplatform/src/helpers.ts | 6 +- .../src/v1/dataset_service_client.ts | 165 ++--- .../src/v1/endpoint_service_client.ts | 98 ++- .../src/v1/job_service_client.ts | 275 ++++--- .../src/v1/migration_service_client.ts | 53 +- .../src/v1/model_service_client.ts | 165 ++--- .../src/v1/pipeline_service_client.ts | 80 +-- .../src/v1/prediction_service_client.ts | 24 +- .../src/v1/specialist_pool_service_client.ts | 80 +-- .../src/v1beta1/dataset_service_client.ts | 165 ++--- .../src/v1beta1/endpoint_service_client.ts | 98 ++- .../src/v1beta1/job_service_client.ts | 275 ++++--- .../src/v1beta1/migration_service_client.ts | 53 +- .../src/v1beta1/model_service_client.ts | 165 ++--- .../src/v1beta1/pipeline_service_client.ts | 80 +-- .../src/v1beta1/prediction_service_client.ts | 33 +- .../v1beta1/specialist_pool_service_client.ts | 80 +-- .../src/v1beta1/vizier_service_client.ts | 190 +++-- .../system-test/fixtures/sample/src/index.js | 3 +- .../test/gapic_dataset_service_v1.ts | 388 +++++----- .../test/gapic_dataset_service_v1beta1.ts | 403 ++++++----- .../test/gapic_endpoint_service_v1.ts | 264 +++---- .../test/gapic_endpoint_service_v1beta1.ts | 267 +++---- .../test/gapic_job_service_v1.ts | 660 +++++++++-------- .../test/gapic_job_service_v1beta1.ts | 669 +++++++++--------- .../test/gapic_migration_service_v1.ts | 264 +++---- .../test/gapic_migration_service_v1beta1.ts | 264 +++---- .../test/gapic_model_service_v1.ts | 396 ++++++----- .../test/gapic_model_service_v1beta1.ts | 396 ++++++----- .../test/gapic_pipeline_service_v1.ts | 294 ++++---- .../test/gapic_pipeline_service_v1beta1.ts | 294 ++++---- .../test/gapic_prediction_service_v1.ts | 159 +++-- .../test/gapic_prediction_service_v1beta1.ts | 321 +++++---- .../test/gapic_specialist_pool_service_v1.ts | 614 ++++++++-------- .../gapic_specialist_pool_service_v1beta1.ts | 624 ++++++++-------- .../test/gapic_vizier_service_v1beta1.ts | 271 ++++--- .../test/helpers.test.ts | 41 +- .../test/index.test.ts | 24 +- 41 files changed, 4368 insertions(+), 4574 deletions(-) diff --git a/packages/google-cloud-aiplatform/protos/protos.d.ts b/packages/google-cloud-aiplatform/protos/protos.d.ts index 482bd13b6c7..c47a83a12ab 100644 --- a/packages/google-cloud-aiplatform/protos/protos.d.ts +++ b/packages/google-cloud-aiplatform/protos/protos.d.ts @@ -193,10 +193,10 @@ export namespace google { constructor(properties?: google.cloud.aiplatform.v1.IUserActionReference); /** UserActionReference operation. */ - public operation: string; + public operation?: (string|null); /** UserActionReference dataLabelingJob. */ - public dataLabelingJob: string; + public dataLabelingJob?: (string|null); /** UserActionReference method. */ public method: string; @@ -825,10 +825,10 @@ export namespace google { constructor(properties?: google.cloud.aiplatform.v1.BatchPredictionJob.IOutputInfo); /** OutputInfo gcsOutputDirectory. */ - public gcsOutputDirectory: string; + public gcsOutputDirectory?: (string|null); /** OutputInfo bigqueryOutputDataset. */ - public bigqueryOutputDataset: string; + public bigqueryOutputDataset?: (string|null); /** OutputInfo outputLocation. */ public outputLocation?: ("gcsOutputDirectory"|"bigqueryOutputDataset"); @@ -3371,10 +3371,10 @@ export namespace google { constructor(properties?: google.cloud.aiplatform.v1.IActiveLearningConfig); /** ActiveLearningConfig maxDataItemCount. */ - public maxDataItemCount: (number|Long|string); + public maxDataItemCount?: (number|Long|string|null); /** ActiveLearningConfig maxDataItemPercentage. */ - public maxDataItemPercentage: number; + public maxDataItemPercentage?: (number|null); /** ActiveLearningConfig sampleConfig. */ public sampleConfig?: (google.cloud.aiplatform.v1.ISampleConfig|null); @@ -3479,10 +3479,10 @@ export namespace google { constructor(properties?: google.cloud.aiplatform.v1.ISampleConfig); /** SampleConfig initialBatchSamplePercentage. */ - public initialBatchSamplePercentage: number; + public initialBatchSamplePercentage?: (number|null); /** SampleConfig followingBatchSamplePercentage. */ - public followingBatchSamplePercentage: number; + public followingBatchSamplePercentage?: (number|null); /** SampleConfig sampleStrategy. */ public sampleStrategy: (google.cloud.aiplatform.v1.SampleConfig.SampleStrategy|keyof typeof google.cloud.aiplatform.v1.SampleConfig.SampleStrategy); @@ -15663,10 +15663,10 @@ export namespace google { constructor(properties?: google.cloud.aiplatform.v1.IMigrateResourceResponse); /** MigrateResourceResponse dataset. */ - public dataset: string; + public dataset?: (string|null); /** MigrateResourceResponse model. */ - public model: string; + public model?: (string|null); /** MigrateResourceResponse migratableResource. */ public migratableResource?: (google.cloud.aiplatform.v1.IMigratableResource|null); @@ -15872,10 +15872,10 @@ export namespace google { public error?: (google.rpc.IStatus|null); /** PartialResult model. */ - public model: string; + public model?: (string|null); /** PartialResult dataset. */ - public dataset: string; + public dataset?: (string|null); /** PartialResult request. */ public request?: (google.cloud.aiplatform.v1.IMigrateResourceRequest|null); @@ -23116,10 +23116,10 @@ export namespace google { constructor(properties?: google.cloud.aiplatform.v1.schema.trainingjob.definition.IAutoMlTablesInputs); /** AutoMlTablesInputs optimizationObjectiveRecallValue. */ - public optimizationObjectiveRecallValue: number; + public optimizationObjectiveRecallValue?: (number|null); /** AutoMlTablesInputs optimizationObjectivePrecisionValue. */ - public optimizationObjectivePrecisionValue: number; + public optimizationObjectivePrecisionValue?: (number|null); /** AutoMlTablesInputs predictionType. */ public predictionType: string; @@ -26468,10 +26468,10 @@ export namespace google { constructor(properties?: google.cloud.aiplatform.v1beta1.IUserActionReference); /** UserActionReference operation. */ - public operation: string; + public operation?: (string|null); /** UserActionReference dataLabelingJob. */ - public dataLabelingJob: string; + public dataLabelingJob?: (string|null); /** UserActionReference method. */ public method: string; @@ -27112,10 +27112,10 @@ export namespace google { constructor(properties?: google.cloud.aiplatform.v1beta1.BatchPredictionJob.IOutputInfo); /** OutputInfo gcsOutputDirectory. */ - public gcsOutputDirectory: string; + public gcsOutputDirectory?: (string|null); /** OutputInfo bigqueryOutputDataset. */ - public bigqueryOutputDataset: string; + public bigqueryOutputDataset?: (string|null); /** OutputInfo outputLocation. */ public outputLocation?: ("gcsOutputDirectory"|"bigqueryOutputDataset"); @@ -28208,7 +28208,7 @@ export namespace google { constructor(properties?: google.cloud.aiplatform.v1beta1.ISmoothGradConfig); /** SmoothGradConfig noiseSigma. */ - public noiseSigma: number; + public noiseSigma?: (number|null); /** SmoothGradConfig featureNoiseSigma. */ public featureNoiseSigma?: (google.cloud.aiplatform.v1beta1.IFeatureNoiseSigma|null); @@ -29324,7 +29324,7 @@ export namespace google { public indexDisplayNameMapping?: (google.protobuf.IValue|null); /** OutputMetadata displayNameMappingKey. */ - public displayNameMappingKey: string; + public displayNameMappingKey?: (string|null); /** OutputMetadata outputTensorName. */ public outputTensorName: string; @@ -31769,10 +31769,10 @@ export namespace google { constructor(properties?: google.cloud.aiplatform.v1beta1.IActiveLearningConfig); /** ActiveLearningConfig maxDataItemCount. */ - public maxDataItemCount: (number|Long|string); + public maxDataItemCount?: (number|Long|string|null); /** ActiveLearningConfig maxDataItemPercentage. */ - public maxDataItemPercentage: number; + public maxDataItemPercentage?: (number|null); /** ActiveLearningConfig sampleConfig. */ public sampleConfig?: (google.cloud.aiplatform.v1beta1.ISampleConfig|null); @@ -31877,10 +31877,10 @@ export namespace google { constructor(properties?: google.cloud.aiplatform.v1beta1.ISampleConfig); /** SampleConfig initialBatchSamplePercentage. */ - public initialBatchSamplePercentage: number; + public initialBatchSamplePercentage?: (number|null); /** SampleConfig followingBatchSamplePercentage. */ - public followingBatchSamplePercentage: number; + public followingBatchSamplePercentage?: (number|null); /** SampleConfig sampleStrategy. */ public sampleStrategy: (google.cloud.aiplatform.v1beta1.SampleConfig.SampleStrategy|keyof typeof google.cloud.aiplatform.v1beta1.SampleConfig.SampleStrategy); @@ -44519,10 +44519,10 @@ export namespace google { constructor(properties?: google.cloud.aiplatform.v1beta1.IMigrateResourceResponse); /** MigrateResourceResponse dataset. */ - public dataset: string; + public dataset?: (string|null); /** MigrateResourceResponse model. */ - public model: string; + public model?: (string|null); /** MigrateResourceResponse migratableResource. */ public migratableResource?: (google.cloud.aiplatform.v1beta1.IMigratableResource|null); @@ -44728,10 +44728,10 @@ export namespace google { public error?: (google.rpc.IStatus|null); /** PartialResult model. */ - public model: string; + public model?: (string|null); /** PartialResult dataset. */ - public dataset: string; + public dataset?: (string|null); /** PartialResult request. */ public request?: (google.cloud.aiplatform.v1beta1.IMigrateResourceRequest|null); @@ -55302,10 +55302,10 @@ export namespace google { constructor(properties?: google.cloud.aiplatform.v1beta1.schema.trainingjob.definition.IAutoMlTablesInputs); /** AutoMlTablesInputs optimizationObjectiveRecallValue. */ - public optimizationObjectiveRecallValue: number; + public optimizationObjectiveRecallValue?: (number|null); /** AutoMlTablesInputs optimizationObjectivePrecisionValue. */ - public optimizationObjectivePrecisionValue: number; + public optimizationObjectivePrecisionValue?: (number|null); /** AutoMlTablesInputs predictionType. */ public predictionType: string; @@ -61079,19 +61079,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); @@ -64779,16 +64779,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-aiplatform/protos/protos.js b/packages/google-cloud-aiplatform/protos/protos.js index cdec27366fd..529d603dc2a 100644 --- a/packages/google-cloud-aiplatform/protos/protos.js +++ b/packages/google-cloud-aiplatform/protos/protos.js @@ -518,19 +518,19 @@ /** * UserActionReference operation. - * @member {string} operation + * @member {string|null|undefined} operation * @memberof google.cloud.aiplatform.v1.UserActionReference * @instance */ - UserActionReference.prototype.operation = ""; + UserActionReference.prototype.operation = null; /** * UserActionReference dataLabelingJob. - * @member {string} dataLabelingJob + * @member {string|null|undefined} dataLabelingJob * @memberof google.cloud.aiplatform.v1.UserActionReference * @instance */ - UserActionReference.prototype.dataLabelingJob = ""; + UserActionReference.prototype.dataLabelingJob = null; /** * UserActionReference method. @@ -2374,19 +2374,19 @@ /** * OutputInfo gcsOutputDirectory. - * @member {string} gcsOutputDirectory + * @member {string|null|undefined} gcsOutputDirectory * @memberof google.cloud.aiplatform.v1.BatchPredictionJob.OutputInfo * @instance */ - OutputInfo.prototype.gcsOutputDirectory = ""; + OutputInfo.prototype.gcsOutputDirectory = null; /** * OutputInfo bigqueryOutputDataset. - * @member {string} bigqueryOutputDataset + * @member {string|null|undefined} bigqueryOutputDataset * @memberof google.cloud.aiplatform.v1.BatchPredictionJob.OutputInfo * @instance */ - OutputInfo.prototype.bigqueryOutputDataset = ""; + OutputInfo.prototype.bigqueryOutputDataset = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -8930,19 +8930,19 @@ /** * ActiveLearningConfig maxDataItemCount. - * @member {number|Long} maxDataItemCount + * @member {number|Long|null|undefined} maxDataItemCount * @memberof google.cloud.aiplatform.v1.ActiveLearningConfig * @instance */ - ActiveLearningConfig.prototype.maxDataItemCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ActiveLearningConfig.prototype.maxDataItemCount = null; /** * ActiveLearningConfig maxDataItemPercentage. - * @member {number} maxDataItemPercentage + * @member {number|null|undefined} maxDataItemPercentage * @memberof google.cloud.aiplatform.v1.ActiveLearningConfig * @instance */ - ActiveLearningConfig.prototype.maxDataItemPercentage = 0; + ActiveLearningConfig.prototype.maxDataItemPercentage = null; /** * ActiveLearningConfig sampleConfig. @@ -9228,19 +9228,19 @@ /** * SampleConfig initialBatchSamplePercentage. - * @member {number} initialBatchSamplePercentage + * @member {number|null|undefined} initialBatchSamplePercentage * @memberof google.cloud.aiplatform.v1.SampleConfig * @instance */ - SampleConfig.prototype.initialBatchSamplePercentage = 0; + SampleConfig.prototype.initialBatchSamplePercentage = null; /** * SampleConfig followingBatchSamplePercentage. - * @member {number} followingBatchSamplePercentage + * @member {number|null|undefined} followingBatchSamplePercentage * @memberof google.cloud.aiplatform.v1.SampleConfig * @instance */ - SampleConfig.prototype.followingBatchSamplePercentage = 0; + SampleConfig.prototype.followingBatchSamplePercentage = null; /** * SampleConfig sampleStrategy. @@ -38363,19 +38363,19 @@ /** * MigrateResourceResponse dataset. - * @member {string} dataset + * @member {string|null|undefined} dataset * @memberof google.cloud.aiplatform.v1.MigrateResourceResponse * @instance */ - MigrateResourceResponse.prototype.dataset = ""; + MigrateResourceResponse.prototype.dataset = null; /** * MigrateResourceResponse model. - * @member {string} model + * @member {string|null|undefined} model * @memberof google.cloud.aiplatform.v1.MigrateResourceResponse * @instance */ - MigrateResourceResponse.prototype.model = ""; + MigrateResourceResponse.prototype.model = null; /** * MigrateResourceResponse migratableResource. @@ -38866,19 +38866,19 @@ /** * PartialResult model. - * @member {string} model + * @member {string|null|undefined} model * @memberof google.cloud.aiplatform.v1.BatchMigrateResourcesOperationMetadata.PartialResult * @instance */ - PartialResult.prototype.model = ""; + PartialResult.prototype.model = null; /** * PartialResult dataset. - * @member {string} dataset + * @member {string|null|undefined} dataset * @memberof google.cloud.aiplatform.v1.BatchMigrateResourcesOperationMetadata.PartialResult * @instance */ - PartialResult.prototype.dataset = ""; + PartialResult.prototype.dataset = null; /** * PartialResult request. @@ -55761,19 +55761,19 @@ /** * AutoMlTablesInputs optimizationObjectiveRecallValue. - * @member {number} optimizationObjectiveRecallValue + * @member {number|null|undefined} optimizationObjectiveRecallValue * @memberof google.cloud.aiplatform.v1.schema.trainingjob.definition.AutoMlTablesInputs * @instance */ - AutoMlTablesInputs.prototype.optimizationObjectiveRecallValue = 0; + AutoMlTablesInputs.prototype.optimizationObjectiveRecallValue = null; /** * AutoMlTablesInputs optimizationObjectivePrecisionValue. - * @member {number} optimizationObjectivePrecisionValue + * @member {number|null|undefined} optimizationObjectivePrecisionValue * @memberof google.cloud.aiplatform.v1.schema.trainingjob.definition.AutoMlTablesInputs * @instance */ - AutoMlTablesInputs.prototype.optimizationObjectivePrecisionValue = 0; + AutoMlTablesInputs.prototype.optimizationObjectivePrecisionValue = null; /** * AutoMlTablesInputs predictionType. @@ -63406,19 +63406,19 @@ /** * UserActionReference operation. - * @member {string} operation + * @member {string|null|undefined} operation * @memberof google.cloud.aiplatform.v1beta1.UserActionReference * @instance */ - UserActionReference.prototype.operation = ""; + UserActionReference.prototype.operation = null; /** * UserActionReference dataLabelingJob. - * @member {string} dataLabelingJob + * @member {string|null|undefined} dataLabelingJob * @memberof google.cloud.aiplatform.v1beta1.UserActionReference * @instance */ - UserActionReference.prototype.dataLabelingJob = ""; + UserActionReference.prototype.dataLabelingJob = null; /** * UserActionReference method. @@ -65316,19 +65316,19 @@ /** * OutputInfo gcsOutputDirectory. - * @member {string} gcsOutputDirectory + * @member {string|null|undefined} gcsOutputDirectory * @memberof google.cloud.aiplatform.v1beta1.BatchPredictionJob.OutputInfo * @instance */ - OutputInfo.prototype.gcsOutputDirectory = ""; + OutputInfo.prototype.gcsOutputDirectory = null; /** * OutputInfo bigqueryOutputDataset. - * @member {string} bigqueryOutputDataset + * @member {string|null|undefined} bigqueryOutputDataset * @memberof google.cloud.aiplatform.v1beta1.BatchPredictionJob.OutputInfo * @instance */ - OutputInfo.prototype.bigqueryOutputDataset = ""; + OutputInfo.prototype.bigqueryOutputDataset = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -67947,11 +67947,11 @@ /** * SmoothGradConfig noiseSigma. - * @member {number} noiseSigma + * @member {number|null|undefined} noiseSigma * @memberof google.cloud.aiplatform.v1beta1.SmoothGradConfig * @instance */ - SmoothGradConfig.prototype.noiseSigma = 0; + SmoothGradConfig.prototype.noiseSigma = null; /** * SmoothGradConfig featureNoiseSigma. @@ -70904,11 +70904,11 @@ /** * OutputMetadata displayNameMappingKey. - * @member {string} displayNameMappingKey + * @member {string|null|undefined} displayNameMappingKey * @memberof google.cloud.aiplatform.v1beta1.ExplanationMetadata.OutputMetadata * @instance */ - OutputMetadata.prototype.displayNameMappingKey = ""; + OutputMetadata.prototype.displayNameMappingKey = null; /** * OutputMetadata outputTensorName. @@ -77189,19 +77189,19 @@ /** * ActiveLearningConfig maxDataItemCount. - * @member {number|Long} maxDataItemCount + * @member {number|Long|null|undefined} maxDataItemCount * @memberof google.cloud.aiplatform.v1beta1.ActiveLearningConfig * @instance */ - ActiveLearningConfig.prototype.maxDataItemCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ActiveLearningConfig.prototype.maxDataItemCount = null; /** * ActiveLearningConfig maxDataItemPercentage. - * @member {number} maxDataItemPercentage + * @member {number|null|undefined} maxDataItemPercentage * @memberof google.cloud.aiplatform.v1beta1.ActiveLearningConfig * @instance */ - ActiveLearningConfig.prototype.maxDataItemPercentage = 0; + ActiveLearningConfig.prototype.maxDataItemPercentage = null; /** * ActiveLearningConfig sampleConfig. @@ -77487,19 +77487,19 @@ /** * SampleConfig initialBatchSamplePercentage. - * @member {number} initialBatchSamplePercentage + * @member {number|null|undefined} initialBatchSamplePercentage * @memberof google.cloud.aiplatform.v1beta1.SampleConfig * @instance */ - SampleConfig.prototype.initialBatchSamplePercentage = 0; + SampleConfig.prototype.initialBatchSamplePercentage = null; /** * SampleConfig followingBatchSamplePercentage. - * @member {number} followingBatchSamplePercentage + * @member {number|null|undefined} followingBatchSamplePercentage * @memberof google.cloud.aiplatform.v1beta1.SampleConfig * @instance */ - SampleConfig.prototype.followingBatchSamplePercentage = 0; + SampleConfig.prototype.followingBatchSamplePercentage = null; /** * SampleConfig sampleStrategy. @@ -107837,19 +107837,19 @@ /** * MigrateResourceResponse dataset. - * @member {string} dataset + * @member {string|null|undefined} dataset * @memberof google.cloud.aiplatform.v1beta1.MigrateResourceResponse * @instance */ - MigrateResourceResponse.prototype.dataset = ""; + MigrateResourceResponse.prototype.dataset = null; /** * MigrateResourceResponse model. - * @member {string} model + * @member {string|null|undefined} model * @memberof google.cloud.aiplatform.v1beta1.MigrateResourceResponse * @instance */ - MigrateResourceResponse.prototype.model = ""; + MigrateResourceResponse.prototype.model = null; /** * MigrateResourceResponse migratableResource. @@ -108340,19 +108340,19 @@ /** * PartialResult model. - * @member {string} model + * @member {string|null|undefined} model * @memberof google.cloud.aiplatform.v1beta1.BatchMigrateResourcesOperationMetadata.PartialResult * @instance */ - PartialResult.prototype.model = ""; + PartialResult.prototype.model = null; /** * PartialResult dataset. - * @member {string} dataset + * @member {string|null|undefined} dataset * @memberof google.cloud.aiplatform.v1beta1.BatchMigrateResourcesOperationMetadata.PartialResult * @instance */ - PartialResult.prototype.dataset = ""; + PartialResult.prototype.dataset = null; /** * PartialResult request. @@ -133040,19 +133040,19 @@ /** * AutoMlTablesInputs optimizationObjectiveRecallValue. - * @member {number} optimizationObjectiveRecallValue + * @member {number|null|undefined} optimizationObjectiveRecallValue * @memberof google.cloud.aiplatform.v1beta1.schema.trainingjob.definition.AutoMlTablesInputs * @instance */ - AutoMlTablesInputs.prototype.optimizationObjectiveRecallValue = 0; + AutoMlTablesInputs.prototype.optimizationObjectiveRecallValue = null; /** * AutoMlTablesInputs optimizationObjectivePrecisionValue. - * @member {number} optimizationObjectivePrecisionValue + * @member {number|null|undefined} optimizationObjectivePrecisionValue * @memberof google.cloud.aiplatform.v1beta1.schema.trainingjob.definition.AutoMlTablesInputs * @instance */ - AutoMlTablesInputs.prototype.optimizationObjectivePrecisionValue = 0; + AutoMlTablesInputs.prototype.optimizationObjectivePrecisionValue = null; /** * AutoMlTablesInputs predictionType. @@ -145785,43 +145785,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. @@ -156052,35 +156052,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-aiplatform/src/decorator.ts b/packages/google-cloud-aiplatform/src/decorator.ts index fda403b9443..2ead229932c 100644 --- a/packages/google-cloud-aiplatform/src/decorator.ts +++ b/packages/google-cloud-aiplatform/src/decorator.ts @@ -84,7 +84,7 @@ function assignMethodsToMessages( // Capture reference to `enhancedMessage` class in closure below. const _addFromValue = { fromValue: (value: object): object | undefined => { - const messageType = (enhancedMessage as unknown) as protobuf.Type; + const messageType = enhancedMessage as unknown as protobuf.Type; const message = messageType.create(); const convertedValue = _helpers.fromValue(value); if (convertedValue !== undefined) { @@ -102,8 +102,9 @@ function assignMethodsToMessages( export function _enhance(apiVersion: string): void { const schemaRoot = enhancedTypesJson[apiVersion]['schema']; - const namespaceRoot = ((protos.google.cloud - .aiplatform as unknown) as NestedNamespace)[apiVersion] as NestedNamespace; + const namespaceRoot = ( + protos.google.cloud.aiplatform as unknown as NestedNamespace + )[apiVersion] as NestedNamespace; const namespaceSchemaRoot = namespaceRoot['schema']; walkNamespaces(schemaRoot, namespaceSchemaRoot as NestedNamespace); } diff --git a/packages/google-cloud-aiplatform/src/helpers.ts b/packages/google-cloud-aiplatform/src/helpers.ts index f0752768049..0b6d284ed3d 100644 --- a/packages/google-cloud-aiplatform/src/helpers.ts +++ b/packages/google-cloud-aiplatform/src/helpers.ts @@ -27,10 +27,10 @@ interface ToValueFunction { // Assigns the toValue() function as a member of an enhanced class. export function addToValue() { - const methods: ToValueFunction = ({} as unknown) as ToValueFunction; + const methods: ToValueFunction = {} as unknown as ToValueFunction; methods.toValue = function () { - return toValue((this as unknown) as protobuf.Message); + return toValue(this as unknown as protobuf.Message); }; return methods; @@ -49,7 +49,7 @@ export function toValue( } const value = googleProtobufValueFromObject( - (message as unknown) as ValueType, + message as unknown as ValueType, (val: object) => { return val; } diff --git a/packages/google-cloud-aiplatform/src/v1/dataset_service_client.ts b/packages/google-cloud-aiplatform/src/v1/dataset_service_client.ts index 6e06a20bbee..f984b290efd 100644 --- a/packages/google-cloud-aiplatform/src/v1/dataset_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1/dataset_service_client.ts @@ -361,13 +361,14 @@ export class DatasetServiceClient { ]; for (const methodName of datasetServiceStubMethods) { const callPromise = this.datasetServiceStub.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; } @@ -522,11 +523,10 @@ export class DatasetServiceClient { 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.getDataset(request, options, callback); } @@ -623,11 +623,10 @@ export class DatasetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'dataset.name': request.dataset!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'dataset.name': request.dataset!.name || '', + }); this.initialize(); return this.innerApiCalls.updateDataset(request, options, callback); } @@ -720,11 +719,10 @@ export class DatasetServiceClient { 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.getAnnotationSpec(request, options, callback); } @@ -829,11 +827,10 @@ export class DatasetServiceClient { 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.createDataset(request, options, callback); } @@ -973,11 +970,10 @@ export class DatasetServiceClient { 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.deleteDataset(request, options, callback); } @@ -1120,11 +1116,10 @@ export class DatasetServiceClient { 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.importData(request, options, callback); } @@ -1266,11 +1261,10 @@ export class DatasetServiceClient { 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.exportData(request, options, callback); } @@ -1426,11 +1420,10 @@ export class DatasetServiceClient { 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.listDatasets(request, options, callback); } @@ -1489,11 +1482,10 @@ export class DatasetServiceClient { 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.listDatasets.createStream( @@ -1563,17 +1555,16 @@ export class DatasetServiceClient { 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.listDatasets.asyncIterate( this.innerApiCalls['listDatasets'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -1677,11 +1668,10 @@ export class DatasetServiceClient { 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.listDataItems(request, options, callback); } @@ -1725,11 +1715,10 @@ export class DatasetServiceClient { 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.listDataItems.createStream( @@ -1784,17 +1773,16 @@ export class DatasetServiceClient { 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.listDataItems.asyncIterate( this.innerApiCalls['listDataItems'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -1899,11 +1887,10 @@ export class DatasetServiceClient { 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.listAnnotations(request, options, callback); } @@ -1948,11 +1935,10 @@ export class DatasetServiceClient { 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.listAnnotations.createStream( @@ -2008,17 +1994,16 @@ export class DatasetServiceClient { 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.listAnnotations.asyncIterate( this.innerApiCalls['listAnnotations'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-aiplatform/src/v1/endpoint_service_client.ts b/packages/google-cloud-aiplatform/src/v1/endpoint_service_client.ts index 9072b90d013..89bc1ffa7c2 100644 --- a/packages/google-cloud-aiplatform/src/v1/endpoint_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1/endpoint_service_client.ts @@ -348,13 +348,14 @@ export class EndpointServiceClient { ]; for (const methodName of endpointServiceStubMethods) { const callPromise = this.endpointServiceStub.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; } @@ -509,11 +510,10 @@ export class EndpointServiceClient { 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.getEndpoint(request, options, callback); } @@ -605,11 +605,10 @@ export class EndpointServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'endpoint.name': request.endpoint!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'endpoint.name': request.endpoint!.name || '', + }); this.initialize(); return this.innerApiCalls.updateEndpoint(request, options, callback); } @@ -714,11 +713,10 @@ export class EndpointServiceClient { 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.createEndpoint(request, options, callback); } @@ -858,11 +856,10 @@ export class EndpointServiceClient { 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.deleteEndpoint(request, options, callback); } @@ -1019,11 +1016,10 @@ export class EndpointServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - endpoint: request.endpoint || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + endpoint: request.endpoint || '', + }); this.initialize(); return this.innerApiCalls.deployModel(request, options, callback); } @@ -1174,11 +1170,10 @@ export class EndpointServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - endpoint: request.endpoint || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + endpoint: request.endpoint || '', + }); this.initialize(); return this.innerApiCalls.undeployModel(request, options, callback); } @@ -1341,11 +1336,10 @@ export class EndpointServiceClient { 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.listEndpoints(request, options, callback); } @@ -1411,11 +1405,10 @@ export class EndpointServiceClient { 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.listEndpoints.createStream( @@ -1492,17 +1485,16 @@ export class EndpointServiceClient { 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.listEndpoints.asyncIterate( this.innerApiCalls['listEndpoints'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-aiplatform/src/v1/job_service_client.ts b/packages/google-cloud-aiplatform/src/v1/job_service_client.ts index bb0767f208a..b7df9cada78 100644 --- a/packages/google-cloud-aiplatform/src/v1/job_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1/job_service_client.ts @@ -387,13 +387,14 @@ export class JobServiceClient { ]; for (const methodName of jobServiceStubMethods) { const callPromise = this.jobServiceStub.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; } @@ -556,11 +557,10 @@ export class JobServiceClient { 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.createCustomJob(request, options, callback); } @@ -644,11 +644,10 @@ export class JobServiceClient { 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.getCustomJob(request, options, callback); } @@ -747,11 +746,10 @@ export class JobServiceClient { 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.cancelCustomJob(request, options, callback); } @@ -848,11 +846,10 @@ export class JobServiceClient { 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.createDataLabelingJob(request, options, callback); } @@ -943,11 +940,10 @@ export class JobServiceClient { 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.getDataLabelingJob(request, options, callback); } @@ -1044,11 +1040,10 @@ export class JobServiceClient { 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.cancelDataLabelingJob(request, options, callback); } @@ -1145,11 +1140,10 @@ export class JobServiceClient { 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.createHyperparameterTuningJob( request, @@ -1250,11 +1244,10 @@ export class JobServiceClient { 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.getHyperparameterTuningJob( request, @@ -1364,11 +1357,10 @@ export class JobServiceClient { 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.cancelHyperparameterTuningJob( request, @@ -1470,11 +1462,10 @@ export class JobServiceClient { 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.createBatchPredictionJob( request, @@ -1575,11 +1566,10 @@ export class JobServiceClient { 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.getBatchPredictionJob(request, options, callback); } @@ -1685,11 +1675,10 @@ export class JobServiceClient { 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.cancelBatchPredictionJob( request, @@ -1797,11 +1786,10 @@ export class JobServiceClient { 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.deleteCustomJob(request, options, callback); } @@ -1942,11 +1930,10 @@ export class JobServiceClient { 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.deleteDataLabelingJob(request, options, callback); } @@ -2087,11 +2074,10 @@ export class JobServiceClient { 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.deleteHyperparameterTuningJob( request, @@ -2237,11 +2223,10 @@ export class JobServiceClient { 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.deleteBatchPredictionJob( request, @@ -2401,11 +2386,10 @@ export class JobServiceClient { 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.listCustomJobs(request, options, callback); } @@ -2464,11 +2448,10 @@ export class JobServiceClient { 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.listCustomJobs.createStream( @@ -2538,17 +2521,16 @@ export class JobServiceClient { 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.listCustomJobs.asyncIterate( this.innerApiCalls['listCustomJobs'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -2671,11 +2653,10 @@ export class JobServiceClient { 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.listDataLabelingJobs(request, options, callback); } @@ -2738,11 +2719,10 @@ export class JobServiceClient { 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.listDataLabelingJobs.createStream( @@ -2816,17 +2796,16 @@ export class JobServiceClient { 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.listDataLabelingJobs.asyncIterate( this.innerApiCalls['listDataLabelingJobs'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -2945,11 +2924,10 @@ export class JobServiceClient { 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.listHyperparameterTuningJobs( request, @@ -3012,11 +2990,10 @@ export class JobServiceClient { 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.listHyperparameterTuningJobs.createStream( @@ -3086,17 +3063,16 @@ export class JobServiceClient { 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.listHyperparameterTuningJobs.asyncIterate( this.innerApiCalls['listHyperparameterTuningJobs'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -3215,11 +3191,10 @@ export class JobServiceClient { 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.listBatchPredictionJobs( request, @@ -3282,11 +3257,10 @@ export class JobServiceClient { 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.listBatchPredictionJobs.createStream( @@ -3356,17 +3330,16 @@ export class JobServiceClient { 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.listBatchPredictionJobs.asyncIterate( this.innerApiCalls['listBatchPredictionJobs'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-aiplatform/src/v1/migration_service_client.ts b/packages/google-cloud-aiplatform/src/v1/migration_service_client.ts index dcfc707b6d8..aae77e98bf8 100644 --- a/packages/google-cloud-aiplatform/src/v1/migration_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1/migration_service_client.ts @@ -314,13 +314,14 @@ export class MigrationServiceClient { ]; for (const methodName of migrationServiceStubMethods) { const callPromise = this.migrationServiceStub.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; } @@ -499,11 +500,10 @@ export class MigrationServiceClient { 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.batchMigrateResources(request, options, callback); } @@ -652,11 +652,10 @@ export class MigrationServiceClient { 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.searchMigratableResources( request, @@ -710,11 +709,10 @@ export class MigrationServiceClient { 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.searchMigratableResources.createStream( @@ -775,17 +773,16 @@ export class MigrationServiceClient { 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.searchMigratableResources.asyncIterate( this.innerApiCalls['searchMigratableResources'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-aiplatform/src/v1/model_service_client.ts b/packages/google-cloud-aiplatform/src/v1/model_service_client.ts index 935d5b7fa16..4b4f4dbf2b4 100644 --- a/packages/google-cloud-aiplatform/src/v1/model_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1/model_service_client.ts @@ -351,13 +351,14 @@ export class ModelServiceClient { ]; for (const methodName of modelServiceStubMethods) { const callPromise = this.modelServiceStub.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; } @@ -509,11 +510,10 @@ export class ModelServiceClient { 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.getModel(request, options, callback); } @@ -599,11 +599,10 @@ export class ModelServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'model.name': request.model!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'model.name': request.model!.name || '', + }); this.initialize(); return this.innerApiCalls.updateModel(request, options, callback); } @@ -694,11 +693,10 @@ export class ModelServiceClient { 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.getModelEvaluation(request, options, callback); } @@ -795,11 +793,10 @@ export class ModelServiceClient { 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.getModelEvaluationSlice( request, @@ -908,11 +905,10 @@ export class ModelServiceClient { 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.uploadModel(request, options, callback); } @@ -1053,11 +1049,10 @@ export class ModelServiceClient { 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.deleteModel(request, options, callback); } @@ -1200,11 +1195,10 @@ export class ModelServiceClient { 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.exportModel(request, options, callback); } @@ -1361,11 +1355,10 @@ export class ModelServiceClient { 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.listModels(request, options, callback); } @@ -1431,11 +1424,10 @@ export class ModelServiceClient { 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.listModels.createStream( @@ -1512,17 +1504,16 @@ export class ModelServiceClient { 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.listModels.asyncIterate( this.innerApiCalls['listModels'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -1625,11 +1616,10 @@ export class ModelServiceClient { 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.listModelEvaluations(request, options, callback); } @@ -1672,11 +1662,10 @@ export class ModelServiceClient { 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.listModelEvaluations.createStream( @@ -1730,17 +1719,16 @@ export class ModelServiceClient { 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.listModelEvaluations.asyncIterate( this.innerApiCalls['listModelEvaluations'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -1847,11 +1835,10 @@ export class ModelServiceClient { 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.listModelEvaluationSlices( request, @@ -1902,11 +1889,10 @@ export class ModelServiceClient { 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.listModelEvaluationSlices.createStream( @@ -1964,17 +1950,16 @@ export class ModelServiceClient { 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.listModelEvaluationSlices.asyncIterate( this.innerApiCalls['listModelEvaluationSlices'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-aiplatform/src/v1/pipeline_service_client.ts b/packages/google-cloud-aiplatform/src/v1/pipeline_service_client.ts index 2920450663a..3bef4b4c6b6 100644 --- a/packages/google-cloud-aiplatform/src/v1/pipeline_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1/pipeline_service_client.ts @@ -318,13 +318,14 @@ export class PipelineServiceClient { ]; for (const methodName of pipelineServiceStubMethods) { const callPromise = this.pipelineServiceStub.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; } @@ -493,11 +494,10 @@ export class PipelineServiceClient { 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.createTrainingPipeline( request, @@ -592,11 +592,10 @@ export class PipelineServiceClient { 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.getTrainingPipeline(request, options, callback); } @@ -702,11 +701,10 @@ export class PipelineServiceClient { 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.cancelTrainingPipeline( request, @@ -815,11 +813,10 @@ export class PipelineServiceClient { 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.deleteTrainingPipeline( request, @@ -978,11 +975,10 @@ export class PipelineServiceClient { 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.listTrainingPipelines(request, options, callback); } @@ -1040,11 +1036,10 @@ export class PipelineServiceClient { 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.listTrainingPipelines.createStream( @@ -1113,17 +1108,16 @@ export class PipelineServiceClient { 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.listTrainingPipelines.asyncIterate( this.innerApiCalls['listTrainingPipelines'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-aiplatform/src/v1/prediction_service_client.ts b/packages/google-cloud-aiplatform/src/v1/prediction_service_client.ts index fe34bce76bc..03039ce700b 100644 --- a/packages/google-cloud-aiplatform/src/v1/prediction_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1/prediction_service_client.ts @@ -252,13 +252,14 @@ export class PredictionServiceClient { const predictionServiceStubMethods = ['predict']; for (const methodName of predictionServiceStubMethods) { const callPromise = this.predictionServiceStub.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; } @@ -423,11 +424,10 @@ export class PredictionServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - endpoint: request.endpoint || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + endpoint: request.endpoint || '', + }); this.initialize(); return this.innerApiCalls.predict(request, options, callback); } diff --git a/packages/google-cloud-aiplatform/src/v1/specialist_pool_service_client.ts b/packages/google-cloud-aiplatform/src/v1/specialist_pool_service_client.ts index 488946afc3b..ef53a009f1b 100644 --- a/packages/google-cloud-aiplatform/src/v1/specialist_pool_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1/specialist_pool_service_client.ts @@ -343,13 +343,14 @@ export class SpecialistPoolServiceClient { ]; for (const methodName of specialistPoolServiceStubMethods) { const callPromise = this.specialistPoolServiceStub.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; } @@ -511,11 +512,10 @@ export class SpecialistPoolServiceClient { 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.getSpecialistPool(request, options, callback); } @@ -620,11 +620,10 @@ export class SpecialistPoolServiceClient { 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.createSpecialistPool(request, options, callback); } @@ -767,11 +766,10 @@ export class SpecialistPoolServiceClient { 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.deleteSpecialistPool(request, options, callback); } @@ -911,11 +909,10 @@ export class SpecialistPoolServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'specialist_pool.name': request.specialistPool!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'specialist_pool.name': request.specialistPool!.name || '', + }); this.initialize(); return this.innerApiCalls.updateSpecialistPool(request, options, callback); } @@ -1053,11 +1050,10 @@ export class SpecialistPoolServiceClient { 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.listSpecialistPools(request, options, callback); } @@ -1098,11 +1094,10 @@ export class SpecialistPoolServiceClient { 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.listSpecialistPools.createStream( @@ -1154,17 +1149,16 @@ export class SpecialistPoolServiceClient { 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.listSpecialistPools.asyncIterate( this.innerApiCalls['listSpecialistPools'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-aiplatform/src/v1beta1/dataset_service_client.ts b/packages/google-cloud-aiplatform/src/v1beta1/dataset_service_client.ts index 975fcefd090..be4c4630e89 100644 --- a/packages/google-cloud-aiplatform/src/v1beta1/dataset_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1beta1/dataset_service_client.ts @@ -364,13 +364,14 @@ export class DatasetServiceClient { ]; for (const methodName of datasetServiceStubMethods) { const callPromise = this.datasetServiceStub.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; } @@ -531,11 +532,10 @@ export class DatasetServiceClient { 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.getDataset(request, options, callback); } @@ -632,11 +632,10 @@ export class DatasetServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'dataset.name': request.dataset!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'dataset.name': request.dataset!.name || '', + }); this.initialize(); return this.innerApiCalls.updateDataset(request, options, callback); } @@ -734,11 +733,10 @@ export class DatasetServiceClient { 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.getAnnotationSpec(request, options, callback); } @@ -843,11 +841,10 @@ export class DatasetServiceClient { 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.createDataset(request, options, callback); } @@ -987,11 +984,10 @@ export class DatasetServiceClient { 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.deleteDataset(request, options, callback); } @@ -1134,11 +1130,10 @@ export class DatasetServiceClient { 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.importData(request, options, callback); } @@ -1280,11 +1275,10 @@ export class DatasetServiceClient { 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.exportData(request, options, callback); } @@ -1440,11 +1434,10 @@ export class DatasetServiceClient { 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.listDatasets(request, options, callback); } @@ -1503,11 +1496,10 @@ export class DatasetServiceClient { 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.listDatasets.createStream( @@ -1577,17 +1569,16 @@ export class DatasetServiceClient { 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.listDatasets.asyncIterate( this.innerApiCalls['listDatasets'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -1691,11 +1682,10 @@ export class DatasetServiceClient { 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.listDataItems(request, options, callback); } @@ -1739,11 +1729,10 @@ export class DatasetServiceClient { 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.listDataItems.createStream( @@ -1798,17 +1787,16 @@ export class DatasetServiceClient { 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.listDataItems.asyncIterate( this.innerApiCalls['listDataItems'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -1912,11 +1900,10 @@ export class DatasetServiceClient { 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.listAnnotations(request, options, callback); } @@ -1960,11 +1947,10 @@ export class DatasetServiceClient { 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.listAnnotations.createStream( @@ -2019,17 +2005,16 @@ export class DatasetServiceClient { 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.listAnnotations.asyncIterate( this.innerApiCalls['listAnnotations'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-aiplatform/src/v1beta1/endpoint_service_client.ts b/packages/google-cloud-aiplatform/src/v1beta1/endpoint_service_client.ts index 3dfcaf12691..5ac797d6100 100644 --- a/packages/google-cloud-aiplatform/src/v1beta1/endpoint_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1beta1/endpoint_service_client.ts @@ -351,13 +351,14 @@ export class EndpointServiceClient { ]; for (const methodName of endpointServiceStubMethods) { const callPromise = this.endpointServiceStub.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; } @@ -518,11 +519,10 @@ export class EndpointServiceClient { 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.getEndpoint(request, options, callback); } @@ -614,11 +614,10 @@ export class EndpointServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'endpoint.name': request.endpoint!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'endpoint.name': request.endpoint!.name || '', + }); this.initialize(); return this.innerApiCalls.updateEndpoint(request, options, callback); } @@ -723,11 +722,10 @@ export class EndpointServiceClient { 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.createEndpoint(request, options, callback); } @@ -867,11 +865,10 @@ export class EndpointServiceClient { 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.deleteEndpoint(request, options, callback); } @@ -1028,11 +1025,10 @@ export class EndpointServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - endpoint: request.endpoint || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + endpoint: request.endpoint || '', + }); this.initialize(); return this.innerApiCalls.deployModel(request, options, callback); } @@ -1183,11 +1179,10 @@ export class EndpointServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - endpoint: request.endpoint || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + endpoint: request.endpoint || '', + }); this.initialize(); return this.innerApiCalls.undeployModel(request, options, callback); } @@ -1341,11 +1336,10 @@ export class EndpointServiceClient { 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.listEndpoints(request, options, callback); } @@ -1402,11 +1396,10 @@ export class EndpointServiceClient { 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.listEndpoints.createStream( @@ -1474,17 +1467,16 @@ export class EndpointServiceClient { 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.listEndpoints.asyncIterate( this.innerApiCalls['listEndpoints'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-aiplatform/src/v1beta1/job_service_client.ts b/packages/google-cloud-aiplatform/src/v1beta1/job_service_client.ts index d91d680bb8d..1bc30f9af2f 100644 --- a/packages/google-cloud-aiplatform/src/v1beta1/job_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1beta1/job_service_client.ts @@ -390,13 +390,14 @@ export class JobServiceClient { ]; for (const methodName of jobServiceStubMethods) { const callPromise = this.jobServiceStub.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; } @@ -565,11 +566,10 @@ export class JobServiceClient { 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.createCustomJob(request, options, callback); } @@ -659,11 +659,10 @@ export class JobServiceClient { 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.getCustomJob(request, options, callback); } @@ -768,11 +767,10 @@ export class JobServiceClient { 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.cancelCustomJob(request, options, callback); } @@ -869,11 +867,10 @@ export class JobServiceClient { 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.createDataLabelingJob(request, options, callback); } @@ -969,11 +966,10 @@ export class JobServiceClient { 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.getDataLabelingJob(request, options, callback); } @@ -1069,11 +1065,10 @@ export class JobServiceClient { 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.cancelDataLabelingJob(request, options, callback); } @@ -1170,11 +1165,10 @@ export class JobServiceClient { 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.createHyperparameterTuningJob( request, @@ -1274,11 +1268,10 @@ export class JobServiceClient { 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.getHyperparameterTuningJob( request, @@ -1387,11 +1380,10 @@ export class JobServiceClient { 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.cancelHyperparameterTuningJob( request, @@ -1493,11 +1485,10 @@ export class JobServiceClient { 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.createBatchPredictionJob( request, @@ -1597,11 +1588,10 @@ export class JobServiceClient { 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.getBatchPredictionJob(request, options, callback); } @@ -1706,11 +1696,10 @@ export class JobServiceClient { 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.cancelBatchPredictionJob( request, @@ -1818,11 +1807,10 @@ export class JobServiceClient { 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.deleteCustomJob(request, options, callback); } @@ -1962,11 +1950,10 @@ export class JobServiceClient { 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.deleteDataLabelingJob(request, options, callback); } @@ -2106,11 +2093,10 @@ export class JobServiceClient { 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.deleteHyperparameterTuningJob( request, @@ -2255,11 +2241,10 @@ export class JobServiceClient { 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.deleteBatchPredictionJob( request, @@ -2419,11 +2404,10 @@ export class JobServiceClient { 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.listCustomJobs(request, options, callback); } @@ -2482,11 +2466,10 @@ export class JobServiceClient { 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.listCustomJobs.createStream( @@ -2556,17 +2539,16 @@ export class JobServiceClient { 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.listCustomJobs.asyncIterate( this.innerApiCalls['listCustomJobs'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -2689,11 +2671,10 @@ export class JobServiceClient { 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.listDataLabelingJobs(request, options, callback); } @@ -2756,11 +2737,10 @@ export class JobServiceClient { 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.listDataLabelingJobs.createStream( @@ -2834,17 +2814,16 @@ export class JobServiceClient { 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.listDataLabelingJobs.asyncIterate( this.innerApiCalls['listDataLabelingJobs'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -2963,11 +2942,10 @@ export class JobServiceClient { 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.listHyperparameterTuningJobs( request, @@ -3030,11 +3008,10 @@ export class JobServiceClient { 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.listHyperparameterTuningJobs.createStream( @@ -3104,17 +3081,16 @@ export class JobServiceClient { 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.listHyperparameterTuningJobs.asyncIterate( this.innerApiCalls['listHyperparameterTuningJobs'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -3235,11 +3211,10 @@ export class JobServiceClient { 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.listBatchPredictionJobs( request, @@ -3304,11 +3279,10 @@ export class JobServiceClient { 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.listBatchPredictionJobs.createStream( @@ -3380,17 +3354,16 @@ export class JobServiceClient { 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.listBatchPredictionJobs.asyncIterate( this.innerApiCalls['listBatchPredictionJobs'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-aiplatform/src/v1beta1/migration_service_client.ts b/packages/google-cloud-aiplatform/src/v1beta1/migration_service_client.ts index c1ec7563278..d94bd7d6ea5 100644 --- a/packages/google-cloud-aiplatform/src/v1beta1/migration_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1beta1/migration_service_client.ts @@ -318,13 +318,14 @@ export class MigrationServiceClient { ]; for (const methodName of migrationServiceStubMethods) { const callPromise = this.migrationServiceStub.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; } @@ -503,11 +504,10 @@ export class MigrationServiceClient { 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.batchMigrateResources(request, options, callback); } @@ -656,11 +656,10 @@ export class MigrationServiceClient { 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.searchMigratableResources( request, @@ -714,11 +713,10 @@ export class MigrationServiceClient { 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.searchMigratableResources.createStream( @@ -779,17 +777,16 @@ export class MigrationServiceClient { 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.searchMigratableResources.asyncIterate( this.innerApiCalls['searchMigratableResources'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-aiplatform/src/v1beta1/model_service_client.ts b/packages/google-cloud-aiplatform/src/v1beta1/model_service_client.ts index 95c151e40af..a60ec009fa6 100644 --- a/packages/google-cloud-aiplatform/src/v1beta1/model_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1beta1/model_service_client.ts @@ -354,13 +354,14 @@ export class ModelServiceClient { ]; for (const methodName of modelServiceStubMethods) { const callPromise = this.modelServiceStub.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; } @@ -520,11 +521,10 @@ export class ModelServiceClient { 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.getModel(request, options, callback); } @@ -616,11 +616,10 @@ export class ModelServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'model.name': request.model!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'model.name': request.model!.name || '', + }); this.initialize(); return this.innerApiCalls.updateModel(request, options, callback); } @@ -716,11 +715,10 @@ export class ModelServiceClient { 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.getModelEvaluation(request, options, callback); } @@ -816,11 +814,10 @@ export class ModelServiceClient { 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.getModelEvaluationSlice( request, @@ -929,11 +926,10 @@ export class ModelServiceClient { 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.uploadModel(request, options, callback); } @@ -1074,11 +1070,10 @@ export class ModelServiceClient { 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.deleteModel(request, options, callback); } @@ -1221,11 +1216,10 @@ export class ModelServiceClient { 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.exportModel(request, options, callback); } @@ -1379,11 +1373,10 @@ export class ModelServiceClient { 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.listModels(request, options, callback); } @@ -1440,11 +1433,10 @@ export class ModelServiceClient { 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.listModels.createStream( @@ -1512,17 +1504,16 @@ export class ModelServiceClient { 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.listModels.asyncIterate( this.innerApiCalls['listModels'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -1625,11 +1616,10 @@ export class ModelServiceClient { 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.listModelEvaluations(request, options, callback); } @@ -1672,11 +1662,10 @@ export class ModelServiceClient { 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.listModelEvaluations.createStream( @@ -1730,17 +1719,16 @@ export class ModelServiceClient { 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.listModelEvaluations.asyncIterate( this.innerApiCalls['listModelEvaluations'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -1846,11 +1834,10 @@ export class ModelServiceClient { 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.listModelEvaluationSlices( request, @@ -1900,11 +1887,10 @@ export class ModelServiceClient { 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.listModelEvaluationSlices.createStream( @@ -1961,17 +1947,16 @@ export class ModelServiceClient { 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.listModelEvaluationSlices.asyncIterate( this.innerApiCalls['listModelEvaluationSlices'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-aiplatform/src/v1beta1/pipeline_service_client.ts b/packages/google-cloud-aiplatform/src/v1beta1/pipeline_service_client.ts index 9a38cd81be6..53b45e307b6 100644 --- a/packages/google-cloud-aiplatform/src/v1beta1/pipeline_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1beta1/pipeline_service_client.ts @@ -321,13 +321,14 @@ export class PipelineServiceClient { ]; for (const methodName of pipelineServiceStubMethods) { const callPromise = this.pipelineServiceStub.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; } @@ -496,11 +497,10 @@ export class PipelineServiceClient { 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.createTrainingPipeline( request, @@ -600,11 +600,10 @@ export class PipelineServiceClient { 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.getTrainingPipeline(request, options, callback); } @@ -709,11 +708,10 @@ export class PipelineServiceClient { 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.cancelTrainingPipeline( request, @@ -821,11 +819,10 @@ export class PipelineServiceClient { 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.deleteTrainingPipeline( request, @@ -984,11 +981,10 @@ export class PipelineServiceClient { 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.listTrainingPipelines(request, options, callback); } @@ -1046,11 +1042,10 @@ export class PipelineServiceClient { 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.listTrainingPipelines.createStream( @@ -1119,17 +1114,16 @@ export class PipelineServiceClient { 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.listTrainingPipelines.asyncIterate( this.innerApiCalls['listTrainingPipelines'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-aiplatform/src/v1beta1/prediction_service_client.ts b/packages/google-cloud-aiplatform/src/v1beta1/prediction_service_client.ts index 10c42551885..a0f6af9e585 100644 --- a/packages/google-cloud-aiplatform/src/v1beta1/prediction_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1beta1/prediction_service_client.ts @@ -256,13 +256,14 @@ export class PredictionServiceClient { const predictionServiceStubMethods = ['predict', 'explain']; for (const methodName of predictionServiceStubMethods) { const callPromise = this.predictionServiceStub.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; } @@ -429,11 +430,10 @@ export class PredictionServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - endpoint: request.endpoint || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + endpoint: request.endpoint || '', + }); this.initialize(); return this.innerApiCalls.predict(request, options, callback); } @@ -553,11 +553,10 @@ export class PredictionServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - endpoint: request.endpoint || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + endpoint: request.endpoint || '', + }); this.initialize(); return this.innerApiCalls.explain(request, options, callback); } diff --git a/packages/google-cloud-aiplatform/src/v1beta1/specialist_pool_service_client.ts b/packages/google-cloud-aiplatform/src/v1beta1/specialist_pool_service_client.ts index 784d3cea716..ac65e85ea34 100644 --- a/packages/google-cloud-aiplatform/src/v1beta1/specialist_pool_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1beta1/specialist_pool_service_client.ts @@ -346,13 +346,14 @@ export class SpecialistPoolServiceClient { ]; for (const methodName of specialistPoolServiceStubMethods) { const callPromise = this.specialistPoolServiceStub.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; } @@ -519,11 +520,10 @@ export class SpecialistPoolServiceClient { 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.getSpecialistPool(request, options, callback); } @@ -628,11 +628,10 @@ export class SpecialistPoolServiceClient { 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.createSpecialistPool(request, options, callback); } @@ -775,11 +774,10 @@ export class SpecialistPoolServiceClient { 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.deleteSpecialistPool(request, options, callback); } @@ -919,11 +917,10 @@ export class SpecialistPoolServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'specialist_pool.name': request.specialistPool!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'specialist_pool.name': request.specialistPool!.name || '', + }); this.initialize(); return this.innerApiCalls.updateSpecialistPool(request, options, callback); } @@ -1061,11 +1058,10 @@ export class SpecialistPoolServiceClient { 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.listSpecialistPools(request, options, callback); } @@ -1106,11 +1102,10 @@ export class SpecialistPoolServiceClient { 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.listSpecialistPools.createStream( @@ -1162,17 +1157,16 @@ export class SpecialistPoolServiceClient { 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.listSpecialistPools.asyncIterate( this.innerApiCalls['listSpecialistPools'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-aiplatform/src/v1beta1/vizier_service_client.ts b/packages/google-cloud-aiplatform/src/v1beta1/vizier_service_client.ts index 1762be4eda5..905c332a83a 100644 --- a/packages/google-cloud-aiplatform/src/v1beta1/vizier_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1beta1/vizier_service_client.ts @@ -351,13 +351,14 @@ export class VizierServiceClient { ]; for (const methodName of vizierServiceStubMethods) { const callPromise = this.vizierServiceStub.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; } @@ -520,11 +521,10 @@ export class VizierServiceClient { 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.createStudy(request, options, callback); } @@ -613,11 +613,10 @@ export class VizierServiceClient { 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.getStudy(request, options, callback); } @@ -706,11 +705,10 @@ export class VizierServiceClient { 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.deleteStudy(request, options, callback); } @@ -802,11 +800,10 @@ export class VizierServiceClient { 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.lookupStudy(request, options, callback); } @@ -897,11 +894,10 @@ export class VizierServiceClient { 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.createTrial(request, options, callback); } @@ -991,11 +987,10 @@ export class VizierServiceClient { 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.getTrial(request, options, callback); } @@ -1094,11 +1089,10 @@ export class VizierServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - trial_name: request.trialName || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + trial_name: request.trialName || '', + }); this.initialize(); return this.innerApiCalls.addTrialMeasurement(request, options, callback); } @@ -1198,11 +1192,10 @@ export class VizierServiceClient { 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.completeTrial(request, options, callback); } @@ -1292,11 +1285,10 @@ export class VizierServiceClient { 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.deleteTrial(request, options, callback); } @@ -1386,11 +1378,10 @@ export class VizierServiceClient { 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.stopTrial(request, options, callback); } @@ -1487,11 +1478,10 @@ export class VizierServiceClient { 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.listOptimalTrials(request, options, callback); } @@ -1606,11 +1596,10 @@ export class VizierServiceClient { 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.suggestTrials(request, options, callback); } @@ -1753,11 +1742,10 @@ export class VizierServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - trial_name: request.trialName || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + trial_name: request.trialName || '', + }); this.initialize(); return this.innerApiCalls.checkTrialEarlyStoppingState( request, @@ -1896,11 +1884,10 @@ export class VizierServiceClient { 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.listStudies(request, options, callback); } @@ -1938,11 +1925,10 @@ export class VizierServiceClient { 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.listStudies.createStream( @@ -1991,17 +1977,16 @@ export class VizierServiceClient { 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.listStudies.asyncIterate( this.innerApiCalls['listStudies'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -2099,11 +2084,10 @@ export class VizierServiceClient { 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.listTrials(request, options, callback); } @@ -2141,11 +2125,10 @@ export class VizierServiceClient { 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.listTrials.createStream( @@ -2194,17 +2177,16 @@ export class VizierServiceClient { 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.listTrials.asyncIterate( this.innerApiCalls['listTrials'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-aiplatform/system-test/fixtures/sample/src/index.js b/packages/google-cloud-aiplatform/system-test/fixtures/sample/src/index.js index b8f15129dfd..3705983507a 100644 --- a/packages/google-cloud-aiplatform/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-aiplatform/system-test/fixtures/sample/src/index.js @@ -27,7 +27,8 @@ function main() { const modelServiceClient = new aiplatform.ModelServiceClient(); const pipelineServiceClient = new aiplatform.PipelineServiceClient(); const predictionServiceClient = new aiplatform.PredictionServiceClient(); - const specialistPoolServiceClient = new aiplatform.SpecialistPoolServiceClient(); + const specialistPoolServiceClient = + new aiplatform.SpecialistPoolServiceClient(); } main(); diff --git a/packages/google-cloud-aiplatform/test/gapic_dataset_service_v1.ts b/packages/google-cloud-aiplatform/test/gapic_dataset_service_v1.ts index 88abd0da08f..65ae4633004 100644 --- a/packages/google-cloud-aiplatform/test/gapic_dataset_service_v1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_dataset_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; @@ -281,9 +280,8 @@ describe('v1.DatasetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.Dataset() ); - client.innerApiCalls.getDataset = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getDataset = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getDataset( request, @@ -395,9 +393,8 @@ describe('v1.DatasetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.Dataset() ); - client.innerApiCalls.updateDataset = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateDataset = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateDataset( request, @@ -508,9 +505,8 @@ describe('v1.DatasetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.AnnotationSpec() ); - client.innerApiCalls.getAnnotationSpec = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getAnnotationSpec = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getAnnotationSpec( request, @@ -589,9 +585,8 @@ describe('v1.DatasetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createDataset = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.createDataset = + stubLongRunningCall(expectedResponse); const [operation] = await client.createDataset(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -623,9 +618,8 @@ describe('v1.DatasetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createDataset = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createDataset = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createDataset( request, @@ -785,9 +779,8 @@ describe('v1.DatasetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteDataset = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteDataset = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteDataset(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -819,9 +812,8 @@ describe('v1.DatasetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteDataset = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteDataset = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteDataset( request, @@ -1013,9 +1005,8 @@ describe('v1.DatasetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.importData = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.importData = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.importData( request, @@ -1204,9 +1195,8 @@ describe('v1.DatasetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.exportData = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.exportData = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.exportData( request, @@ -1398,9 +1388,8 @@ describe('v1.DatasetServiceClient', () => { generateSampleMessage(new protos.google.cloud.aiplatform.v1.Dataset()), generateSampleMessage(new protos.google.cloud.aiplatform.v1.Dataset()), ]; - client.innerApiCalls.listDatasets = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listDatasets = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listDatasets( request, @@ -1472,9 +1461,8 @@ describe('v1.DatasetServiceClient', () => { generateSampleMessage(new protos.google.cloud.aiplatform.v1.Dataset()), generateSampleMessage(new protos.google.cloud.aiplatform.v1.Dataset()), ]; - client.descriptors.page.listDatasets.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listDatasets.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listDatasetsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.aiplatform.v1.Dataset[] = []; @@ -1499,10 +1487,9 @@ describe('v1.DatasetServiceClient', () => { .calledWith(client.innerApiCalls.listDatasets, request) ); assert.strictEqual( - (client.descriptors.page.listDatasets - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDatasets.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1546,10 +1533,9 @@ describe('v1.DatasetServiceClient', () => { .calledWith(client.innerApiCalls.listDatasets, request) ); assert.strictEqual( - (client.descriptors.page.listDatasets - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDatasets.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1570,9 +1556,8 @@ describe('v1.DatasetServiceClient', () => { generateSampleMessage(new protos.google.cloud.aiplatform.v1.Dataset()), generateSampleMessage(new protos.google.cloud.aiplatform.v1.Dataset()), ]; - client.descriptors.page.listDatasets.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listDatasets.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.aiplatform.v1.IDataset[] = []; const iterable = client.listDatasetsAsync(request); for await (const resource of iterable) { @@ -1580,15 +1565,15 @@ describe('v1.DatasetServiceClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listDatasets - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listDatasets.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listDatasets - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDatasets.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1605,10 +1590,8 @@ describe('v1.DatasetServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listDatasets.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listDatasets.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listDatasetsAsync(request); await assert.rejects(async () => { const responses: protos.google.cloud.aiplatform.v1.IDataset[] = []; @@ -1617,15 +1600,15 @@ describe('v1.DatasetServiceClient', () => { } }); assert.deepStrictEqual( - (client.descriptors.page.listDatasets - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listDatasets.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listDatasets - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDatasets.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1688,9 +1671,8 @@ describe('v1.DatasetServiceClient', () => { generateSampleMessage(new protos.google.cloud.aiplatform.v1.DataItem()), generateSampleMessage(new protos.google.cloud.aiplatform.v1.DataItem()), ]; - client.innerApiCalls.listDataItems = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listDataItems = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listDataItems( request, @@ -1762,9 +1744,8 @@ describe('v1.DatasetServiceClient', () => { generateSampleMessage(new protos.google.cloud.aiplatform.v1.DataItem()), generateSampleMessage(new protos.google.cloud.aiplatform.v1.DataItem()), ]; - client.descriptors.page.listDataItems.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listDataItems.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listDataItemsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.aiplatform.v1.DataItem[] = []; @@ -1789,10 +1770,9 @@ describe('v1.DatasetServiceClient', () => { .calledWith(client.innerApiCalls.listDataItems, request) ); assert.strictEqual( - (client.descriptors.page.listDataItems - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDataItems.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1809,10 +1789,8 @@ describe('v1.DatasetServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listDataItems.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listDataItems.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listDataItemsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.aiplatform.v1.DataItem[] = []; @@ -1836,10 +1814,9 @@ describe('v1.DatasetServiceClient', () => { .calledWith(client.innerApiCalls.listDataItems, request) ); assert.strictEqual( - (client.descriptors.page.listDataItems - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDataItems.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1860,9 +1837,8 @@ describe('v1.DatasetServiceClient', () => { generateSampleMessage(new protos.google.cloud.aiplatform.v1.DataItem()), generateSampleMessage(new protos.google.cloud.aiplatform.v1.DataItem()), ]; - client.descriptors.page.listDataItems.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listDataItems.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.aiplatform.v1.IDataItem[] = []; const iterable = client.listDataItemsAsync(request); for await (const resource of iterable) { @@ -1870,15 +1846,15 @@ describe('v1.DatasetServiceClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listDataItems - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listDataItems.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listDataItems - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDataItems.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1895,10 +1871,8 @@ describe('v1.DatasetServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listDataItems.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listDataItems.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listDataItemsAsync(request); await assert.rejects(async () => { const responses: protos.google.cloud.aiplatform.v1.IDataItem[] = []; @@ -1907,15 +1881,15 @@ describe('v1.DatasetServiceClient', () => { } }); assert.deepStrictEqual( - (client.descriptors.page.listDataItems - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listDataItems.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listDataItems - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDataItems.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1990,9 +1964,8 @@ describe('v1.DatasetServiceClient', () => { new protos.google.cloud.aiplatform.v1.Annotation() ), ]; - client.innerApiCalls.listAnnotations = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listAnnotations = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listAnnotations( request, @@ -2070,9 +2043,8 @@ describe('v1.DatasetServiceClient', () => { new protos.google.cloud.aiplatform.v1.Annotation() ), ]; - client.descriptors.page.listAnnotations.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listAnnotations.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listAnnotationsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.aiplatform.v1.Annotation[] = []; @@ -2097,10 +2069,9 @@ describe('v1.DatasetServiceClient', () => { .calledWith(client.innerApiCalls.listAnnotations, request) ); assert.strictEqual( - (client.descriptors.page.listAnnotations - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listAnnotations.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2117,10 +2088,8 @@ describe('v1.DatasetServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listAnnotations.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listAnnotations.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listAnnotationsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.aiplatform.v1.Annotation[] = []; @@ -2144,10 +2113,9 @@ describe('v1.DatasetServiceClient', () => { .calledWith(client.innerApiCalls.listAnnotations, request) ); assert.strictEqual( - (client.descriptors.page.listAnnotations - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listAnnotations.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2174,9 +2142,8 @@ describe('v1.DatasetServiceClient', () => { new protos.google.cloud.aiplatform.v1.Annotation() ), ]; - client.descriptors.page.listAnnotations.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listAnnotations.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.aiplatform.v1.IAnnotation[] = []; const iterable = client.listAnnotationsAsync(request); for await (const resource of iterable) { @@ -2184,15 +2151,15 @@ describe('v1.DatasetServiceClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listAnnotations - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listAnnotations.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listAnnotations - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listAnnotations.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2209,10 +2176,8 @@ describe('v1.DatasetServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listAnnotations.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listAnnotations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listAnnotationsAsync(request); await assert.rejects(async () => { const responses: protos.google.cloud.aiplatform.v1.IAnnotation[] = []; @@ -2221,15 +2186,15 @@ describe('v1.DatasetServiceClient', () => { } }); assert.deepStrictEqual( - (client.descriptors.page.listAnnotations - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listAnnotations.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listAnnotations - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listAnnotations.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2390,9 +2355,8 @@ describe('v1.DatasetServiceClient', () => { }); it('matchAnnotationSpecFromAnnotationSpecName', () => { - const result = client.matchAnnotationSpecFromAnnotationSpecName( - fakePath - ); + const result = + client.matchAnnotationSpecFromAnnotationSpecName(fakePath); assert.strictEqual(result, 'annotationSpecValue'); assert( (client.pathTemplates.annotationSpecPathTemplate.match as SinonStub) @@ -2429,8 +2393,10 @@ describe('v1.DatasetServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -2440,8 +2406,10 @@ describe('v1.DatasetServiceClient', () => { const result = client.matchProjectFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2451,21 +2419,24 @@ describe('v1.DatasetServiceClient', () => { const result = client.matchLocationFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchBatchPredictionJobFromBatchPredictionJobName', () => { - const result = client.matchBatchPredictionJobFromBatchPredictionJobName( - fakePath - ); + const result = + client.matchBatchPredictionJobFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'batchPredictionJobValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2666,9 +2637,8 @@ describe('v1.DatasetServiceClient', () => { }); it('matchDataLabelingJobFromDataLabelingJobName', () => { - const result = client.matchDataLabelingJobFromDataLabelingJobName( - fakePath - ); + const result = + client.matchDataLabelingJobFromDataLabelingJobName(fakePath); assert.strictEqual(result, 'dataLabelingJobValue'); assert( (client.pathTemplates.dataLabelingJobPathTemplate.match as SinonStub) @@ -2833,47 +2803,54 @@ describe('v1.DatasetServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromHyperparameterTuningJobName', () => { - const result = client.matchProjectFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchProjectFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromHyperparameterTuningJobName', () => { - const result = client.matchLocationFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchLocationFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchHyperparameterTuningJobFromHyperparameterTuningJobName', () => { - const result = client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( + fakePath + ); assert.strictEqual(result, 'hyperparameterTuningJobValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3100,34 +3077,38 @@ describe('v1.DatasetServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .render as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromModelEvaluationSliceName', () => { - const result = client.matchProjectFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchProjectFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromModelEvaluationSliceName', () => { - const result = client.matchLocationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchLocationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3137,21 +3118,24 @@ describe('v1.DatasetServiceClient', () => { const result = client.matchModelFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'modelValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchEvaluationFromModelEvaluationSliceName', () => { - const result = client.matchEvaluationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchEvaluationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'evaluationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3161,8 +3145,10 @@ describe('v1.DatasetServiceClient', () => { const result = client.matchSliceFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'sliceValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3223,9 +3209,8 @@ describe('v1.DatasetServiceClient', () => { }); it('matchSpecialistPoolFromSpecialistPoolName', () => { - const result = client.matchSpecialistPoolFromSpecialistPoolName( - fakePath - ); + const result = + client.matchSpecialistPoolFromSpecialistPoolName(fakePath); assert.strictEqual(result, 'specialistPoolValue'); assert( (client.pathTemplates.specialistPoolPathTemplate.match as SinonStub) @@ -3262,8 +3247,10 @@ describe('v1.DatasetServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.trainingPipelinePathTemplate - .render as SinonStub) + ( + client.pathTemplates.trainingPipelinePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -3290,9 +3277,8 @@ describe('v1.DatasetServiceClient', () => { }); it('matchTrainingPipelineFromTrainingPipelineName', () => { - const result = client.matchTrainingPipelineFromTrainingPipelineName( - fakePath - ); + const result = + client.matchTrainingPipelineFromTrainingPipelineName(fakePath); assert.strictEqual(result, 'trainingPipelineValue'); assert( (client.pathTemplates.trainingPipelinePathTemplate.match as SinonStub) diff --git a/packages/google-cloud-aiplatform/test/gapic_dataset_service_v1beta1.ts b/packages/google-cloud-aiplatform/test/gapic_dataset_service_v1beta1.ts index 89ca93906a9..810cee6136f 100644 --- a/packages/google-cloud-aiplatform/test/gapic_dataset_service_v1beta1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_dataset_service_v1beta1.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; @@ -281,9 +280,8 @@ describe('v1beta1.DatasetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.Dataset() ); - client.innerApiCalls.getDataset = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getDataset = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getDataset( request, @@ -395,9 +393,8 @@ describe('v1beta1.DatasetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.Dataset() ); - client.innerApiCalls.updateDataset = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateDataset = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateDataset( request, @@ -508,9 +505,8 @@ describe('v1beta1.DatasetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.AnnotationSpec() ); - client.innerApiCalls.getAnnotationSpec = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getAnnotationSpec = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getAnnotationSpec( request, @@ -589,9 +585,8 @@ describe('v1beta1.DatasetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createDataset = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.createDataset = + stubLongRunningCall(expectedResponse); const [operation] = await client.createDataset(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -623,9 +618,8 @@ describe('v1beta1.DatasetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createDataset = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createDataset = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createDataset( request, @@ -785,9 +779,8 @@ describe('v1beta1.DatasetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteDataset = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteDataset = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteDataset(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -819,9 +812,8 @@ describe('v1beta1.DatasetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteDataset = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteDataset = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteDataset( request, @@ -1013,9 +1005,8 @@ describe('v1beta1.DatasetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.importData = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.importData = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.importData( request, @@ -1204,9 +1195,8 @@ describe('v1beta1.DatasetServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.exportData = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.exportData = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.exportData( request, @@ -1410,9 +1400,8 @@ describe('v1beta1.DatasetServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.Dataset() ), ]; - client.innerApiCalls.listDatasets = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listDatasets = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listDatasets( request, @@ -1490,9 +1479,8 @@ describe('v1beta1.DatasetServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.Dataset() ), ]; - client.descriptors.page.listDatasets.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listDatasets.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listDatasetsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.aiplatform.v1beta1.Dataset[] = []; @@ -1517,10 +1505,9 @@ describe('v1beta1.DatasetServiceClient', () => { .calledWith(client.innerApiCalls.listDatasets, request) ); assert.strictEqual( - (client.descriptors.page.listDatasets - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDatasets.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1564,10 +1551,9 @@ describe('v1beta1.DatasetServiceClient', () => { .calledWith(client.innerApiCalls.listDatasets, request) ); assert.strictEqual( - (client.descriptors.page.listDatasets - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDatasets.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1594,9 +1580,8 @@ describe('v1beta1.DatasetServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.Dataset() ), ]; - client.descriptors.page.listDatasets.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listDatasets.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.aiplatform.v1beta1.IDataset[] = []; const iterable = client.listDatasetsAsync(request); for await (const resource of iterable) { @@ -1604,15 +1589,15 @@ describe('v1beta1.DatasetServiceClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listDatasets - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listDatasets.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listDatasets - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDatasets.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1629,10 +1614,8 @@ describe('v1beta1.DatasetServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listDatasets.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listDatasets.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listDatasetsAsync(request); await assert.rejects(async () => { const responses: protos.google.cloud.aiplatform.v1beta1.IDataset[] = []; @@ -1641,15 +1624,15 @@ describe('v1beta1.DatasetServiceClient', () => { } }); assert.deepStrictEqual( - (client.descriptors.page.listDatasets - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listDatasets.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listDatasets - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDatasets.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1724,9 +1707,8 @@ describe('v1beta1.DatasetServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.DataItem() ), ]; - client.innerApiCalls.listDataItems = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listDataItems = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listDataItems( request, @@ -1804,9 +1786,8 @@ describe('v1beta1.DatasetServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.DataItem() ), ]; - client.descriptors.page.listDataItems.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listDataItems.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listDataItemsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.aiplatform.v1beta1.DataItem[] = []; @@ -1831,10 +1812,9 @@ describe('v1beta1.DatasetServiceClient', () => { .calledWith(client.innerApiCalls.listDataItems, request) ); assert.strictEqual( - (client.descriptors.page.listDataItems - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDataItems.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1851,10 +1831,8 @@ describe('v1beta1.DatasetServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listDataItems.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listDataItems.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listDataItemsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.aiplatform.v1beta1.DataItem[] = []; @@ -1878,10 +1856,9 @@ describe('v1beta1.DatasetServiceClient', () => { .calledWith(client.innerApiCalls.listDataItems, request) ); assert.strictEqual( - (client.descriptors.page.listDataItems - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDataItems.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1908,9 +1885,8 @@ describe('v1beta1.DatasetServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.DataItem() ), ]; - client.descriptors.page.listDataItems.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listDataItems.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.aiplatform.v1beta1.IDataItem[] = []; const iterable = client.listDataItemsAsync(request); for await (const resource of iterable) { @@ -1918,15 +1894,15 @@ describe('v1beta1.DatasetServiceClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listDataItems - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listDataItems.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listDataItems - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDataItems.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1943,27 +1919,26 @@ describe('v1beta1.DatasetServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listDataItems.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listDataItems.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listDataItemsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1beta1.IDataItem[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.IDataItem[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listDataItems - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listDataItems.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listDataItems - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDataItems.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2038,9 +2013,8 @@ describe('v1beta1.DatasetServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.Annotation() ), ]; - client.innerApiCalls.listAnnotations = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listAnnotations = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listAnnotations( request, @@ -2118,12 +2092,12 @@ describe('v1beta1.DatasetServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.Annotation() ), ]; - client.descriptors.page.listAnnotations.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listAnnotations.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listAnnotationsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.Annotation[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.Annotation[] = + []; stream.on( 'data', (response: protos.google.cloud.aiplatform.v1beta1.Annotation) => { @@ -2145,10 +2119,9 @@ describe('v1beta1.DatasetServiceClient', () => { .calledWith(client.innerApiCalls.listAnnotations, request) ); assert.strictEqual( - (client.descriptors.page.listAnnotations - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listAnnotations.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2165,13 +2138,12 @@ describe('v1beta1.DatasetServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listAnnotations.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listAnnotations.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listAnnotationsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.Annotation[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.Annotation[] = + []; stream.on( 'data', (response: protos.google.cloud.aiplatform.v1beta1.Annotation) => { @@ -2192,10 +2164,9 @@ describe('v1beta1.DatasetServiceClient', () => { .calledWith(client.innerApiCalls.listAnnotations, request) ); assert.strictEqual( - (client.descriptors.page.listAnnotations - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listAnnotations.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2222,25 +2193,25 @@ describe('v1beta1.DatasetServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.Annotation() ), ]; - client.descriptors.page.listAnnotations.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.aiplatform.v1beta1.IAnnotation[] = []; + client.descriptors.page.listAnnotations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.aiplatform.v1beta1.IAnnotation[] = + []; const iterable = client.listAnnotationsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listAnnotations - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listAnnotations.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listAnnotations - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listAnnotations.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2257,27 +2228,26 @@ describe('v1beta1.DatasetServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listAnnotations.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listAnnotations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listAnnotationsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1beta1.IAnnotation[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.IAnnotation[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listAnnotations - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listAnnotations.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listAnnotations - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listAnnotations.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2438,9 +2408,8 @@ describe('v1beta1.DatasetServiceClient', () => { }); it('matchAnnotationSpecFromAnnotationSpecName', () => { - const result = client.matchAnnotationSpecFromAnnotationSpecName( - fakePath - ); + const result = + client.matchAnnotationSpecFromAnnotationSpecName(fakePath); assert.strictEqual(result, 'annotationSpecValue'); assert( (client.pathTemplates.annotationSpecPathTemplate.match as SinonStub) @@ -2477,8 +2446,10 @@ describe('v1beta1.DatasetServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -2488,8 +2459,10 @@ describe('v1beta1.DatasetServiceClient', () => { const result = client.matchProjectFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2499,21 +2472,24 @@ describe('v1beta1.DatasetServiceClient', () => { const result = client.matchLocationFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchBatchPredictionJobFromBatchPredictionJobName', () => { - const result = client.matchBatchPredictionJobFromBatchPredictionJobName( - fakePath - ); + const result = + client.matchBatchPredictionJobFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'batchPredictionJobValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2714,9 +2690,8 @@ describe('v1beta1.DatasetServiceClient', () => { }); it('matchDataLabelingJobFromDataLabelingJobName', () => { - const result = client.matchDataLabelingJobFromDataLabelingJobName( - fakePath - ); + const result = + client.matchDataLabelingJobFromDataLabelingJobName(fakePath); assert.strictEqual(result, 'dataLabelingJobValue'); assert( (client.pathTemplates.dataLabelingJobPathTemplate.match as SinonStub) @@ -2881,47 +2856,54 @@ describe('v1beta1.DatasetServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromHyperparameterTuningJobName', () => { - const result = client.matchProjectFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchProjectFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromHyperparameterTuningJobName', () => { - const result = client.matchLocationFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchLocationFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchHyperparameterTuningJobFromHyperparameterTuningJobName', () => { - const result = client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( + fakePath + ); assert.strictEqual(result, 'hyperparameterTuningJobValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3148,34 +3130,38 @@ describe('v1beta1.DatasetServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .render as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromModelEvaluationSliceName', () => { - const result = client.matchProjectFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchProjectFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromModelEvaluationSliceName', () => { - const result = client.matchLocationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchLocationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3185,21 +3171,24 @@ describe('v1beta1.DatasetServiceClient', () => { const result = client.matchModelFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'modelValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchEvaluationFromModelEvaluationSliceName', () => { - const result = client.matchEvaluationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchEvaluationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'evaluationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3209,8 +3198,10 @@ describe('v1beta1.DatasetServiceClient', () => { const result = client.matchSliceFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'sliceValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3271,9 +3262,8 @@ describe('v1beta1.DatasetServiceClient', () => { }); it('matchSpecialistPoolFromSpecialistPoolName', () => { - const result = client.matchSpecialistPoolFromSpecialistPoolName( - fakePath - ); + const result = + client.matchSpecialistPoolFromSpecialistPoolName(fakePath); assert.strictEqual(result, 'specialistPoolValue'); assert( (client.pathTemplates.specialistPoolPathTemplate.match as SinonStub) @@ -3374,8 +3364,10 @@ describe('v1beta1.DatasetServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.trainingPipelinePathTemplate - .render as SinonStub) + ( + client.pathTemplates.trainingPipelinePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -3402,9 +3394,8 @@ describe('v1beta1.DatasetServiceClient', () => { }); it('matchTrainingPipelineFromTrainingPipelineName', () => { - const result = client.matchTrainingPipelineFromTrainingPipelineName( - fakePath - ); + const result = + client.matchTrainingPipelineFromTrainingPipelineName(fakePath); assert.strictEqual(result, 'trainingPipelineValue'); assert( (client.pathTemplates.trainingPipelinePathTemplate.match as SinonStub) diff --git a/packages/google-cloud-aiplatform/test/gapic_endpoint_service_v1.ts b/packages/google-cloud-aiplatform/test/gapic_endpoint_service_v1.ts index 95998c9f88d..b4036d62d6d 100644 --- a/packages/google-cloud-aiplatform/test/gapic_endpoint_service_v1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_endpoint_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; @@ -281,9 +280,8 @@ describe('v1.EndpointServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.Endpoint() ); - client.innerApiCalls.getEndpoint = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getEndpoint = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getEndpoint( request, @@ -395,9 +393,8 @@ describe('v1.EndpointServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.Endpoint() ); - client.innerApiCalls.updateEndpoint = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateEndpoint = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateEndpoint( request, @@ -477,9 +474,8 @@ describe('v1.EndpointServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createEndpoint = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.createEndpoint = + stubLongRunningCall(expectedResponse); const [operation] = await client.createEndpoint(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -511,9 +507,8 @@ describe('v1.EndpointServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createEndpoint = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createEndpoint = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createEndpoint( request, @@ -673,9 +668,8 @@ describe('v1.EndpointServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteEndpoint = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteEndpoint = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteEndpoint(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -707,9 +701,8 @@ describe('v1.EndpointServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteEndpoint = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteEndpoint = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteEndpoint( request, @@ -901,9 +894,8 @@ describe('v1.EndpointServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deployModel = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deployModel = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deployModel( request, @@ -1060,9 +1052,8 @@ describe('v1.EndpointServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.undeployModel = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.undeployModel = + stubLongRunningCall(expectedResponse); const [operation] = await client.undeployModel(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -1094,9 +1085,8 @@ describe('v1.EndpointServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.undeployModel = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.undeployModel = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.undeployModel( request, @@ -1291,9 +1281,8 @@ describe('v1.EndpointServiceClient', () => { generateSampleMessage(new protos.google.cloud.aiplatform.v1.Endpoint()), generateSampleMessage(new protos.google.cloud.aiplatform.v1.Endpoint()), ]; - client.innerApiCalls.listEndpoints = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listEndpoints = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listEndpoints( request, @@ -1365,9 +1354,8 @@ describe('v1.EndpointServiceClient', () => { generateSampleMessage(new protos.google.cloud.aiplatform.v1.Endpoint()), generateSampleMessage(new protos.google.cloud.aiplatform.v1.Endpoint()), ]; - client.descriptors.page.listEndpoints.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listEndpoints.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listEndpointsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.aiplatform.v1.Endpoint[] = []; @@ -1392,10 +1380,9 @@ describe('v1.EndpointServiceClient', () => { .calledWith(client.innerApiCalls.listEndpoints, request) ); assert.strictEqual( - (client.descriptors.page.listEndpoints - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listEndpoints.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1412,10 +1399,8 @@ describe('v1.EndpointServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listEndpoints.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listEndpoints.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listEndpointsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.aiplatform.v1.Endpoint[] = []; @@ -1439,10 +1424,9 @@ describe('v1.EndpointServiceClient', () => { .calledWith(client.innerApiCalls.listEndpoints, request) ); assert.strictEqual( - (client.descriptors.page.listEndpoints - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listEndpoints.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1463,9 +1447,8 @@ describe('v1.EndpointServiceClient', () => { generateSampleMessage(new protos.google.cloud.aiplatform.v1.Endpoint()), generateSampleMessage(new protos.google.cloud.aiplatform.v1.Endpoint()), ]; - client.descriptors.page.listEndpoints.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listEndpoints.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.aiplatform.v1.IEndpoint[] = []; const iterable = client.listEndpointsAsync(request); for await (const resource of iterable) { @@ -1473,15 +1456,15 @@ describe('v1.EndpointServiceClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listEndpoints - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listEndpoints.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listEndpoints - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listEndpoints.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1498,10 +1481,8 @@ describe('v1.EndpointServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listEndpoints.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listEndpoints.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listEndpointsAsync(request); await assert.rejects(async () => { const responses: protos.google.cloud.aiplatform.v1.IEndpoint[] = []; @@ -1510,15 +1491,15 @@ describe('v1.EndpointServiceClient', () => { } }); assert.deepStrictEqual( - (client.descriptors.page.listEndpoints - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listEndpoints.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listEndpoints - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listEndpoints.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1679,9 +1660,8 @@ describe('v1.EndpointServiceClient', () => { }); it('matchAnnotationSpecFromAnnotationSpecName', () => { - const result = client.matchAnnotationSpecFromAnnotationSpecName( - fakePath - ); + const result = + client.matchAnnotationSpecFromAnnotationSpecName(fakePath); assert.strictEqual(result, 'annotationSpecValue'); assert( (client.pathTemplates.annotationSpecPathTemplate.match as SinonStub) @@ -1718,8 +1698,10 @@ describe('v1.EndpointServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -1729,8 +1711,10 @@ describe('v1.EndpointServiceClient', () => { const result = client.matchProjectFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1740,21 +1724,24 @@ describe('v1.EndpointServiceClient', () => { const result = client.matchLocationFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchBatchPredictionJobFromBatchPredictionJobName', () => { - const result = client.matchBatchPredictionJobFromBatchPredictionJobName( - fakePath - ); + const result = + client.matchBatchPredictionJobFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'batchPredictionJobValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1955,9 +1942,8 @@ describe('v1.EndpointServiceClient', () => { }); it('matchDataLabelingJobFromDataLabelingJobName', () => { - const result = client.matchDataLabelingJobFromDataLabelingJobName( - fakePath - ); + const result = + client.matchDataLabelingJobFromDataLabelingJobName(fakePath); assert.strictEqual(result, 'dataLabelingJobValue'); assert( (client.pathTemplates.dataLabelingJobPathTemplate.match as SinonStub) @@ -2122,47 +2108,54 @@ describe('v1.EndpointServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromHyperparameterTuningJobName', () => { - const result = client.matchProjectFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchProjectFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromHyperparameterTuningJobName', () => { - const result = client.matchLocationFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchLocationFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchHyperparameterTuningJobFromHyperparameterTuningJobName', () => { - const result = client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( + fakePath + ); assert.strictEqual(result, 'hyperparameterTuningJobValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2389,34 +2382,38 @@ describe('v1.EndpointServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .render as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromModelEvaluationSliceName', () => { - const result = client.matchProjectFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchProjectFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromModelEvaluationSliceName', () => { - const result = client.matchLocationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchLocationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2426,21 +2423,24 @@ describe('v1.EndpointServiceClient', () => { const result = client.matchModelFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'modelValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchEvaluationFromModelEvaluationSliceName', () => { - const result = client.matchEvaluationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchEvaluationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'evaluationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2450,8 +2450,10 @@ describe('v1.EndpointServiceClient', () => { const result = client.matchSliceFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'sliceValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2512,9 +2514,8 @@ describe('v1.EndpointServiceClient', () => { }); it('matchSpecialistPoolFromSpecialistPoolName', () => { - const result = client.matchSpecialistPoolFromSpecialistPoolName( - fakePath - ); + const result = + client.matchSpecialistPoolFromSpecialistPoolName(fakePath); assert.strictEqual(result, 'specialistPoolValue'); assert( (client.pathTemplates.specialistPoolPathTemplate.match as SinonStub) @@ -2551,8 +2552,10 @@ describe('v1.EndpointServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.trainingPipelinePathTemplate - .render as SinonStub) + ( + client.pathTemplates.trainingPipelinePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -2579,9 +2582,8 @@ describe('v1.EndpointServiceClient', () => { }); it('matchTrainingPipelineFromTrainingPipelineName', () => { - const result = client.matchTrainingPipelineFromTrainingPipelineName( - fakePath - ); + const result = + client.matchTrainingPipelineFromTrainingPipelineName(fakePath); assert.strictEqual(result, 'trainingPipelineValue'); assert( (client.pathTemplates.trainingPipelinePathTemplate.match as SinonStub) diff --git a/packages/google-cloud-aiplatform/test/gapic_endpoint_service_v1beta1.ts b/packages/google-cloud-aiplatform/test/gapic_endpoint_service_v1beta1.ts index fe57803d936..cdc3f2d9da5 100644 --- a/packages/google-cloud-aiplatform/test/gapic_endpoint_service_v1beta1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_endpoint_service_v1beta1.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; @@ -281,9 +280,8 @@ describe('v1beta1.EndpointServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.Endpoint() ); - client.innerApiCalls.getEndpoint = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getEndpoint = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getEndpoint( request, @@ -395,9 +393,8 @@ describe('v1beta1.EndpointServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.Endpoint() ); - client.innerApiCalls.updateEndpoint = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateEndpoint = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateEndpoint( request, @@ -477,9 +474,8 @@ describe('v1beta1.EndpointServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createEndpoint = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.createEndpoint = + stubLongRunningCall(expectedResponse); const [operation] = await client.createEndpoint(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -511,9 +507,8 @@ describe('v1beta1.EndpointServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createEndpoint = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createEndpoint = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createEndpoint( request, @@ -673,9 +668,8 @@ describe('v1beta1.EndpointServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteEndpoint = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteEndpoint = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteEndpoint(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -707,9 +701,8 @@ describe('v1beta1.EndpointServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteEndpoint = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteEndpoint = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteEndpoint( request, @@ -901,9 +894,8 @@ describe('v1beta1.EndpointServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deployModel = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deployModel = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deployModel( request, @@ -1060,9 +1052,8 @@ describe('v1beta1.EndpointServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.undeployModel = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.undeployModel = + stubLongRunningCall(expectedResponse); const [operation] = await client.undeployModel(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -1094,9 +1085,8 @@ describe('v1beta1.EndpointServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.undeployModel = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.undeployModel = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.undeployModel( request, @@ -1303,9 +1293,8 @@ describe('v1beta1.EndpointServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.Endpoint() ), ]; - client.innerApiCalls.listEndpoints = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listEndpoints = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listEndpoints( request, @@ -1383,9 +1372,8 @@ describe('v1beta1.EndpointServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.Endpoint() ), ]; - client.descriptors.page.listEndpoints.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listEndpoints.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listEndpointsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.aiplatform.v1beta1.Endpoint[] = []; @@ -1410,10 +1398,9 @@ describe('v1beta1.EndpointServiceClient', () => { .calledWith(client.innerApiCalls.listEndpoints, request) ); assert.strictEqual( - (client.descriptors.page.listEndpoints - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listEndpoints.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1430,10 +1417,8 @@ describe('v1beta1.EndpointServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listEndpoints.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listEndpoints.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listEndpointsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.aiplatform.v1beta1.Endpoint[] = []; @@ -1457,10 +1442,9 @@ describe('v1beta1.EndpointServiceClient', () => { .calledWith(client.innerApiCalls.listEndpoints, request) ); assert.strictEqual( - (client.descriptors.page.listEndpoints - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listEndpoints.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1487,9 +1471,8 @@ describe('v1beta1.EndpointServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.Endpoint() ), ]; - client.descriptors.page.listEndpoints.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listEndpoints.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.aiplatform.v1beta1.IEndpoint[] = []; const iterable = client.listEndpointsAsync(request); for await (const resource of iterable) { @@ -1497,15 +1480,15 @@ describe('v1beta1.EndpointServiceClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listEndpoints - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listEndpoints.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listEndpoints - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listEndpoints.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1522,27 +1505,26 @@ describe('v1beta1.EndpointServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listEndpoints.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listEndpoints.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listEndpointsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1beta1.IEndpoint[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.IEndpoint[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listEndpoints - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listEndpoints.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listEndpoints - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listEndpoints.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1703,9 +1685,8 @@ describe('v1beta1.EndpointServiceClient', () => { }); it('matchAnnotationSpecFromAnnotationSpecName', () => { - const result = client.matchAnnotationSpecFromAnnotationSpecName( - fakePath - ); + const result = + client.matchAnnotationSpecFromAnnotationSpecName(fakePath); assert.strictEqual(result, 'annotationSpecValue'); assert( (client.pathTemplates.annotationSpecPathTemplate.match as SinonStub) @@ -1742,8 +1723,10 @@ describe('v1beta1.EndpointServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -1753,8 +1736,10 @@ describe('v1beta1.EndpointServiceClient', () => { const result = client.matchProjectFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1764,21 +1749,24 @@ describe('v1beta1.EndpointServiceClient', () => { const result = client.matchLocationFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchBatchPredictionJobFromBatchPredictionJobName', () => { - const result = client.matchBatchPredictionJobFromBatchPredictionJobName( - fakePath - ); + const result = + client.matchBatchPredictionJobFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'batchPredictionJobValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1979,9 +1967,8 @@ describe('v1beta1.EndpointServiceClient', () => { }); it('matchDataLabelingJobFromDataLabelingJobName', () => { - const result = client.matchDataLabelingJobFromDataLabelingJobName( - fakePath - ); + const result = + client.matchDataLabelingJobFromDataLabelingJobName(fakePath); assert.strictEqual(result, 'dataLabelingJobValue'); assert( (client.pathTemplates.dataLabelingJobPathTemplate.match as SinonStub) @@ -2146,47 +2133,54 @@ describe('v1beta1.EndpointServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromHyperparameterTuningJobName', () => { - const result = client.matchProjectFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchProjectFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromHyperparameterTuningJobName', () => { - const result = client.matchLocationFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchLocationFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchHyperparameterTuningJobFromHyperparameterTuningJobName', () => { - const result = client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( + fakePath + ); assert.strictEqual(result, 'hyperparameterTuningJobValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2413,34 +2407,38 @@ describe('v1beta1.EndpointServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .render as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromModelEvaluationSliceName', () => { - const result = client.matchProjectFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchProjectFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromModelEvaluationSliceName', () => { - const result = client.matchLocationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchLocationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2450,21 +2448,24 @@ describe('v1beta1.EndpointServiceClient', () => { const result = client.matchModelFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'modelValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchEvaluationFromModelEvaluationSliceName', () => { - const result = client.matchEvaluationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchEvaluationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'evaluationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2474,8 +2475,10 @@ describe('v1beta1.EndpointServiceClient', () => { const result = client.matchSliceFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'sliceValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2536,9 +2539,8 @@ describe('v1beta1.EndpointServiceClient', () => { }); it('matchSpecialistPoolFromSpecialistPoolName', () => { - const result = client.matchSpecialistPoolFromSpecialistPoolName( - fakePath - ); + const result = + client.matchSpecialistPoolFromSpecialistPoolName(fakePath); assert.strictEqual(result, 'specialistPoolValue'); assert( (client.pathTemplates.specialistPoolPathTemplate.match as SinonStub) @@ -2639,8 +2641,10 @@ describe('v1beta1.EndpointServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.trainingPipelinePathTemplate - .render as SinonStub) + ( + client.pathTemplates.trainingPipelinePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -2667,9 +2671,8 @@ describe('v1beta1.EndpointServiceClient', () => { }); it('matchTrainingPipelineFromTrainingPipelineName', () => { - const result = client.matchTrainingPipelineFromTrainingPipelineName( - fakePath - ); + const result = + client.matchTrainingPipelineFromTrainingPipelineName(fakePath); assert.strictEqual(result, 'trainingPipelineValue'); assert( (client.pathTemplates.trainingPipelinePathTemplate.match as SinonStub) diff --git a/packages/google-cloud-aiplatform/test/gapic_job_service_v1.ts b/packages/google-cloud-aiplatform/test/gapic_job_service_v1.ts index e71caf12e27..625903b09e6 100644 --- a/packages/google-cloud-aiplatform/test/gapic_job_service_v1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_job_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; @@ -279,9 +278,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.CustomJob() ); - client.innerApiCalls.createCustomJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createCustomJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createCustomJob( request, @@ -391,9 +389,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.CustomJob() ); - client.innerApiCalls.getCustomJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getCustomJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getCustomJob( request, @@ -503,9 +500,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.cancelCustomJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.cancelCustomJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.cancelCustomJob( request, @@ -584,9 +580,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.DataLabelingJob() ); - client.innerApiCalls.createDataLabelingJob = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.createDataLabelingJob = + stubSimpleCall(expectedResponse); const [response] = await client.createDataLabelingJob(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -617,9 +612,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.DataLabelingJob() ); - client.innerApiCalls.createDataLabelingJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createDataLabelingJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createDataLabelingJob( request, @@ -701,9 +695,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.DataLabelingJob() ); - client.innerApiCalls.getDataLabelingJob = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.getDataLabelingJob = + stubSimpleCall(expectedResponse); const [response] = await client.getDataLabelingJob(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -734,9 +727,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.DataLabelingJob() ); - client.innerApiCalls.getDataLabelingJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getDataLabelingJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getDataLabelingJob( request, @@ -815,9 +807,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.cancelDataLabelingJob = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.cancelDataLabelingJob = + stubSimpleCall(expectedResponse); const [response] = await client.cancelDataLabelingJob(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -848,9 +839,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.cancelDataLabelingJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.cancelDataLabelingJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.cancelDataLabelingJob( request, @@ -932,9 +922,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.HyperparameterTuningJob() ); - client.innerApiCalls.createHyperparameterTuningJob = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.createHyperparameterTuningJob = + stubSimpleCall(expectedResponse); const [response] = await client.createHyperparameterTuningJob(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -965,9 +954,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.HyperparameterTuningJob() ); - client.innerApiCalls.createHyperparameterTuningJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createHyperparameterTuningJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createHyperparameterTuningJob( request, @@ -1049,9 +1037,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.HyperparameterTuningJob() ); - client.innerApiCalls.getHyperparameterTuningJob = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.getHyperparameterTuningJob = + stubSimpleCall(expectedResponse); const [response] = await client.getHyperparameterTuningJob(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1082,9 +1069,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.HyperparameterTuningJob() ); - client.innerApiCalls.getHyperparameterTuningJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getHyperparameterTuningJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getHyperparameterTuningJob( request, @@ -1166,9 +1152,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.cancelHyperparameterTuningJob = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.cancelHyperparameterTuningJob = + stubSimpleCall(expectedResponse); const [response] = await client.cancelHyperparameterTuningJob(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1199,9 +1184,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.cancelHyperparameterTuningJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.cancelHyperparameterTuningJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.cancelHyperparameterTuningJob( request, @@ -1283,9 +1267,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.BatchPredictionJob() ); - client.innerApiCalls.createBatchPredictionJob = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.createBatchPredictionJob = + stubSimpleCall(expectedResponse); const [response] = await client.createBatchPredictionJob(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1316,9 +1299,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.BatchPredictionJob() ); - client.innerApiCalls.createBatchPredictionJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createBatchPredictionJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createBatchPredictionJob( request, @@ -1400,9 +1382,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.BatchPredictionJob() ); - client.innerApiCalls.getBatchPredictionJob = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.getBatchPredictionJob = + stubSimpleCall(expectedResponse); const [response] = await client.getBatchPredictionJob(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1433,9 +1414,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.BatchPredictionJob() ); - client.innerApiCalls.getBatchPredictionJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getBatchPredictionJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getBatchPredictionJob( request, @@ -1517,9 +1497,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.cancelBatchPredictionJob = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.cancelBatchPredictionJob = + stubSimpleCall(expectedResponse); const [response] = await client.cancelBatchPredictionJob(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1550,9 +1529,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.cancelBatchPredictionJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.cancelBatchPredictionJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.cancelBatchPredictionJob( request, @@ -1634,9 +1612,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteCustomJob = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteCustomJob = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteCustomJob(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -1668,9 +1645,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteCustomJob = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteCustomJob = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteCustomJob( request, @@ -1830,9 +1806,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteDataLabelingJob = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteDataLabelingJob = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteDataLabelingJob(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -1864,9 +1839,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteDataLabelingJob = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteDataLabelingJob = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteDataLabelingJob( request, @@ -2029,9 +2003,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteHyperparameterTuningJob = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteHyperparameterTuningJob = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteHyperparameterTuningJob(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -2063,9 +2036,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteHyperparameterTuningJob = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteHyperparameterTuningJob = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteHyperparameterTuningJob( request, @@ -2178,9 +2150,10 @@ describe('v1.JobServiceClient', () => { expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteHyperparameterTuningJobProgress( - expectedResponse.name - ); + const decodedOperation = + await client.checkDeleteHyperparameterTuningJobProgress( + expectedResponse.name + ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); assert(decodedOperation.metadata); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); @@ -2228,9 +2201,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteBatchPredictionJob = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteBatchPredictionJob = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteBatchPredictionJob(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -2262,9 +2234,8 @@ describe('v1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteBatchPredictionJob = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteBatchPredictionJob = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteBatchPredictionJob( request, @@ -2377,9 +2348,10 @@ describe('v1.JobServiceClient', () => { expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteBatchPredictionJobProgress( - expectedResponse.name - ); + const decodedOperation = + await client.checkDeleteBatchPredictionJobProgress( + expectedResponse.name + ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); assert(decodedOperation.metadata); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); @@ -2474,9 +2446,8 @@ describe('v1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1.CustomJob() ), ]; - client.innerApiCalls.listCustomJobs = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listCustomJobs = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listCustomJobs( request, @@ -2554,9 +2525,8 @@ describe('v1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1.CustomJob() ), ]; - client.descriptors.page.listCustomJobs.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listCustomJobs.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listCustomJobsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.aiplatform.v1.CustomJob[] = []; @@ -2581,10 +2551,9 @@ describe('v1.JobServiceClient', () => { .calledWith(client.innerApiCalls.listCustomJobs, request) ); assert.strictEqual( - (client.descriptors.page.listCustomJobs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCustomJobs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2601,10 +2570,8 @@ describe('v1.JobServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listCustomJobs.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listCustomJobs.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listCustomJobsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.aiplatform.v1.CustomJob[] = []; @@ -2628,10 +2595,9 @@ describe('v1.JobServiceClient', () => { .calledWith(client.innerApiCalls.listCustomJobs, request) ); assert.strictEqual( - (client.descriptors.page.listCustomJobs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCustomJobs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2658,9 +2624,8 @@ describe('v1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1.CustomJob() ), ]; - client.descriptors.page.listCustomJobs.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listCustomJobs.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.aiplatform.v1.ICustomJob[] = []; const iterable = client.listCustomJobsAsync(request); for await (const resource of iterable) { @@ -2668,15 +2633,15 @@ describe('v1.JobServiceClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listCustomJobs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listCustomJobs.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listCustomJobs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCustomJobs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2693,10 +2658,8 @@ describe('v1.JobServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listCustomJobs.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listCustomJobs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listCustomJobsAsync(request); await assert.rejects(async () => { const responses: protos.google.cloud.aiplatform.v1.ICustomJob[] = []; @@ -2705,15 +2668,15 @@ describe('v1.JobServiceClient', () => { } }); assert.deepStrictEqual( - (client.descriptors.page.listCustomJobs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listCustomJobs.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listCustomJobs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCustomJobs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2749,9 +2712,8 @@ describe('v1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1.DataLabelingJob() ), ]; - client.innerApiCalls.listDataLabelingJobs = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listDataLabelingJobs = + stubSimpleCall(expectedResponse); const [response] = await client.listDataLabelingJobs(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -2790,9 +2752,8 @@ describe('v1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1.DataLabelingJob() ), ]; - client.innerApiCalls.listDataLabelingJobs = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listDataLabelingJobs = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listDataLabelingJobs( request, @@ -2870,12 +2831,12 @@ describe('v1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1.DataLabelingJob() ), ]; - client.descriptors.page.listDataLabelingJobs.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listDataLabelingJobs.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listDataLabelingJobsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1.DataLabelingJob[] = []; + const responses: protos.google.cloud.aiplatform.v1.DataLabelingJob[] = + []; stream.on( 'data', (response: protos.google.cloud.aiplatform.v1.DataLabelingJob) => { @@ -2897,10 +2858,9 @@ describe('v1.JobServiceClient', () => { .calledWith(client.innerApiCalls.listDataLabelingJobs, request) ); assert.strictEqual( - (client.descriptors.page.listDataLabelingJobs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDataLabelingJobs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2917,13 +2877,12 @@ describe('v1.JobServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listDataLabelingJobs.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listDataLabelingJobs.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listDataLabelingJobsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1.DataLabelingJob[] = []; + const responses: protos.google.cloud.aiplatform.v1.DataLabelingJob[] = + []; stream.on( 'data', (response: protos.google.cloud.aiplatform.v1.DataLabelingJob) => { @@ -2944,10 +2903,9 @@ describe('v1.JobServiceClient', () => { .calledWith(client.innerApiCalls.listDataLabelingJobs, request) ); assert.strictEqual( - (client.descriptors.page.listDataLabelingJobs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDataLabelingJobs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2974,25 +2932,25 @@ describe('v1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1.DataLabelingJob() ), ]; - client.descriptors.page.listDataLabelingJobs.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.aiplatform.v1.IDataLabelingJob[] = []; + client.descriptors.page.listDataLabelingJobs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.aiplatform.v1.IDataLabelingJob[] = + []; const iterable = client.listDataLabelingJobsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listDataLabelingJobs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listDataLabelingJobs.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listDataLabelingJobs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDataLabelingJobs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3009,27 +2967,26 @@ describe('v1.JobServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listDataLabelingJobs.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listDataLabelingJobs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listDataLabelingJobsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1.IDataLabelingJob[] = []; + const responses: protos.google.cloud.aiplatform.v1.IDataLabelingJob[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listDataLabelingJobs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listDataLabelingJobs.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listDataLabelingJobs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDataLabelingJobs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3065,9 +3022,8 @@ describe('v1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1.HyperparameterTuningJob() ), ]; - client.innerApiCalls.listHyperparameterTuningJobs = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listHyperparameterTuningJobs = + stubSimpleCall(expectedResponse); const [response] = await client.listHyperparameterTuningJobs(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -3106,9 +3062,8 @@ describe('v1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1.HyperparameterTuningJob() ), ]; - client.innerApiCalls.listHyperparameterTuningJobs = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listHyperparameterTuningJobs = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listHyperparameterTuningJobs( request, @@ -3191,12 +3146,12 @@ describe('v1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1.HyperparameterTuningJob() ), ]; - client.descriptors.page.listHyperparameterTuningJobs.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listHyperparameterTuningJobs.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listHyperparameterTuningJobsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1.HyperparameterTuningJob[] = []; + const responses: protos.google.cloud.aiplatform.v1.HyperparameterTuningJob[] = + []; stream.on( 'data', ( @@ -3215,8 +3170,10 @@ describe('v1.JobServiceClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.listHyperparameterTuningJobs - .createStream as SinonStub) + ( + client.descriptors.page.listHyperparameterTuningJobs + .createStream as SinonStub + ) .getCall(0) .calledWith( client.innerApiCalls.listHyperparameterTuningJobs, @@ -3224,10 +3181,10 @@ describe('v1.JobServiceClient', () => { ) ); assert.strictEqual( - (client.descriptors.page.listHyperparameterTuningJobs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listHyperparameterTuningJobs + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3244,13 +3201,12 @@ describe('v1.JobServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listHyperparameterTuningJobs.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listHyperparameterTuningJobs.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listHyperparameterTuningJobsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1.HyperparameterTuningJob[] = []; + const responses: protos.google.cloud.aiplatform.v1.HyperparameterTuningJob[] = + []; stream.on( 'data', ( @@ -3268,8 +3224,10 @@ describe('v1.JobServiceClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listHyperparameterTuningJobs - .createStream as SinonStub) + ( + client.descriptors.page.listHyperparameterTuningJobs + .createStream as SinonStub + ) .getCall(0) .calledWith( client.innerApiCalls.listHyperparameterTuningJobs, @@ -3277,10 +3235,10 @@ describe('v1.JobServiceClient', () => { ) ); assert.strictEqual( - (client.descriptors.page.listHyperparameterTuningJobs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listHyperparameterTuningJobs + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3307,25 +3265,27 @@ describe('v1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1.HyperparameterTuningJob() ), ]; - client.descriptors.page.listHyperparameterTuningJobs.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.aiplatform.v1.IHyperparameterTuningJob[] = []; + client.descriptors.page.listHyperparameterTuningJobs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.aiplatform.v1.IHyperparameterTuningJob[] = + []; const iterable = client.listHyperparameterTuningJobsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listHyperparameterTuningJobs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listHyperparameterTuningJobs + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listHyperparameterTuningJobs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listHyperparameterTuningJobs + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3342,27 +3302,28 @@ describe('v1.JobServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listHyperparameterTuningJobs.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listHyperparameterTuningJobs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listHyperparameterTuningJobsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1.IHyperparameterTuningJob[] = []; + const responses: protos.google.cloud.aiplatform.v1.IHyperparameterTuningJob[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listHyperparameterTuningJobs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listHyperparameterTuningJobs + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listHyperparameterTuningJobs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listHyperparameterTuningJobs + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3398,9 +3359,8 @@ describe('v1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1.BatchPredictionJob() ), ]; - client.innerApiCalls.listBatchPredictionJobs = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listBatchPredictionJobs = + stubSimpleCall(expectedResponse); const [response] = await client.listBatchPredictionJobs(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -3439,9 +3399,8 @@ describe('v1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1.BatchPredictionJob() ), ]; - client.innerApiCalls.listBatchPredictionJobs = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listBatchPredictionJobs = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listBatchPredictionJobs( request, @@ -3524,12 +3483,12 @@ describe('v1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1.BatchPredictionJob() ), ]; - client.descriptors.page.listBatchPredictionJobs.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listBatchPredictionJobs.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listBatchPredictionJobsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1.BatchPredictionJob[] = []; + const responses: protos.google.cloud.aiplatform.v1.BatchPredictionJob[] = + []; stream.on( 'data', (response: protos.google.cloud.aiplatform.v1.BatchPredictionJob) => { @@ -3546,16 +3505,18 @@ describe('v1.JobServiceClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.listBatchPredictionJobs - .createStream as SinonStub) + ( + client.descriptors.page.listBatchPredictionJobs + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.listBatchPredictionJobs, request) ); assert.strictEqual( - (client.descriptors.page.listBatchPredictionJobs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listBatchPredictionJobs + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3572,13 +3533,12 @@ describe('v1.JobServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listBatchPredictionJobs.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listBatchPredictionJobs.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listBatchPredictionJobsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1.BatchPredictionJob[] = []; + const responses: protos.google.cloud.aiplatform.v1.BatchPredictionJob[] = + []; stream.on( 'data', (response: protos.google.cloud.aiplatform.v1.BatchPredictionJob) => { @@ -3594,16 +3554,18 @@ describe('v1.JobServiceClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listBatchPredictionJobs - .createStream as SinonStub) + ( + client.descriptors.page.listBatchPredictionJobs + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.listBatchPredictionJobs, request) ); assert.strictEqual( - (client.descriptors.page.listBatchPredictionJobs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listBatchPredictionJobs + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3630,25 +3592,27 @@ describe('v1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1.BatchPredictionJob() ), ]; - client.descriptors.page.listBatchPredictionJobs.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.aiplatform.v1.IBatchPredictionJob[] = []; + client.descriptors.page.listBatchPredictionJobs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.aiplatform.v1.IBatchPredictionJob[] = + []; const iterable = client.listBatchPredictionJobsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listBatchPredictionJobs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listBatchPredictionJobs + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listBatchPredictionJobs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listBatchPredictionJobs + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3665,27 +3629,28 @@ describe('v1.JobServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listBatchPredictionJobs.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listBatchPredictionJobs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listBatchPredictionJobsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1.IBatchPredictionJob[] = []; + const responses: protos.google.cloud.aiplatform.v1.IBatchPredictionJob[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listBatchPredictionJobs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listBatchPredictionJobs + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listBatchPredictionJobs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listBatchPredictionJobs + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3846,9 +3811,8 @@ describe('v1.JobServiceClient', () => { }); it('matchAnnotationSpecFromAnnotationSpecName', () => { - const result = client.matchAnnotationSpecFromAnnotationSpecName( - fakePath - ); + const result = + client.matchAnnotationSpecFromAnnotationSpecName(fakePath); assert.strictEqual(result, 'annotationSpecValue'); assert( (client.pathTemplates.annotationSpecPathTemplate.match as SinonStub) @@ -3885,8 +3849,10 @@ describe('v1.JobServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -3896,8 +3862,10 @@ describe('v1.JobServiceClient', () => { const result = client.matchProjectFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3907,21 +3875,24 @@ describe('v1.JobServiceClient', () => { const result = client.matchLocationFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchBatchPredictionJobFromBatchPredictionJobName', () => { - const result = client.matchBatchPredictionJobFromBatchPredictionJobName( - fakePath - ); + const result = + client.matchBatchPredictionJobFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'batchPredictionJobValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -4122,9 +4093,8 @@ describe('v1.JobServiceClient', () => { }); it('matchDataLabelingJobFromDataLabelingJobName', () => { - const result = client.matchDataLabelingJobFromDataLabelingJobName( - fakePath - ); + const result = + client.matchDataLabelingJobFromDataLabelingJobName(fakePath); assert.strictEqual(result, 'dataLabelingJobValue'); assert( (client.pathTemplates.dataLabelingJobPathTemplate.match as SinonStub) @@ -4289,47 +4259,54 @@ describe('v1.JobServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromHyperparameterTuningJobName', () => { - const result = client.matchProjectFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchProjectFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromHyperparameterTuningJobName', () => { - const result = client.matchLocationFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchLocationFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchHyperparameterTuningJobFromHyperparameterTuningJobName', () => { - const result = client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( + fakePath + ); assert.strictEqual(result, 'hyperparameterTuningJobValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -4556,34 +4533,38 @@ describe('v1.JobServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .render as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromModelEvaluationSliceName', () => { - const result = client.matchProjectFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchProjectFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromModelEvaluationSliceName', () => { - const result = client.matchLocationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchLocationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -4593,21 +4574,24 @@ describe('v1.JobServiceClient', () => { const result = client.matchModelFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'modelValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchEvaluationFromModelEvaluationSliceName', () => { - const result = client.matchEvaluationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchEvaluationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'evaluationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -4617,8 +4601,10 @@ describe('v1.JobServiceClient', () => { const result = client.matchSliceFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'sliceValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -4679,9 +4665,8 @@ describe('v1.JobServiceClient', () => { }); it('matchSpecialistPoolFromSpecialistPoolName', () => { - const result = client.matchSpecialistPoolFromSpecialistPoolName( - fakePath - ); + const result = + client.matchSpecialistPoolFromSpecialistPoolName(fakePath); assert.strictEqual(result, 'specialistPoolValue'); assert( (client.pathTemplates.specialistPoolPathTemplate.match as SinonStub) @@ -4718,8 +4703,10 @@ describe('v1.JobServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.trainingPipelinePathTemplate - .render as SinonStub) + ( + client.pathTemplates.trainingPipelinePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -4746,9 +4733,8 @@ describe('v1.JobServiceClient', () => { }); it('matchTrainingPipelineFromTrainingPipelineName', () => { - const result = client.matchTrainingPipelineFromTrainingPipelineName( - fakePath - ); + const result = + client.matchTrainingPipelineFromTrainingPipelineName(fakePath); assert.strictEqual(result, 'trainingPipelineValue'); assert( (client.pathTemplates.trainingPipelinePathTemplate.match as SinonStub) diff --git a/packages/google-cloud-aiplatform/test/gapic_job_service_v1beta1.ts b/packages/google-cloud-aiplatform/test/gapic_job_service_v1beta1.ts index 0007d2f37b7..2703610e982 100644 --- a/packages/google-cloud-aiplatform/test/gapic_job_service_v1beta1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_job_service_v1beta1.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('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.CustomJob() ); - client.innerApiCalls.createCustomJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createCustomJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createCustomJob( request, @@ -391,9 +389,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.CustomJob() ); - client.innerApiCalls.getCustomJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getCustomJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getCustomJob( request, @@ -503,9 +500,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.cancelCustomJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.cancelCustomJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.cancelCustomJob( request, @@ -584,9 +580,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.DataLabelingJob() ); - client.innerApiCalls.createDataLabelingJob = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.createDataLabelingJob = + stubSimpleCall(expectedResponse); const [response] = await client.createDataLabelingJob(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -617,9 +612,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.DataLabelingJob() ); - client.innerApiCalls.createDataLabelingJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createDataLabelingJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createDataLabelingJob( request, @@ -701,9 +695,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.DataLabelingJob() ); - client.innerApiCalls.getDataLabelingJob = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.getDataLabelingJob = + stubSimpleCall(expectedResponse); const [response] = await client.getDataLabelingJob(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -734,9 +727,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.DataLabelingJob() ); - client.innerApiCalls.getDataLabelingJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getDataLabelingJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getDataLabelingJob( request, @@ -815,9 +807,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.cancelDataLabelingJob = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.cancelDataLabelingJob = + stubSimpleCall(expectedResponse); const [response] = await client.cancelDataLabelingJob(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -848,9 +839,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.cancelDataLabelingJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.cancelDataLabelingJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.cancelDataLabelingJob( request, @@ -932,9 +922,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob() ); - client.innerApiCalls.createHyperparameterTuningJob = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.createHyperparameterTuningJob = + stubSimpleCall(expectedResponse); const [response] = await client.createHyperparameterTuningJob(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -965,9 +954,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob() ); - client.innerApiCalls.createHyperparameterTuningJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createHyperparameterTuningJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createHyperparameterTuningJob( request, @@ -1049,9 +1037,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob() ); - client.innerApiCalls.getHyperparameterTuningJob = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.getHyperparameterTuningJob = + stubSimpleCall(expectedResponse); const [response] = await client.getHyperparameterTuningJob(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1082,9 +1069,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob() ); - client.innerApiCalls.getHyperparameterTuningJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getHyperparameterTuningJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getHyperparameterTuningJob( request, @@ -1166,9 +1152,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.cancelHyperparameterTuningJob = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.cancelHyperparameterTuningJob = + stubSimpleCall(expectedResponse); const [response] = await client.cancelHyperparameterTuningJob(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1199,9 +1184,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.cancelHyperparameterTuningJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.cancelHyperparameterTuningJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.cancelHyperparameterTuningJob( request, @@ -1283,9 +1267,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.BatchPredictionJob() ); - client.innerApiCalls.createBatchPredictionJob = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.createBatchPredictionJob = + stubSimpleCall(expectedResponse); const [response] = await client.createBatchPredictionJob(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1316,9 +1299,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.BatchPredictionJob() ); - client.innerApiCalls.createBatchPredictionJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createBatchPredictionJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createBatchPredictionJob( request, @@ -1400,9 +1382,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.BatchPredictionJob() ); - client.innerApiCalls.getBatchPredictionJob = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.getBatchPredictionJob = + stubSimpleCall(expectedResponse); const [response] = await client.getBatchPredictionJob(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1433,9 +1414,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.BatchPredictionJob() ); - client.innerApiCalls.getBatchPredictionJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getBatchPredictionJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getBatchPredictionJob( request, @@ -1517,9 +1497,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.cancelBatchPredictionJob = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.cancelBatchPredictionJob = + stubSimpleCall(expectedResponse); const [response] = await client.cancelBatchPredictionJob(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1550,9 +1529,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.cancelBatchPredictionJob = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.cancelBatchPredictionJob = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.cancelBatchPredictionJob( request, @@ -1634,9 +1612,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteCustomJob = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteCustomJob = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteCustomJob(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -1668,9 +1645,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteCustomJob = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteCustomJob = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteCustomJob( request, @@ -1830,9 +1806,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteDataLabelingJob = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteDataLabelingJob = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteDataLabelingJob(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -1864,9 +1839,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteDataLabelingJob = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteDataLabelingJob = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteDataLabelingJob( request, @@ -2029,9 +2003,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteHyperparameterTuningJob = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteHyperparameterTuningJob = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteHyperparameterTuningJob(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -2063,9 +2036,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteHyperparameterTuningJob = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteHyperparameterTuningJob = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteHyperparameterTuningJob( request, @@ -2178,9 +2150,10 @@ describe('v1beta1.JobServiceClient', () => { expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteHyperparameterTuningJobProgress( - expectedResponse.name - ); + const decodedOperation = + await client.checkDeleteHyperparameterTuningJobProgress( + expectedResponse.name + ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); assert(decodedOperation.metadata); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); @@ -2228,9 +2201,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteBatchPredictionJob = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteBatchPredictionJob = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteBatchPredictionJob(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -2262,9 +2234,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteBatchPredictionJob = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteBatchPredictionJob = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteBatchPredictionJob( request, @@ -2377,9 +2348,10 @@ describe('v1beta1.JobServiceClient', () => { expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteBatchPredictionJobProgress( - expectedResponse.name - ); + const decodedOperation = + await client.checkDeleteBatchPredictionJobProgress( + expectedResponse.name + ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); assert(decodedOperation.metadata); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); @@ -2474,9 +2446,8 @@ describe('v1beta1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.CustomJob() ), ]; - client.innerApiCalls.listCustomJobs = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listCustomJobs = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listCustomJobs( request, @@ -2554,12 +2525,12 @@ describe('v1beta1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.CustomJob() ), ]; - client.descriptors.page.listCustomJobs.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listCustomJobs.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listCustomJobsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.CustomJob[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.CustomJob[] = + []; stream.on( 'data', (response: protos.google.cloud.aiplatform.v1beta1.CustomJob) => { @@ -2581,10 +2552,9 @@ describe('v1beta1.JobServiceClient', () => { .calledWith(client.innerApiCalls.listCustomJobs, request) ); assert.strictEqual( - (client.descriptors.page.listCustomJobs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCustomJobs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2601,13 +2571,12 @@ describe('v1beta1.JobServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listCustomJobs.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listCustomJobs.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listCustomJobsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.CustomJob[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.CustomJob[] = + []; stream.on( 'data', (response: protos.google.cloud.aiplatform.v1beta1.CustomJob) => { @@ -2628,10 +2597,9 @@ describe('v1beta1.JobServiceClient', () => { .calledWith(client.innerApiCalls.listCustomJobs, request) ); assert.strictEqual( - (client.descriptors.page.listCustomJobs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCustomJobs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2658,9 +2626,8 @@ describe('v1beta1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.CustomJob() ), ]; - client.descriptors.page.listCustomJobs.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listCustomJobs.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.aiplatform.v1beta1.ICustomJob[] = []; const iterable = client.listCustomJobsAsync(request); for await (const resource of iterable) { @@ -2668,15 +2635,15 @@ describe('v1beta1.JobServiceClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listCustomJobs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listCustomJobs.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listCustomJobs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCustomJobs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2693,27 +2660,26 @@ describe('v1beta1.JobServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listCustomJobs.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listCustomJobs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listCustomJobsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1beta1.ICustomJob[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.ICustomJob[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listCustomJobs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listCustomJobs.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listCustomJobs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCustomJobs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2749,9 +2715,8 @@ describe('v1beta1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.DataLabelingJob() ), ]; - client.innerApiCalls.listDataLabelingJobs = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listDataLabelingJobs = + stubSimpleCall(expectedResponse); const [response] = await client.listDataLabelingJobs(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -2790,9 +2755,8 @@ describe('v1beta1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.DataLabelingJob() ), ]; - client.innerApiCalls.listDataLabelingJobs = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listDataLabelingJobs = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listDataLabelingJobs( request, @@ -2872,12 +2836,12 @@ describe('v1beta1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.DataLabelingJob() ), ]; - client.descriptors.page.listDataLabelingJobs.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listDataLabelingJobs.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listDataLabelingJobsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.DataLabelingJob[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.DataLabelingJob[] = + []; stream.on( 'data', ( @@ -2901,10 +2865,9 @@ describe('v1beta1.JobServiceClient', () => { .calledWith(client.innerApiCalls.listDataLabelingJobs, request) ); assert.strictEqual( - (client.descriptors.page.listDataLabelingJobs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDataLabelingJobs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2921,13 +2884,12 @@ describe('v1beta1.JobServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listDataLabelingJobs.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listDataLabelingJobs.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listDataLabelingJobsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.DataLabelingJob[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.DataLabelingJob[] = + []; stream.on( 'data', ( @@ -2950,10 +2912,9 @@ describe('v1beta1.JobServiceClient', () => { .calledWith(client.innerApiCalls.listDataLabelingJobs, request) ); assert.strictEqual( - (client.descriptors.page.listDataLabelingJobs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDataLabelingJobs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2980,25 +2941,25 @@ describe('v1beta1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.DataLabelingJob() ), ]; - client.descriptors.page.listDataLabelingJobs.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.aiplatform.v1beta1.IDataLabelingJob[] = []; + client.descriptors.page.listDataLabelingJobs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.aiplatform.v1beta1.IDataLabelingJob[] = + []; const iterable = client.listDataLabelingJobsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listDataLabelingJobs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listDataLabelingJobs.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listDataLabelingJobs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDataLabelingJobs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3015,27 +2976,26 @@ describe('v1beta1.JobServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listDataLabelingJobs.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listDataLabelingJobs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listDataLabelingJobsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1beta1.IDataLabelingJob[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.IDataLabelingJob[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listDataLabelingJobs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listDataLabelingJobs.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listDataLabelingJobs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDataLabelingJobs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3071,9 +3031,8 @@ describe('v1beta1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob() ), ]; - client.innerApiCalls.listHyperparameterTuningJobs = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listHyperparameterTuningJobs = + stubSimpleCall(expectedResponse); const [response] = await client.listHyperparameterTuningJobs(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -3112,9 +3071,8 @@ describe('v1beta1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob() ), ]; - client.innerApiCalls.listHyperparameterTuningJobs = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listHyperparameterTuningJobs = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listHyperparameterTuningJobs( request, @@ -3197,12 +3155,12 @@ describe('v1beta1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob() ), ]; - client.descriptors.page.listHyperparameterTuningJobs.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listHyperparameterTuningJobs.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listHyperparameterTuningJobsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob[] = + []; stream.on( 'data', ( @@ -3221,8 +3179,10 @@ describe('v1beta1.JobServiceClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.listHyperparameterTuningJobs - .createStream as SinonStub) + ( + client.descriptors.page.listHyperparameterTuningJobs + .createStream as SinonStub + ) .getCall(0) .calledWith( client.innerApiCalls.listHyperparameterTuningJobs, @@ -3230,10 +3190,10 @@ describe('v1beta1.JobServiceClient', () => { ) ); assert.strictEqual( - (client.descriptors.page.listHyperparameterTuningJobs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listHyperparameterTuningJobs + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3250,13 +3210,12 @@ describe('v1beta1.JobServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listHyperparameterTuningJobs.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listHyperparameterTuningJobs.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listHyperparameterTuningJobsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob[] = + []; stream.on( 'data', ( @@ -3274,8 +3233,10 @@ describe('v1beta1.JobServiceClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listHyperparameterTuningJobs - .createStream as SinonStub) + ( + client.descriptors.page.listHyperparameterTuningJobs + .createStream as SinonStub + ) .getCall(0) .calledWith( client.innerApiCalls.listHyperparameterTuningJobs, @@ -3283,10 +3244,10 @@ describe('v1beta1.JobServiceClient', () => { ) ); assert.strictEqual( - (client.descriptors.page.listHyperparameterTuningJobs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listHyperparameterTuningJobs + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3313,25 +3274,27 @@ describe('v1beta1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.HyperparameterTuningJob() ), ]; - client.descriptors.page.listHyperparameterTuningJobs.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.aiplatform.v1beta1.IHyperparameterTuningJob[] = []; + client.descriptors.page.listHyperparameterTuningJobs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.aiplatform.v1beta1.IHyperparameterTuningJob[] = + []; const iterable = client.listHyperparameterTuningJobsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listHyperparameterTuningJobs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listHyperparameterTuningJobs + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listHyperparameterTuningJobs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listHyperparameterTuningJobs + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3348,27 +3311,28 @@ describe('v1beta1.JobServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listHyperparameterTuningJobs.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listHyperparameterTuningJobs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listHyperparameterTuningJobsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1beta1.IHyperparameterTuningJob[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.IHyperparameterTuningJob[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listHyperparameterTuningJobs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listHyperparameterTuningJobs + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listHyperparameterTuningJobs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listHyperparameterTuningJobs + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3404,9 +3368,8 @@ describe('v1beta1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.BatchPredictionJob() ), ]; - client.innerApiCalls.listBatchPredictionJobs = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listBatchPredictionJobs = + stubSimpleCall(expectedResponse); const [response] = await client.listBatchPredictionJobs(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -3445,9 +3408,8 @@ describe('v1beta1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.BatchPredictionJob() ), ]; - client.innerApiCalls.listBatchPredictionJobs = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listBatchPredictionJobs = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listBatchPredictionJobs( request, @@ -3530,12 +3492,12 @@ describe('v1beta1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.BatchPredictionJob() ), ]; - client.descriptors.page.listBatchPredictionJobs.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listBatchPredictionJobs.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listBatchPredictionJobsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.BatchPredictionJob[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.BatchPredictionJob[] = + []; stream.on( 'data', ( @@ -3554,16 +3516,18 @@ describe('v1beta1.JobServiceClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.listBatchPredictionJobs - .createStream as SinonStub) + ( + client.descriptors.page.listBatchPredictionJobs + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.listBatchPredictionJobs, request) ); assert.strictEqual( - (client.descriptors.page.listBatchPredictionJobs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listBatchPredictionJobs + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3580,13 +3544,12 @@ describe('v1beta1.JobServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listBatchPredictionJobs.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listBatchPredictionJobs.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listBatchPredictionJobsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.BatchPredictionJob[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.BatchPredictionJob[] = + []; stream.on( 'data', ( @@ -3604,16 +3567,18 @@ describe('v1beta1.JobServiceClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listBatchPredictionJobs - .createStream as SinonStub) + ( + client.descriptors.page.listBatchPredictionJobs + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.listBatchPredictionJobs, request) ); assert.strictEqual( - (client.descriptors.page.listBatchPredictionJobs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listBatchPredictionJobs + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3640,25 +3605,27 @@ describe('v1beta1.JobServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.BatchPredictionJob() ), ]; - client.descriptors.page.listBatchPredictionJobs.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.aiplatform.v1beta1.IBatchPredictionJob[] = []; + client.descriptors.page.listBatchPredictionJobs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.aiplatform.v1beta1.IBatchPredictionJob[] = + []; const iterable = client.listBatchPredictionJobsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listBatchPredictionJobs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listBatchPredictionJobs + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listBatchPredictionJobs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listBatchPredictionJobs + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3675,27 +3642,28 @@ describe('v1beta1.JobServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listBatchPredictionJobs.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listBatchPredictionJobs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listBatchPredictionJobsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1beta1.IBatchPredictionJob[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.IBatchPredictionJob[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listBatchPredictionJobs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listBatchPredictionJobs + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listBatchPredictionJobs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listBatchPredictionJobs + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -3856,9 +3824,8 @@ describe('v1beta1.JobServiceClient', () => { }); it('matchAnnotationSpecFromAnnotationSpecName', () => { - const result = client.matchAnnotationSpecFromAnnotationSpecName( - fakePath - ); + const result = + client.matchAnnotationSpecFromAnnotationSpecName(fakePath); assert.strictEqual(result, 'annotationSpecValue'); assert( (client.pathTemplates.annotationSpecPathTemplate.match as SinonStub) @@ -3895,8 +3862,10 @@ describe('v1beta1.JobServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -3906,8 +3875,10 @@ describe('v1beta1.JobServiceClient', () => { const result = client.matchProjectFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3917,21 +3888,24 @@ describe('v1beta1.JobServiceClient', () => { const result = client.matchLocationFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchBatchPredictionJobFromBatchPredictionJobName', () => { - const result = client.matchBatchPredictionJobFromBatchPredictionJobName( - fakePath - ); + const result = + client.matchBatchPredictionJobFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'batchPredictionJobValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -4132,9 +4106,8 @@ describe('v1beta1.JobServiceClient', () => { }); it('matchDataLabelingJobFromDataLabelingJobName', () => { - const result = client.matchDataLabelingJobFromDataLabelingJobName( - fakePath - ); + const result = + client.matchDataLabelingJobFromDataLabelingJobName(fakePath); assert.strictEqual(result, 'dataLabelingJobValue'); assert( (client.pathTemplates.dataLabelingJobPathTemplate.match as SinonStub) @@ -4299,47 +4272,54 @@ describe('v1beta1.JobServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromHyperparameterTuningJobName', () => { - const result = client.matchProjectFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchProjectFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromHyperparameterTuningJobName', () => { - const result = client.matchLocationFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchLocationFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchHyperparameterTuningJobFromHyperparameterTuningJobName', () => { - const result = client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( + fakePath + ); assert.strictEqual(result, 'hyperparameterTuningJobValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -4566,34 +4546,38 @@ describe('v1beta1.JobServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .render as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromModelEvaluationSliceName', () => { - const result = client.matchProjectFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchProjectFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromModelEvaluationSliceName', () => { - const result = client.matchLocationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchLocationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -4603,21 +4587,24 @@ describe('v1beta1.JobServiceClient', () => { const result = client.matchModelFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'modelValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchEvaluationFromModelEvaluationSliceName', () => { - const result = client.matchEvaluationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchEvaluationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'evaluationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -4627,8 +4614,10 @@ describe('v1beta1.JobServiceClient', () => { const result = client.matchSliceFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'sliceValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -4689,9 +4678,8 @@ describe('v1beta1.JobServiceClient', () => { }); it('matchSpecialistPoolFromSpecialistPoolName', () => { - const result = client.matchSpecialistPoolFromSpecialistPoolName( - fakePath - ); + const result = + client.matchSpecialistPoolFromSpecialistPoolName(fakePath); assert.strictEqual(result, 'specialistPoolValue'); assert( (client.pathTemplates.specialistPoolPathTemplate.match as SinonStub) @@ -4792,8 +4780,10 @@ describe('v1beta1.JobServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.trainingPipelinePathTemplate - .render as SinonStub) + ( + client.pathTemplates.trainingPipelinePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -4820,9 +4810,8 @@ describe('v1beta1.JobServiceClient', () => { }); it('matchTrainingPipelineFromTrainingPipelineName', () => { - const result = client.matchTrainingPipelineFromTrainingPipelineName( - fakePath - ); + const result = + client.matchTrainingPipelineFromTrainingPipelineName(fakePath); assert.strictEqual(result, 'trainingPipelineValue'); assert( (client.pathTemplates.trainingPipelinePathTemplate.match as SinonStub) diff --git a/packages/google-cloud-aiplatform/test/gapic_migration_service_v1.ts b/packages/google-cloud-aiplatform/test/gapic_migration_service_v1.ts index b7f382146d6..8375cdf1f0e 100644 --- a/packages/google-cloud-aiplatform/test/gapic_migration_service_v1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_migration_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; @@ -250,9 +249,8 @@ describe('v1.MigrationServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.batchMigrateResources = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.batchMigrateResources = + stubLongRunningCall(expectedResponse); const [operation] = await client.batchMigrateResources(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -284,9 +282,8 @@ describe('v1.MigrationServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.batchMigrateResources = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.batchMigrateResources = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.batchMigrateResources( request, @@ -457,9 +454,8 @@ describe('v1.MigrationServiceClient', () => { new protos.google.cloud.aiplatform.v1.MigratableResource() ), ]; - client.innerApiCalls.searchMigratableResources = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.searchMigratableResources = + stubSimpleCall(expectedResponse); const [response] = await client.searchMigratableResources(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -498,9 +494,8 @@ describe('v1.MigrationServiceClient', () => { new protos.google.cloud.aiplatform.v1.MigratableResource() ), ]; - client.innerApiCalls.searchMigratableResources = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.searchMigratableResources = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.searchMigratableResources( request, @@ -583,12 +578,12 @@ describe('v1.MigrationServiceClient', () => { new protos.google.cloud.aiplatform.v1.MigratableResource() ), ]; - client.descriptors.page.searchMigratableResources.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.searchMigratableResources.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.searchMigratableResourcesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1.MigratableResource[] = []; + const responses: protos.google.cloud.aiplatform.v1.MigratableResource[] = + []; stream.on( 'data', (response: protos.google.cloud.aiplatform.v1.MigratableResource) => { @@ -605,16 +600,18 @@ describe('v1.MigrationServiceClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.searchMigratableResources - .createStream as SinonStub) + ( + client.descriptors.page.searchMigratableResources + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.searchMigratableResources, request) ); assert.strictEqual( - (client.descriptors.page.searchMigratableResources - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchMigratableResources + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -631,13 +628,12 @@ describe('v1.MigrationServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.searchMigratableResources.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.searchMigratableResources.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.searchMigratableResourcesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1.MigratableResource[] = []; + const responses: protos.google.cloud.aiplatform.v1.MigratableResource[] = + []; stream.on( 'data', (response: protos.google.cloud.aiplatform.v1.MigratableResource) => { @@ -653,16 +649,18 @@ describe('v1.MigrationServiceClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.searchMigratableResources - .createStream as SinonStub) + ( + client.descriptors.page.searchMigratableResources + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.searchMigratableResources, request) ); assert.strictEqual( - (client.descriptors.page.searchMigratableResources - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchMigratableResources + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -689,25 +687,27 @@ describe('v1.MigrationServiceClient', () => { new protos.google.cloud.aiplatform.v1.MigratableResource() ), ]; - client.descriptors.page.searchMigratableResources.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.aiplatform.v1.IMigratableResource[] = []; + client.descriptors.page.searchMigratableResources.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.aiplatform.v1.IMigratableResource[] = + []; const iterable = client.searchMigratableResourcesAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.searchMigratableResources - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.searchMigratableResources + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.searchMigratableResources - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchMigratableResources + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -724,27 +724,28 @@ describe('v1.MigrationServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.searchMigratableResources.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.searchMigratableResources.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.searchMigratableResourcesAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1.IMigratableResource[] = []; + const responses: protos.google.cloud.aiplatform.v1.IMigratableResource[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.searchMigratableResources - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.searchMigratableResources + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.searchMigratableResources - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchMigratableResources + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -905,9 +906,8 @@ describe('v1.MigrationServiceClient', () => { }); it('matchAnnotationSpecFromAnnotationSpecName', () => { - const result = client.matchAnnotationSpecFromAnnotationSpecName( - fakePath - ); + const result = + client.matchAnnotationSpecFromAnnotationSpecName(fakePath); assert.strictEqual(result, 'annotationSpecValue'); assert( (client.pathTemplates.annotationSpecPathTemplate.match as SinonStub) @@ -944,8 +944,10 @@ describe('v1.MigrationServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -955,8 +957,10 @@ describe('v1.MigrationServiceClient', () => { const result = client.matchProjectFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -966,21 +970,24 @@ describe('v1.MigrationServiceClient', () => { const result = client.matchLocationFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchBatchPredictionJobFromBatchPredictionJobName', () => { - const result = client.matchBatchPredictionJobFromBatchPredictionJobName( - fakePath - ); + const result = + client.matchBatchPredictionJobFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'batchPredictionJobValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1181,9 +1188,8 @@ describe('v1.MigrationServiceClient', () => { }); it('matchDataLabelingJobFromDataLabelingJobName', () => { - const result = client.matchDataLabelingJobFromDataLabelingJobName( - fakePath - ); + const result = + client.matchDataLabelingJobFromDataLabelingJobName(fakePath); assert.strictEqual(result, 'dataLabelingJobValue'); assert( (client.pathTemplates.dataLabelingJobPathTemplate.match as SinonStub) @@ -1348,47 +1354,54 @@ describe('v1.MigrationServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromHyperparameterTuningJobName', () => { - const result = client.matchProjectFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchProjectFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromHyperparameterTuningJobName', () => { - const result = client.matchLocationFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchLocationFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchHyperparameterTuningJobFromHyperparameterTuningJobName', () => { - const result = client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( + fakePath + ); assert.strictEqual(result, 'hyperparameterTuningJobValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1615,34 +1628,38 @@ describe('v1.MigrationServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .render as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromModelEvaluationSliceName', () => { - const result = client.matchProjectFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchProjectFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromModelEvaluationSliceName', () => { - const result = client.matchLocationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchLocationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1652,21 +1669,24 @@ describe('v1.MigrationServiceClient', () => { const result = client.matchModelFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'modelValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchEvaluationFromModelEvaluationSliceName', () => { - const result = client.matchEvaluationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchEvaluationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'evaluationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1676,8 +1696,10 @@ describe('v1.MigrationServiceClient', () => { const result = client.matchSliceFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'sliceValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1738,9 +1760,8 @@ describe('v1.MigrationServiceClient', () => { }); it('matchSpecialistPoolFromSpecialistPoolName', () => { - const result = client.matchSpecialistPoolFromSpecialistPoolName( - fakePath - ); + const result = + client.matchSpecialistPoolFromSpecialistPoolName(fakePath); assert.strictEqual(result, 'specialistPoolValue'); assert( (client.pathTemplates.specialistPoolPathTemplate.match as SinonStub) @@ -1777,8 +1798,10 @@ describe('v1.MigrationServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.trainingPipelinePathTemplate - .render as SinonStub) + ( + client.pathTemplates.trainingPipelinePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -1805,9 +1828,8 @@ describe('v1.MigrationServiceClient', () => { }); it('matchTrainingPipelineFromTrainingPipelineName', () => { - const result = client.matchTrainingPipelineFromTrainingPipelineName( - fakePath - ); + const result = + client.matchTrainingPipelineFromTrainingPipelineName(fakePath); assert.strictEqual(result, 'trainingPipelineValue'); assert( (client.pathTemplates.trainingPipelinePathTemplate.match as SinonStub) diff --git a/packages/google-cloud-aiplatform/test/gapic_migration_service_v1beta1.ts b/packages/google-cloud-aiplatform/test/gapic_migration_service_v1beta1.ts index 689d3ca3e44..9088c6b9d91 100644 --- a/packages/google-cloud-aiplatform/test/gapic_migration_service_v1beta1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_migration_service_v1beta1.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; @@ -250,9 +249,8 @@ describe('v1beta1.MigrationServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.batchMigrateResources = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.batchMigrateResources = + stubLongRunningCall(expectedResponse); const [operation] = await client.batchMigrateResources(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -284,9 +282,8 @@ describe('v1beta1.MigrationServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.batchMigrateResources = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.batchMigrateResources = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.batchMigrateResources( request, @@ -457,9 +454,8 @@ describe('v1beta1.MigrationServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.MigratableResource() ), ]; - client.innerApiCalls.searchMigratableResources = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.searchMigratableResources = + stubSimpleCall(expectedResponse); const [response] = await client.searchMigratableResources(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -498,9 +494,8 @@ describe('v1beta1.MigrationServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.MigratableResource() ), ]; - client.innerApiCalls.searchMigratableResources = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.searchMigratableResources = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.searchMigratableResources( request, @@ -583,12 +578,12 @@ describe('v1beta1.MigrationServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.MigratableResource() ), ]; - client.descriptors.page.searchMigratableResources.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.searchMigratableResources.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.searchMigratableResourcesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.MigratableResource[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.MigratableResource[] = + []; stream.on( 'data', ( @@ -607,16 +602,18 @@ describe('v1beta1.MigrationServiceClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.searchMigratableResources - .createStream as SinonStub) + ( + client.descriptors.page.searchMigratableResources + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.searchMigratableResources, request) ); assert.strictEqual( - (client.descriptors.page.searchMigratableResources - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchMigratableResources + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -633,13 +630,12 @@ describe('v1beta1.MigrationServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.searchMigratableResources.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.searchMigratableResources.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.searchMigratableResourcesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.MigratableResource[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.MigratableResource[] = + []; stream.on( 'data', ( @@ -657,16 +653,18 @@ describe('v1beta1.MigrationServiceClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.searchMigratableResources - .createStream as SinonStub) + ( + client.descriptors.page.searchMigratableResources + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.searchMigratableResources, request) ); assert.strictEqual( - (client.descriptors.page.searchMigratableResources - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchMigratableResources + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -693,25 +691,27 @@ describe('v1beta1.MigrationServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.MigratableResource() ), ]; - client.descriptors.page.searchMigratableResources.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.aiplatform.v1beta1.IMigratableResource[] = []; + client.descriptors.page.searchMigratableResources.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.aiplatform.v1beta1.IMigratableResource[] = + []; const iterable = client.searchMigratableResourcesAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.searchMigratableResources - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.searchMigratableResources + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.searchMigratableResources - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchMigratableResources + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -728,27 +728,28 @@ describe('v1beta1.MigrationServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.searchMigratableResources.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.searchMigratableResources.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.searchMigratableResourcesAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1beta1.IMigratableResource[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.IMigratableResource[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.searchMigratableResources - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.searchMigratableResources + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.searchMigratableResources - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.searchMigratableResources + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -909,9 +910,8 @@ describe('v1beta1.MigrationServiceClient', () => { }); it('matchAnnotationSpecFromAnnotationSpecName', () => { - const result = client.matchAnnotationSpecFromAnnotationSpecName( - fakePath - ); + const result = + client.matchAnnotationSpecFromAnnotationSpecName(fakePath); assert.strictEqual(result, 'annotationSpecValue'); assert( (client.pathTemplates.annotationSpecPathTemplate.match as SinonStub) @@ -948,8 +948,10 @@ describe('v1beta1.MigrationServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -959,8 +961,10 @@ describe('v1beta1.MigrationServiceClient', () => { const result = client.matchProjectFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -970,21 +974,24 @@ describe('v1beta1.MigrationServiceClient', () => { const result = client.matchLocationFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchBatchPredictionJobFromBatchPredictionJobName', () => { - const result = client.matchBatchPredictionJobFromBatchPredictionJobName( - fakePath - ); + const result = + client.matchBatchPredictionJobFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'batchPredictionJobValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1185,9 +1192,8 @@ describe('v1beta1.MigrationServiceClient', () => { }); it('matchDataLabelingJobFromDataLabelingJobName', () => { - const result = client.matchDataLabelingJobFromDataLabelingJobName( - fakePath - ); + const result = + client.matchDataLabelingJobFromDataLabelingJobName(fakePath); assert.strictEqual(result, 'dataLabelingJobValue'); assert( (client.pathTemplates.dataLabelingJobPathTemplate.match as SinonStub) @@ -1352,47 +1358,54 @@ describe('v1beta1.MigrationServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromHyperparameterTuningJobName', () => { - const result = client.matchProjectFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchProjectFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromHyperparameterTuningJobName', () => { - const result = client.matchLocationFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchLocationFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchHyperparameterTuningJobFromHyperparameterTuningJobName', () => { - const result = client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( + fakePath + ); assert.strictEqual(result, 'hyperparameterTuningJobValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1619,34 +1632,38 @@ describe('v1beta1.MigrationServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .render as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromModelEvaluationSliceName', () => { - const result = client.matchProjectFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchProjectFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromModelEvaluationSliceName', () => { - const result = client.matchLocationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchLocationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1656,21 +1673,24 @@ describe('v1beta1.MigrationServiceClient', () => { const result = client.matchModelFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'modelValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchEvaluationFromModelEvaluationSliceName', () => { - const result = client.matchEvaluationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchEvaluationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'evaluationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1680,8 +1700,10 @@ describe('v1beta1.MigrationServiceClient', () => { const result = client.matchSliceFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'sliceValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1742,9 +1764,8 @@ describe('v1beta1.MigrationServiceClient', () => { }); it('matchSpecialistPoolFromSpecialistPoolName', () => { - const result = client.matchSpecialistPoolFromSpecialistPoolName( - fakePath - ); + const result = + client.matchSpecialistPoolFromSpecialistPoolName(fakePath); assert.strictEqual(result, 'specialistPoolValue'); assert( (client.pathTemplates.specialistPoolPathTemplate.match as SinonStub) @@ -1845,8 +1866,10 @@ describe('v1beta1.MigrationServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.trainingPipelinePathTemplate - .render as SinonStub) + ( + client.pathTemplates.trainingPipelinePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -1873,9 +1896,8 @@ describe('v1beta1.MigrationServiceClient', () => { }); it('matchTrainingPipelineFromTrainingPipelineName', () => { - const result = client.matchTrainingPipelineFromTrainingPipelineName( - fakePath - ); + const result = + client.matchTrainingPipelineFromTrainingPipelineName(fakePath); assert.strictEqual(result, 'trainingPipelineValue'); assert( (client.pathTemplates.trainingPipelinePathTemplate.match as SinonStub) diff --git a/packages/google-cloud-aiplatform/test/gapic_model_service_v1.ts b/packages/google-cloud-aiplatform/test/gapic_model_service_v1.ts index dcf471a8191..adb1333e605 100644 --- a/packages/google-cloud-aiplatform/test/gapic_model_service_v1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_model_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; @@ -279,9 +278,8 @@ describe('v1.ModelServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.Model() ); - client.innerApiCalls.getModel = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getModel = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getModel( request, @@ -390,9 +388,8 @@ describe('v1.ModelServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.Model() ); - client.innerApiCalls.updateModel = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateModel = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateModel( request, @@ -472,9 +469,8 @@ describe('v1.ModelServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.ModelEvaluation() ); - client.innerApiCalls.getModelEvaluation = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.getModelEvaluation = + stubSimpleCall(expectedResponse); const [response] = await client.getModelEvaluation(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -505,9 +501,8 @@ describe('v1.ModelServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.ModelEvaluation() ); - client.innerApiCalls.getModelEvaluation = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getModelEvaluation = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getModelEvaluation( request, @@ -586,9 +581,8 @@ describe('v1.ModelServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.ModelEvaluationSlice() ); - client.innerApiCalls.getModelEvaluationSlice = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.getModelEvaluationSlice = + stubSimpleCall(expectedResponse); const [response] = await client.getModelEvaluationSlice(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -619,9 +613,8 @@ describe('v1.ModelServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.ModelEvaluationSlice() ); - client.innerApiCalls.getModelEvaluationSlice = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getModelEvaluationSlice = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getModelEvaluationSlice( request, @@ -735,9 +728,8 @@ describe('v1.ModelServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.uploadModel = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.uploadModel = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.uploadModel( request, @@ -926,9 +918,8 @@ describe('v1.ModelServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteModel = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteModel = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteModel( request, @@ -1117,9 +1108,8 @@ describe('v1.ModelServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.exportModel = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.exportModel = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.exportModel( request, @@ -1311,9 +1301,8 @@ describe('v1.ModelServiceClient', () => { generateSampleMessage(new protos.google.cloud.aiplatform.v1.Model()), generateSampleMessage(new protos.google.cloud.aiplatform.v1.Model()), ]; - client.innerApiCalls.listModels = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listModels = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listModels( request, @@ -1385,9 +1374,8 @@ describe('v1.ModelServiceClient', () => { generateSampleMessage(new protos.google.cloud.aiplatform.v1.Model()), generateSampleMessage(new protos.google.cloud.aiplatform.v1.Model()), ]; - client.descriptors.page.listModels.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listModels.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listModelsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.aiplatform.v1.Model[] = []; @@ -1481,9 +1469,8 @@ describe('v1.ModelServiceClient', () => { generateSampleMessage(new protos.google.cloud.aiplatform.v1.Model()), generateSampleMessage(new protos.google.cloud.aiplatform.v1.Model()), ]; - client.descriptors.page.listModels.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listModels.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.aiplatform.v1.IModel[] = []; const iterable = client.listModelsAsync(request); for await (const resource of iterable) { @@ -1572,9 +1559,8 @@ describe('v1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1.ModelEvaluation() ), ]; - client.innerApiCalls.listModelEvaluations = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listModelEvaluations = + stubSimpleCall(expectedResponse); const [response] = await client.listModelEvaluations(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1613,9 +1599,8 @@ describe('v1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1.ModelEvaluation() ), ]; - client.innerApiCalls.listModelEvaluations = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listModelEvaluations = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listModelEvaluations( request, @@ -1693,12 +1678,12 @@ describe('v1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1.ModelEvaluation() ), ]; - client.descriptors.page.listModelEvaluations.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listModelEvaluations.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listModelEvaluationsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1.ModelEvaluation[] = []; + const responses: protos.google.cloud.aiplatform.v1.ModelEvaluation[] = + []; stream.on( 'data', (response: protos.google.cloud.aiplatform.v1.ModelEvaluation) => { @@ -1720,10 +1705,9 @@ describe('v1.ModelServiceClient', () => { .calledWith(client.innerApiCalls.listModelEvaluations, request) ); assert.strictEqual( - (client.descriptors.page.listModelEvaluations - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listModelEvaluations.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1740,13 +1724,12 @@ describe('v1.ModelServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listModelEvaluations.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listModelEvaluations.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listModelEvaluationsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1.ModelEvaluation[] = []; + const responses: protos.google.cloud.aiplatform.v1.ModelEvaluation[] = + []; stream.on( 'data', (response: protos.google.cloud.aiplatform.v1.ModelEvaluation) => { @@ -1767,10 +1750,9 @@ describe('v1.ModelServiceClient', () => { .calledWith(client.innerApiCalls.listModelEvaluations, request) ); assert.strictEqual( - (client.descriptors.page.listModelEvaluations - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listModelEvaluations.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1797,25 +1779,25 @@ describe('v1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1.ModelEvaluation() ), ]; - client.descriptors.page.listModelEvaluations.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.aiplatform.v1.IModelEvaluation[] = []; + client.descriptors.page.listModelEvaluations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.aiplatform.v1.IModelEvaluation[] = + []; const iterable = client.listModelEvaluationsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listModelEvaluations - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listModelEvaluations.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listModelEvaluations - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listModelEvaluations.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1832,27 +1814,26 @@ describe('v1.ModelServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listModelEvaluations.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listModelEvaluations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listModelEvaluationsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1.IModelEvaluation[] = []; + const responses: protos.google.cloud.aiplatform.v1.IModelEvaluation[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listModelEvaluations - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listModelEvaluations.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listModelEvaluations - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listModelEvaluations.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1888,9 +1869,8 @@ describe('v1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1.ModelEvaluationSlice() ), ]; - client.innerApiCalls.listModelEvaluationSlices = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listModelEvaluationSlices = + stubSimpleCall(expectedResponse); const [response] = await client.listModelEvaluationSlices(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1929,9 +1909,8 @@ describe('v1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1.ModelEvaluationSlice() ), ]; - client.innerApiCalls.listModelEvaluationSlices = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listModelEvaluationSlices = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listModelEvaluationSlices( request, @@ -2014,12 +1993,12 @@ describe('v1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1.ModelEvaluationSlice() ), ]; - client.descriptors.page.listModelEvaluationSlices.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listModelEvaluationSlices.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listModelEvaluationSlicesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1.ModelEvaluationSlice[] = []; + const responses: protos.google.cloud.aiplatform.v1.ModelEvaluationSlice[] = + []; stream.on( 'data', ( @@ -2038,16 +2017,18 @@ describe('v1.ModelServiceClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.listModelEvaluationSlices - .createStream as SinonStub) + ( + client.descriptors.page.listModelEvaluationSlices + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.listModelEvaluationSlices, request) ); assert.strictEqual( - (client.descriptors.page.listModelEvaluationSlices - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listModelEvaluationSlices + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2064,13 +2045,12 @@ describe('v1.ModelServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listModelEvaluationSlices.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listModelEvaluationSlices.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listModelEvaluationSlicesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1.ModelEvaluationSlice[] = []; + const responses: protos.google.cloud.aiplatform.v1.ModelEvaluationSlice[] = + []; stream.on( 'data', ( @@ -2088,16 +2068,18 @@ describe('v1.ModelServiceClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listModelEvaluationSlices - .createStream as SinonStub) + ( + client.descriptors.page.listModelEvaluationSlices + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.listModelEvaluationSlices, request) ); assert.strictEqual( - (client.descriptors.page.listModelEvaluationSlices - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listModelEvaluationSlices + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2124,25 +2106,27 @@ describe('v1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1.ModelEvaluationSlice() ), ]; - client.descriptors.page.listModelEvaluationSlices.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.aiplatform.v1.IModelEvaluationSlice[] = []; + client.descriptors.page.listModelEvaluationSlices.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.aiplatform.v1.IModelEvaluationSlice[] = + []; const iterable = client.listModelEvaluationSlicesAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listModelEvaluationSlices - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listModelEvaluationSlices + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listModelEvaluationSlices - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listModelEvaluationSlices + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2159,27 +2143,28 @@ describe('v1.ModelServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listModelEvaluationSlices.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listModelEvaluationSlices.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listModelEvaluationSlicesAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1.IModelEvaluationSlice[] = []; + const responses: protos.google.cloud.aiplatform.v1.IModelEvaluationSlice[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listModelEvaluationSlices - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listModelEvaluationSlices + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listModelEvaluationSlices - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listModelEvaluationSlices + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2340,9 +2325,8 @@ describe('v1.ModelServiceClient', () => { }); it('matchAnnotationSpecFromAnnotationSpecName', () => { - const result = client.matchAnnotationSpecFromAnnotationSpecName( - fakePath - ); + const result = + client.matchAnnotationSpecFromAnnotationSpecName(fakePath); assert.strictEqual(result, 'annotationSpecValue'); assert( (client.pathTemplates.annotationSpecPathTemplate.match as SinonStub) @@ -2379,8 +2363,10 @@ describe('v1.ModelServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -2390,8 +2376,10 @@ describe('v1.ModelServiceClient', () => { const result = client.matchProjectFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2401,21 +2389,24 @@ describe('v1.ModelServiceClient', () => { const result = client.matchLocationFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchBatchPredictionJobFromBatchPredictionJobName', () => { - const result = client.matchBatchPredictionJobFromBatchPredictionJobName( - fakePath - ); + const result = + client.matchBatchPredictionJobFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'batchPredictionJobValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2616,9 +2607,8 @@ describe('v1.ModelServiceClient', () => { }); it('matchDataLabelingJobFromDataLabelingJobName', () => { - const result = client.matchDataLabelingJobFromDataLabelingJobName( - fakePath - ); + const result = + client.matchDataLabelingJobFromDataLabelingJobName(fakePath); assert.strictEqual(result, 'dataLabelingJobValue'); assert( (client.pathTemplates.dataLabelingJobPathTemplate.match as SinonStub) @@ -2783,47 +2773,54 @@ describe('v1.ModelServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromHyperparameterTuningJobName', () => { - const result = client.matchProjectFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchProjectFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromHyperparameterTuningJobName', () => { - const result = client.matchLocationFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchLocationFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchHyperparameterTuningJobFromHyperparameterTuningJobName', () => { - const result = client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( + fakePath + ); assert.strictEqual(result, 'hyperparameterTuningJobValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3050,34 +3047,38 @@ describe('v1.ModelServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .render as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromModelEvaluationSliceName', () => { - const result = client.matchProjectFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchProjectFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromModelEvaluationSliceName', () => { - const result = client.matchLocationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchLocationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3087,21 +3088,24 @@ describe('v1.ModelServiceClient', () => { const result = client.matchModelFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'modelValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchEvaluationFromModelEvaluationSliceName', () => { - const result = client.matchEvaluationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchEvaluationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'evaluationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3111,8 +3115,10 @@ describe('v1.ModelServiceClient', () => { const result = client.matchSliceFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'sliceValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3173,9 +3179,8 @@ describe('v1.ModelServiceClient', () => { }); it('matchSpecialistPoolFromSpecialistPoolName', () => { - const result = client.matchSpecialistPoolFromSpecialistPoolName( - fakePath - ); + const result = + client.matchSpecialistPoolFromSpecialistPoolName(fakePath); assert.strictEqual(result, 'specialistPoolValue'); assert( (client.pathTemplates.specialistPoolPathTemplate.match as SinonStub) @@ -3212,8 +3217,10 @@ describe('v1.ModelServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.trainingPipelinePathTemplate - .render as SinonStub) + ( + client.pathTemplates.trainingPipelinePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -3240,9 +3247,8 @@ describe('v1.ModelServiceClient', () => { }); it('matchTrainingPipelineFromTrainingPipelineName', () => { - const result = client.matchTrainingPipelineFromTrainingPipelineName( - fakePath - ); + const result = + client.matchTrainingPipelineFromTrainingPipelineName(fakePath); assert.strictEqual(result, 'trainingPipelineValue'); assert( (client.pathTemplates.trainingPipelinePathTemplate.match as SinonStub) diff --git a/packages/google-cloud-aiplatform/test/gapic_model_service_v1beta1.ts b/packages/google-cloud-aiplatform/test/gapic_model_service_v1beta1.ts index d5dcde2c57d..8d0283ff7bf 100644 --- a/packages/google-cloud-aiplatform/test/gapic_model_service_v1beta1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_model_service_v1beta1.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; @@ -281,9 +280,8 @@ describe('v1beta1.ModelServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.Model() ); - client.innerApiCalls.getModel = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getModel = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getModel( request, @@ -392,9 +390,8 @@ describe('v1beta1.ModelServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.Model() ); - client.innerApiCalls.updateModel = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateModel = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateModel( request, @@ -474,9 +471,8 @@ describe('v1beta1.ModelServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.ModelEvaluation() ); - client.innerApiCalls.getModelEvaluation = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.getModelEvaluation = + stubSimpleCall(expectedResponse); const [response] = await client.getModelEvaluation(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -507,9 +503,8 @@ describe('v1beta1.ModelServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.ModelEvaluation() ); - client.innerApiCalls.getModelEvaluation = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getModelEvaluation = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getModelEvaluation( request, @@ -588,9 +583,8 @@ describe('v1beta1.ModelServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice() ); - client.innerApiCalls.getModelEvaluationSlice = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.getModelEvaluationSlice = + stubSimpleCall(expectedResponse); const [response] = await client.getModelEvaluationSlice(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -621,9 +615,8 @@ describe('v1beta1.ModelServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice() ); - client.innerApiCalls.getModelEvaluationSlice = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getModelEvaluationSlice = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getModelEvaluationSlice( request, @@ -737,9 +730,8 @@ describe('v1beta1.ModelServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.uploadModel = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.uploadModel = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.uploadModel( request, @@ -928,9 +920,8 @@ describe('v1beta1.ModelServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteModel = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteModel = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteModel( request, @@ -1119,9 +1110,8 @@ describe('v1beta1.ModelServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.exportModel = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.exportModel = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.exportModel( request, @@ -1325,9 +1315,8 @@ describe('v1beta1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.Model() ), ]; - client.innerApiCalls.listModels = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listModels = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listModels( request, @@ -1405,9 +1394,8 @@ describe('v1beta1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.Model() ), ]; - client.descriptors.page.listModels.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listModels.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listModelsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.aiplatform.v1beta1.Model[] = []; @@ -1507,9 +1495,8 @@ describe('v1beta1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.Model() ), ]; - client.descriptors.page.listModels.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listModels.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.aiplatform.v1beta1.IModel[] = []; const iterable = client.listModelsAsync(request); for await (const resource of iterable) { @@ -1598,9 +1585,8 @@ describe('v1beta1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.ModelEvaluation() ), ]; - client.innerApiCalls.listModelEvaluations = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listModelEvaluations = + stubSimpleCall(expectedResponse); const [response] = await client.listModelEvaluations(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1639,9 +1625,8 @@ describe('v1beta1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.ModelEvaluation() ), ]; - client.innerApiCalls.listModelEvaluations = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listModelEvaluations = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listModelEvaluations( request, @@ -1721,12 +1706,12 @@ describe('v1beta1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.ModelEvaluation() ), ]; - client.descriptors.page.listModelEvaluations.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listModelEvaluations.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listModelEvaluationsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.ModelEvaluation[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.ModelEvaluation[] = + []; stream.on( 'data', ( @@ -1750,10 +1735,9 @@ describe('v1beta1.ModelServiceClient', () => { .calledWith(client.innerApiCalls.listModelEvaluations, request) ); assert.strictEqual( - (client.descriptors.page.listModelEvaluations - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listModelEvaluations.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1770,13 +1754,12 @@ describe('v1beta1.ModelServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listModelEvaluations.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listModelEvaluations.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listModelEvaluationsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.ModelEvaluation[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.ModelEvaluation[] = + []; stream.on( 'data', ( @@ -1799,10 +1782,9 @@ describe('v1beta1.ModelServiceClient', () => { .calledWith(client.innerApiCalls.listModelEvaluations, request) ); assert.strictEqual( - (client.descriptors.page.listModelEvaluations - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listModelEvaluations.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1829,25 +1811,25 @@ describe('v1beta1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.ModelEvaluation() ), ]; - client.descriptors.page.listModelEvaluations.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.aiplatform.v1beta1.IModelEvaluation[] = []; + client.descriptors.page.listModelEvaluations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.aiplatform.v1beta1.IModelEvaluation[] = + []; const iterable = client.listModelEvaluationsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listModelEvaluations - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listModelEvaluations.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listModelEvaluations - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listModelEvaluations.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1864,27 +1846,26 @@ describe('v1beta1.ModelServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listModelEvaluations.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listModelEvaluations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listModelEvaluationsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1beta1.IModelEvaluation[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.IModelEvaluation[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listModelEvaluations - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listModelEvaluations.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listModelEvaluations - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listModelEvaluations.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1920,9 +1901,8 @@ describe('v1beta1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice() ), ]; - client.innerApiCalls.listModelEvaluationSlices = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listModelEvaluationSlices = + stubSimpleCall(expectedResponse); const [response] = await client.listModelEvaluationSlices(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1961,9 +1941,8 @@ describe('v1beta1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice() ), ]; - client.innerApiCalls.listModelEvaluationSlices = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listModelEvaluationSlices = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listModelEvaluationSlices( request, @@ -2046,12 +2025,12 @@ describe('v1beta1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice() ), ]; - client.descriptors.page.listModelEvaluationSlices.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listModelEvaluationSlices.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listModelEvaluationSlicesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice[] = + []; stream.on( 'data', ( @@ -2070,16 +2049,18 @@ describe('v1beta1.ModelServiceClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.listModelEvaluationSlices - .createStream as SinonStub) + ( + client.descriptors.page.listModelEvaluationSlices + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.listModelEvaluationSlices, request) ); assert.strictEqual( - (client.descriptors.page.listModelEvaluationSlices - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listModelEvaluationSlices + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2096,13 +2077,12 @@ describe('v1beta1.ModelServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listModelEvaluationSlices.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listModelEvaluationSlices.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listModelEvaluationSlicesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice[] = + []; stream.on( 'data', ( @@ -2120,16 +2100,18 @@ describe('v1beta1.ModelServiceClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listModelEvaluationSlices - .createStream as SinonStub) + ( + client.descriptors.page.listModelEvaluationSlices + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.listModelEvaluationSlices, request) ); assert.strictEqual( - (client.descriptors.page.listModelEvaluationSlices - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listModelEvaluationSlices + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2156,25 +2138,27 @@ describe('v1beta1.ModelServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.ModelEvaluationSlice() ), ]; - client.descriptors.page.listModelEvaluationSlices.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.aiplatform.v1beta1.IModelEvaluationSlice[] = []; + client.descriptors.page.listModelEvaluationSlices.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.aiplatform.v1beta1.IModelEvaluationSlice[] = + []; const iterable = client.listModelEvaluationSlicesAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listModelEvaluationSlices - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listModelEvaluationSlices + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listModelEvaluationSlices - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listModelEvaluationSlices + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2191,27 +2175,28 @@ describe('v1beta1.ModelServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listModelEvaluationSlices.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listModelEvaluationSlices.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listModelEvaluationSlicesAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1beta1.IModelEvaluationSlice[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.IModelEvaluationSlice[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listModelEvaluationSlices - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listModelEvaluationSlices + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listModelEvaluationSlices - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listModelEvaluationSlices + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2372,9 +2357,8 @@ describe('v1beta1.ModelServiceClient', () => { }); it('matchAnnotationSpecFromAnnotationSpecName', () => { - const result = client.matchAnnotationSpecFromAnnotationSpecName( - fakePath - ); + const result = + client.matchAnnotationSpecFromAnnotationSpecName(fakePath); assert.strictEqual(result, 'annotationSpecValue'); assert( (client.pathTemplates.annotationSpecPathTemplate.match as SinonStub) @@ -2411,8 +2395,10 @@ describe('v1beta1.ModelServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -2422,8 +2408,10 @@ describe('v1beta1.ModelServiceClient', () => { const result = client.matchProjectFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2433,21 +2421,24 @@ describe('v1beta1.ModelServiceClient', () => { const result = client.matchLocationFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchBatchPredictionJobFromBatchPredictionJobName', () => { - const result = client.matchBatchPredictionJobFromBatchPredictionJobName( - fakePath - ); + const result = + client.matchBatchPredictionJobFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'batchPredictionJobValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2648,9 +2639,8 @@ describe('v1beta1.ModelServiceClient', () => { }); it('matchDataLabelingJobFromDataLabelingJobName', () => { - const result = client.matchDataLabelingJobFromDataLabelingJobName( - fakePath - ); + const result = + client.matchDataLabelingJobFromDataLabelingJobName(fakePath); assert.strictEqual(result, 'dataLabelingJobValue'); assert( (client.pathTemplates.dataLabelingJobPathTemplate.match as SinonStub) @@ -2815,47 +2805,54 @@ describe('v1beta1.ModelServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromHyperparameterTuningJobName', () => { - const result = client.matchProjectFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchProjectFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromHyperparameterTuningJobName', () => { - const result = client.matchLocationFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchLocationFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchHyperparameterTuningJobFromHyperparameterTuningJobName', () => { - const result = client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( + fakePath + ); assert.strictEqual(result, 'hyperparameterTuningJobValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3082,34 +3079,38 @@ describe('v1beta1.ModelServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .render as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromModelEvaluationSliceName', () => { - const result = client.matchProjectFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchProjectFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromModelEvaluationSliceName', () => { - const result = client.matchLocationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchLocationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3119,21 +3120,24 @@ describe('v1beta1.ModelServiceClient', () => { const result = client.matchModelFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'modelValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchEvaluationFromModelEvaluationSliceName', () => { - const result = client.matchEvaluationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchEvaluationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'evaluationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3143,8 +3147,10 @@ describe('v1beta1.ModelServiceClient', () => { const result = client.matchSliceFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'sliceValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3205,9 +3211,8 @@ describe('v1beta1.ModelServiceClient', () => { }); it('matchSpecialistPoolFromSpecialistPoolName', () => { - const result = client.matchSpecialistPoolFromSpecialistPoolName( - fakePath - ); + const result = + client.matchSpecialistPoolFromSpecialistPoolName(fakePath); assert.strictEqual(result, 'specialistPoolValue'); assert( (client.pathTemplates.specialistPoolPathTemplate.match as SinonStub) @@ -3308,8 +3313,10 @@ describe('v1beta1.ModelServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.trainingPipelinePathTemplate - .render as SinonStub) + ( + client.pathTemplates.trainingPipelinePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -3336,9 +3343,8 @@ describe('v1beta1.ModelServiceClient', () => { }); it('matchTrainingPipelineFromTrainingPipelineName', () => { - const result = client.matchTrainingPipelineFromTrainingPipelineName( - fakePath - ); + const result = + client.matchTrainingPipelineFromTrainingPipelineName(fakePath); assert.strictEqual(result, 'trainingPipelineValue'); assert( (client.pathTemplates.trainingPipelinePathTemplate.match as SinonStub) diff --git a/packages/google-cloud-aiplatform/test/gapic_pipeline_service_v1.ts b/packages/google-cloud-aiplatform/test/gapic_pipeline_service_v1.ts index 4ce2404eef0..e631ebf7f20 100644 --- a/packages/google-cloud-aiplatform/test/gapic_pipeline_service_v1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_pipeline_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; @@ -250,9 +249,8 @@ describe('v1.PipelineServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.TrainingPipeline() ); - client.innerApiCalls.createTrainingPipeline = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.createTrainingPipeline = + stubSimpleCall(expectedResponse); const [response] = await client.createTrainingPipeline(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -283,9 +281,8 @@ describe('v1.PipelineServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.TrainingPipeline() ); - client.innerApiCalls.createTrainingPipeline = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createTrainingPipeline = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createTrainingPipeline( request, @@ -367,9 +364,8 @@ describe('v1.PipelineServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.TrainingPipeline() ); - client.innerApiCalls.getTrainingPipeline = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.getTrainingPipeline = + stubSimpleCall(expectedResponse); const [response] = await client.getTrainingPipeline(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -400,9 +396,8 @@ describe('v1.PipelineServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.TrainingPipeline() ); - client.innerApiCalls.getTrainingPipeline = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getTrainingPipeline = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getTrainingPipeline( request, @@ -481,9 +476,8 @@ describe('v1.PipelineServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.cancelTrainingPipeline = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.cancelTrainingPipeline = + stubSimpleCall(expectedResponse); const [response] = await client.cancelTrainingPipeline(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -514,9 +508,8 @@ describe('v1.PipelineServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.cancelTrainingPipeline = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.cancelTrainingPipeline = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.cancelTrainingPipeline( request, @@ -598,9 +591,8 @@ describe('v1.PipelineServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteTrainingPipeline = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteTrainingPipeline = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteTrainingPipeline(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -632,9 +624,8 @@ describe('v1.PipelineServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteTrainingPipeline = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteTrainingPipeline = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteTrainingPipeline( request, @@ -805,9 +796,8 @@ describe('v1.PipelineServiceClient', () => { new protos.google.cloud.aiplatform.v1.TrainingPipeline() ), ]; - client.innerApiCalls.listTrainingPipelines = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listTrainingPipelines = + stubSimpleCall(expectedResponse); const [response] = await client.listTrainingPipelines(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -846,9 +836,8 @@ describe('v1.PipelineServiceClient', () => { new protos.google.cloud.aiplatform.v1.TrainingPipeline() ), ]; - client.innerApiCalls.listTrainingPipelines = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listTrainingPipelines = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listTrainingPipelines( request, @@ -931,12 +920,12 @@ describe('v1.PipelineServiceClient', () => { new protos.google.cloud.aiplatform.v1.TrainingPipeline() ), ]; - client.descriptors.page.listTrainingPipelines.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listTrainingPipelines.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listTrainingPipelinesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1.TrainingPipeline[] = []; + const responses: protos.google.cloud.aiplatform.v1.TrainingPipeline[] = + []; stream.on( 'data', (response: protos.google.cloud.aiplatform.v1.TrainingPipeline) => { @@ -953,16 +942,18 @@ describe('v1.PipelineServiceClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.listTrainingPipelines - .createStream as SinonStub) + ( + client.descriptors.page.listTrainingPipelines + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.listTrainingPipelines, request) ); assert.strictEqual( - (client.descriptors.page.listTrainingPipelines - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listTrainingPipelines + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -979,13 +970,12 @@ describe('v1.PipelineServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listTrainingPipelines.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listTrainingPipelines.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listTrainingPipelinesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1.TrainingPipeline[] = []; + const responses: protos.google.cloud.aiplatform.v1.TrainingPipeline[] = + []; stream.on( 'data', (response: protos.google.cloud.aiplatform.v1.TrainingPipeline) => { @@ -1001,16 +991,18 @@ describe('v1.PipelineServiceClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listTrainingPipelines - .createStream as SinonStub) + ( + client.descriptors.page.listTrainingPipelines + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.listTrainingPipelines, request) ); assert.strictEqual( - (client.descriptors.page.listTrainingPipelines - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listTrainingPipelines + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1037,25 +1029,27 @@ describe('v1.PipelineServiceClient', () => { new protos.google.cloud.aiplatform.v1.TrainingPipeline() ), ]; - client.descriptors.page.listTrainingPipelines.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.aiplatform.v1.ITrainingPipeline[] = []; + client.descriptors.page.listTrainingPipelines.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.aiplatform.v1.ITrainingPipeline[] = + []; const iterable = client.listTrainingPipelinesAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listTrainingPipelines - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listTrainingPipelines + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listTrainingPipelines - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listTrainingPipelines + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1072,27 +1066,28 @@ describe('v1.PipelineServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listTrainingPipelines.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listTrainingPipelines.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listTrainingPipelinesAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1.ITrainingPipeline[] = []; + const responses: protos.google.cloud.aiplatform.v1.ITrainingPipeline[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listTrainingPipelines - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listTrainingPipelines + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listTrainingPipelines - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listTrainingPipelines + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1253,9 +1248,8 @@ describe('v1.PipelineServiceClient', () => { }); it('matchAnnotationSpecFromAnnotationSpecName', () => { - const result = client.matchAnnotationSpecFromAnnotationSpecName( - fakePath - ); + const result = + client.matchAnnotationSpecFromAnnotationSpecName(fakePath); assert.strictEqual(result, 'annotationSpecValue'); assert( (client.pathTemplates.annotationSpecPathTemplate.match as SinonStub) @@ -1292,8 +1286,10 @@ describe('v1.PipelineServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -1303,8 +1299,10 @@ describe('v1.PipelineServiceClient', () => { const result = client.matchProjectFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1314,21 +1312,24 @@ describe('v1.PipelineServiceClient', () => { const result = client.matchLocationFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchBatchPredictionJobFromBatchPredictionJobName', () => { - const result = client.matchBatchPredictionJobFromBatchPredictionJobName( - fakePath - ); + const result = + client.matchBatchPredictionJobFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'batchPredictionJobValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1529,9 +1530,8 @@ describe('v1.PipelineServiceClient', () => { }); it('matchDataLabelingJobFromDataLabelingJobName', () => { - const result = client.matchDataLabelingJobFromDataLabelingJobName( - fakePath - ); + const result = + client.matchDataLabelingJobFromDataLabelingJobName(fakePath); assert.strictEqual(result, 'dataLabelingJobValue'); assert( (client.pathTemplates.dataLabelingJobPathTemplate.match as SinonStub) @@ -1696,47 +1696,54 @@ describe('v1.PipelineServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromHyperparameterTuningJobName', () => { - const result = client.matchProjectFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchProjectFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromHyperparameterTuningJobName', () => { - const result = client.matchLocationFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchLocationFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchHyperparameterTuningJobFromHyperparameterTuningJobName', () => { - const result = client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( + fakePath + ); assert.strictEqual(result, 'hyperparameterTuningJobValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1963,34 +1970,38 @@ describe('v1.PipelineServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .render as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromModelEvaluationSliceName', () => { - const result = client.matchProjectFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchProjectFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromModelEvaluationSliceName', () => { - const result = client.matchLocationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchLocationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2000,21 +2011,24 @@ describe('v1.PipelineServiceClient', () => { const result = client.matchModelFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'modelValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchEvaluationFromModelEvaluationSliceName', () => { - const result = client.matchEvaluationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchEvaluationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'evaluationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2024,8 +2038,10 @@ describe('v1.PipelineServiceClient', () => { const result = client.matchSliceFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'sliceValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2086,9 +2102,8 @@ describe('v1.PipelineServiceClient', () => { }); it('matchSpecialistPoolFromSpecialistPoolName', () => { - const result = client.matchSpecialistPoolFromSpecialistPoolName( - fakePath - ); + const result = + client.matchSpecialistPoolFromSpecialistPoolName(fakePath); assert.strictEqual(result, 'specialistPoolValue'); assert( (client.pathTemplates.specialistPoolPathTemplate.match as SinonStub) @@ -2125,8 +2140,10 @@ describe('v1.PipelineServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.trainingPipelinePathTemplate - .render as SinonStub) + ( + client.pathTemplates.trainingPipelinePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -2153,9 +2170,8 @@ describe('v1.PipelineServiceClient', () => { }); it('matchTrainingPipelineFromTrainingPipelineName', () => { - const result = client.matchTrainingPipelineFromTrainingPipelineName( - fakePath - ); + const result = + client.matchTrainingPipelineFromTrainingPipelineName(fakePath); assert.strictEqual(result, 'trainingPipelineValue'); assert( (client.pathTemplates.trainingPipelinePathTemplate.match as SinonStub) diff --git a/packages/google-cloud-aiplatform/test/gapic_pipeline_service_v1beta1.ts b/packages/google-cloud-aiplatform/test/gapic_pipeline_service_v1beta1.ts index 255e313c2a5..8f8a7e7d5ac 100644 --- a/packages/google-cloud-aiplatform/test/gapic_pipeline_service_v1beta1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_pipeline_service_v1beta1.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; @@ -250,9 +249,8 @@ describe('v1beta1.PipelineServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.TrainingPipeline() ); - client.innerApiCalls.createTrainingPipeline = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.createTrainingPipeline = + stubSimpleCall(expectedResponse); const [response] = await client.createTrainingPipeline(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -283,9 +281,8 @@ describe('v1beta1.PipelineServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.TrainingPipeline() ); - client.innerApiCalls.createTrainingPipeline = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createTrainingPipeline = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createTrainingPipeline( request, @@ -367,9 +364,8 @@ describe('v1beta1.PipelineServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.TrainingPipeline() ); - client.innerApiCalls.getTrainingPipeline = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.getTrainingPipeline = + stubSimpleCall(expectedResponse); const [response] = await client.getTrainingPipeline(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -400,9 +396,8 @@ describe('v1beta1.PipelineServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.TrainingPipeline() ); - client.innerApiCalls.getTrainingPipeline = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getTrainingPipeline = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getTrainingPipeline( request, @@ -481,9 +476,8 @@ describe('v1beta1.PipelineServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.cancelTrainingPipeline = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.cancelTrainingPipeline = + stubSimpleCall(expectedResponse); const [response] = await client.cancelTrainingPipeline(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -514,9 +508,8 @@ describe('v1beta1.PipelineServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.cancelTrainingPipeline = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.cancelTrainingPipeline = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.cancelTrainingPipeline( request, @@ -598,9 +591,8 @@ describe('v1beta1.PipelineServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteTrainingPipeline = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteTrainingPipeline = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteTrainingPipeline(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -632,9 +624,8 @@ describe('v1beta1.PipelineServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteTrainingPipeline = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteTrainingPipeline = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteTrainingPipeline( request, @@ -805,9 +796,8 @@ describe('v1beta1.PipelineServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.TrainingPipeline() ), ]; - client.innerApiCalls.listTrainingPipelines = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listTrainingPipelines = + stubSimpleCall(expectedResponse); const [response] = await client.listTrainingPipelines(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -846,9 +836,8 @@ describe('v1beta1.PipelineServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.TrainingPipeline() ), ]; - client.innerApiCalls.listTrainingPipelines = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listTrainingPipelines = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listTrainingPipelines( request, @@ -931,12 +920,12 @@ describe('v1beta1.PipelineServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.TrainingPipeline() ), ]; - client.descriptors.page.listTrainingPipelines.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listTrainingPipelines.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listTrainingPipelinesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.TrainingPipeline[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.TrainingPipeline[] = + []; stream.on( 'data', ( @@ -955,16 +944,18 @@ describe('v1beta1.PipelineServiceClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.listTrainingPipelines - .createStream as SinonStub) + ( + client.descriptors.page.listTrainingPipelines + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.listTrainingPipelines, request) ); assert.strictEqual( - (client.descriptors.page.listTrainingPipelines - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listTrainingPipelines + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -981,13 +972,12 @@ describe('v1beta1.PipelineServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listTrainingPipelines.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listTrainingPipelines.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listTrainingPipelinesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.TrainingPipeline[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.TrainingPipeline[] = + []; stream.on( 'data', ( @@ -1005,16 +995,18 @@ describe('v1beta1.PipelineServiceClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listTrainingPipelines - .createStream as SinonStub) + ( + client.descriptors.page.listTrainingPipelines + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.listTrainingPipelines, request) ); assert.strictEqual( - (client.descriptors.page.listTrainingPipelines - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listTrainingPipelines + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1041,25 +1033,27 @@ describe('v1beta1.PipelineServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.TrainingPipeline() ), ]; - client.descriptors.page.listTrainingPipelines.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.aiplatform.v1beta1.ITrainingPipeline[] = []; + client.descriptors.page.listTrainingPipelines.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.aiplatform.v1beta1.ITrainingPipeline[] = + []; const iterable = client.listTrainingPipelinesAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listTrainingPipelines - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listTrainingPipelines + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listTrainingPipelines - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listTrainingPipelines + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1076,27 +1070,28 @@ describe('v1beta1.PipelineServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listTrainingPipelines.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listTrainingPipelines.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listTrainingPipelinesAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1beta1.ITrainingPipeline[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.ITrainingPipeline[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listTrainingPipelines - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listTrainingPipelines + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listTrainingPipelines - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listTrainingPipelines + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1257,9 +1252,8 @@ describe('v1beta1.PipelineServiceClient', () => { }); it('matchAnnotationSpecFromAnnotationSpecName', () => { - const result = client.matchAnnotationSpecFromAnnotationSpecName( - fakePath - ); + const result = + client.matchAnnotationSpecFromAnnotationSpecName(fakePath); assert.strictEqual(result, 'annotationSpecValue'); assert( (client.pathTemplates.annotationSpecPathTemplate.match as SinonStub) @@ -1296,8 +1290,10 @@ describe('v1beta1.PipelineServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -1307,8 +1303,10 @@ describe('v1beta1.PipelineServiceClient', () => { const result = client.matchProjectFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1318,21 +1316,24 @@ describe('v1beta1.PipelineServiceClient', () => { const result = client.matchLocationFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchBatchPredictionJobFromBatchPredictionJobName', () => { - const result = client.matchBatchPredictionJobFromBatchPredictionJobName( - fakePath - ); + const result = + client.matchBatchPredictionJobFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'batchPredictionJobValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1533,9 +1534,8 @@ describe('v1beta1.PipelineServiceClient', () => { }); it('matchDataLabelingJobFromDataLabelingJobName', () => { - const result = client.matchDataLabelingJobFromDataLabelingJobName( - fakePath - ); + const result = + client.matchDataLabelingJobFromDataLabelingJobName(fakePath); assert.strictEqual(result, 'dataLabelingJobValue'); assert( (client.pathTemplates.dataLabelingJobPathTemplate.match as SinonStub) @@ -1700,47 +1700,54 @@ describe('v1beta1.PipelineServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromHyperparameterTuningJobName', () => { - const result = client.matchProjectFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchProjectFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromHyperparameterTuningJobName', () => { - const result = client.matchLocationFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchLocationFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchHyperparameterTuningJobFromHyperparameterTuningJobName', () => { - const result = client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( + fakePath + ); assert.strictEqual(result, 'hyperparameterTuningJobValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1967,34 +1974,38 @@ describe('v1beta1.PipelineServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .render as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromModelEvaluationSliceName', () => { - const result = client.matchProjectFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchProjectFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromModelEvaluationSliceName', () => { - const result = client.matchLocationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchLocationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2004,21 +2015,24 @@ describe('v1beta1.PipelineServiceClient', () => { const result = client.matchModelFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'modelValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchEvaluationFromModelEvaluationSliceName', () => { - const result = client.matchEvaluationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchEvaluationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'evaluationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2028,8 +2042,10 @@ describe('v1beta1.PipelineServiceClient', () => { const result = client.matchSliceFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'sliceValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2090,9 +2106,8 @@ describe('v1beta1.PipelineServiceClient', () => { }); it('matchSpecialistPoolFromSpecialistPoolName', () => { - const result = client.matchSpecialistPoolFromSpecialistPoolName( - fakePath - ); + const result = + client.matchSpecialistPoolFromSpecialistPoolName(fakePath); assert.strictEqual(result, 'specialistPoolValue'); assert( (client.pathTemplates.specialistPoolPathTemplate.match as SinonStub) @@ -2193,8 +2208,10 @@ describe('v1beta1.PipelineServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.trainingPipelinePathTemplate - .render as SinonStub) + ( + client.pathTemplates.trainingPipelinePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -2221,9 +2238,8 @@ describe('v1beta1.PipelineServiceClient', () => { }); it('matchTrainingPipelineFromTrainingPipelineName', () => { - const result = client.matchTrainingPipelineFromTrainingPipelineName( - fakePath - ); + const result = + client.matchTrainingPipelineFromTrainingPipelineName(fakePath); assert.strictEqual(result, 'trainingPipelineValue'); assert( (client.pathTemplates.trainingPipelinePathTemplate.match as SinonStub) diff --git a/packages/google-cloud-aiplatform/test/gapic_prediction_service_v1.ts b/packages/google-cloud-aiplatform/test/gapic_prediction_service_v1.ts index 85e719b6f18..d596b6bcba9 100644 --- a/packages/google-cloud-aiplatform/test/gapic_prediction_service_v1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_prediction_service_v1.ts @@ -26,10 +26,9 @@ import * as predictionserviceModule 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('v1.PredictionServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.PredictResponse() ); - client.innerApiCalls.predict = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.predict = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.predict( request, @@ -397,9 +395,8 @@ describe('v1.PredictionServiceClient', () => { }); it('matchAnnotationSpecFromAnnotationSpecName', () => { - const result = client.matchAnnotationSpecFromAnnotationSpecName( - fakePath - ); + const result = + client.matchAnnotationSpecFromAnnotationSpecName(fakePath); assert.strictEqual(result, 'annotationSpecValue'); assert( (client.pathTemplates.annotationSpecPathTemplate.match as SinonStub) @@ -436,8 +433,10 @@ describe('v1.PredictionServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -447,8 +446,10 @@ describe('v1.PredictionServiceClient', () => { const result = client.matchProjectFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -458,21 +459,24 @@ describe('v1.PredictionServiceClient', () => { const result = client.matchLocationFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchBatchPredictionJobFromBatchPredictionJobName', () => { - const result = client.matchBatchPredictionJobFromBatchPredictionJobName( - fakePath - ); + const result = + client.matchBatchPredictionJobFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'batchPredictionJobValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -673,9 +677,8 @@ describe('v1.PredictionServiceClient', () => { }); it('matchDataLabelingJobFromDataLabelingJobName', () => { - const result = client.matchDataLabelingJobFromDataLabelingJobName( - fakePath - ); + const result = + client.matchDataLabelingJobFromDataLabelingJobName(fakePath); assert.strictEqual(result, 'dataLabelingJobValue'); assert( (client.pathTemplates.dataLabelingJobPathTemplate.match as SinonStub) @@ -840,47 +843,54 @@ describe('v1.PredictionServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromHyperparameterTuningJobName', () => { - const result = client.matchProjectFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchProjectFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromHyperparameterTuningJobName', () => { - const result = client.matchLocationFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchLocationFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchHyperparameterTuningJobFromHyperparameterTuningJobName', () => { - const result = client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( + fakePath + ); assert.strictEqual(result, 'hyperparameterTuningJobValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1058,34 +1068,38 @@ describe('v1.PredictionServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .render as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromModelEvaluationSliceName', () => { - const result = client.matchProjectFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchProjectFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromModelEvaluationSliceName', () => { - const result = client.matchLocationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchLocationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1095,21 +1109,24 @@ describe('v1.PredictionServiceClient', () => { const result = client.matchModelFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'modelValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchEvaluationFromModelEvaluationSliceName', () => { - const result = client.matchEvaluationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchEvaluationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'evaluationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1119,8 +1136,10 @@ describe('v1.PredictionServiceClient', () => { const result = client.matchSliceFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'sliceValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1181,9 +1200,8 @@ describe('v1.PredictionServiceClient', () => { }); it('matchSpecialistPoolFromSpecialistPoolName', () => { - const result = client.matchSpecialistPoolFromSpecialistPoolName( - fakePath - ); + const result = + client.matchSpecialistPoolFromSpecialistPoolName(fakePath); assert.strictEqual(result, 'specialistPoolValue'); assert( (client.pathTemplates.specialistPoolPathTemplate.match as SinonStub) @@ -1220,8 +1238,10 @@ describe('v1.PredictionServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.trainingPipelinePathTemplate - .render as SinonStub) + ( + client.pathTemplates.trainingPipelinePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -1248,9 +1268,8 @@ describe('v1.PredictionServiceClient', () => { }); it('matchTrainingPipelineFromTrainingPipelineName', () => { - const result = client.matchTrainingPipelineFromTrainingPipelineName( - fakePath - ); + const result = + client.matchTrainingPipelineFromTrainingPipelineName(fakePath); assert.strictEqual(result, 'trainingPipelineValue'); assert( (client.pathTemplates.trainingPipelinePathTemplate.match as SinonStub) diff --git a/packages/google-cloud-aiplatform/test/gapic_prediction_service_v1beta1.ts b/packages/google-cloud-aiplatform/test/gapic_prediction_service_v1beta1.ts index 82d7f4238ff..7d0e3cdc6e7 100644 --- a/packages/google-cloud-aiplatform/test/gapic_prediction_service_v1beta1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_prediction_service_v1beta1.ts @@ -26,10 +26,9 @@ import * as predictionserviceModule 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; @@ -70,7 +69,8 @@ describe('v1beta1.PredictionServiceClient', () => { }); it('should create a client with no option', () => { - const client = new predictionserviceModule.v1beta1.PredictionServiceClient(); + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient(); assert(client); }); @@ -135,12 +135,11 @@ describe('v1beta1.PredictionServiceClient', () => { describe('predict', () => { it('invokes predict without error', async () => { - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.PredictRequest() @@ -168,12 +167,11 @@ describe('v1beta1.PredictionServiceClient', () => { }); it('invokes predict without error using callback', async () => { - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.PredictRequest() @@ -190,9 +188,8 @@ describe('v1beta1.PredictionServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.PredictResponse() ); - client.innerApiCalls.predict = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.predict = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.predict( request, @@ -218,12 +215,11 @@ describe('v1beta1.PredictionServiceClient', () => { }); it('invokes predict with error', async () => { - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.PredictRequest() @@ -250,12 +246,11 @@ describe('v1beta1.PredictionServiceClient', () => { describe('explain', () => { it('invokes explain without error', async () => { - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.ExplainRequest() @@ -283,12 +278,11 @@ describe('v1beta1.PredictionServiceClient', () => { }); it('invokes explain without error using callback', async () => { - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.ExplainRequest() @@ -305,9 +299,8 @@ describe('v1beta1.PredictionServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.ExplainResponse() ); - client.innerApiCalls.explain = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.explain = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.explain( request, @@ -333,12 +326,11 @@ describe('v1beta1.PredictionServiceClient', () => { }); it('invokes explain with error', async () => { - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.ExplainRequest() @@ -373,12 +365,11 @@ describe('v1beta1.PredictionServiceClient', () => { data_item: 'dataItemValue', annotation: 'annotationValue', }; - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.annotationPathTemplate.render = sinon .stub() @@ -462,12 +453,11 @@ describe('v1beta1.PredictionServiceClient', () => { dataset: 'datasetValue', annotation_spec: 'annotationSpecValue', }; - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.annotationSpecPathTemplate.render = sinon .stub() @@ -522,9 +512,8 @@ describe('v1beta1.PredictionServiceClient', () => { }); it('matchAnnotationSpecFromAnnotationSpecName', () => { - const result = client.matchAnnotationSpecFromAnnotationSpecName( - fakePath - ); + const result = + client.matchAnnotationSpecFromAnnotationSpecName(fakePath); assert.strictEqual(result, 'annotationSpecValue'); assert( (client.pathTemplates.annotationSpecPathTemplate.match as SinonStub) @@ -541,12 +530,11 @@ describe('v1beta1.PredictionServiceClient', () => { location: 'locationValue', batch_prediction_job: 'batchPredictionJobValue', }; - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.batchPredictionJobPathTemplate.render = sinon .stub() @@ -563,8 +551,10 @@ describe('v1beta1.PredictionServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -574,8 +564,10 @@ describe('v1beta1.PredictionServiceClient', () => { const result = client.matchProjectFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -585,21 +577,24 @@ describe('v1beta1.PredictionServiceClient', () => { const result = client.matchLocationFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchBatchPredictionJobFromBatchPredictionJobName', () => { - const result = client.matchBatchPredictionJobFromBatchPredictionJobName( - fakePath - ); + const result = + client.matchBatchPredictionJobFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'batchPredictionJobValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -613,12 +608,11 @@ describe('v1beta1.PredictionServiceClient', () => { location: 'locationValue', custom_job: 'customJobValue', }; - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.customJobPathTemplate.render = sinon .stub() @@ -680,12 +674,11 @@ describe('v1beta1.PredictionServiceClient', () => { dataset: 'datasetValue', data_item: 'dataItemValue', }; - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.dataItemPathTemplate.render = sinon .stub() @@ -757,12 +750,11 @@ describe('v1beta1.PredictionServiceClient', () => { location: 'locationValue', data_labeling_job: 'dataLabelingJobValue', }; - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.dataLabelingJobPathTemplate.render = sinon .stub() @@ -806,9 +798,8 @@ describe('v1beta1.PredictionServiceClient', () => { }); it('matchDataLabelingJobFromDataLabelingJobName', () => { - const result = client.matchDataLabelingJobFromDataLabelingJobName( - fakePath - ); + const result = + client.matchDataLabelingJobFromDataLabelingJobName(fakePath); assert.strictEqual(result, 'dataLabelingJobValue'); assert( (client.pathTemplates.dataLabelingJobPathTemplate.match as SinonStub) @@ -825,12 +816,11 @@ describe('v1beta1.PredictionServiceClient', () => { location: 'locationValue', dataset: 'datasetValue', }; - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.datasetPathTemplate.render = sinon .stub() @@ -891,12 +881,11 @@ describe('v1beta1.PredictionServiceClient', () => { location: 'locationValue', endpoint: 'endpointValue', }; - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.endpointPathTemplate.render = sinon .stub() @@ -957,12 +946,11 @@ describe('v1beta1.PredictionServiceClient', () => { location: 'locationValue', hyperparameter_tuning_job: 'hyperparameterTuningJobValue', }; - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.hyperparameterTuningJobPathTemplate.render = sinon .stub() @@ -979,47 +967,54 @@ describe('v1beta1.PredictionServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromHyperparameterTuningJobName', () => { - const result = client.matchProjectFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchProjectFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromHyperparameterTuningJobName', () => { - const result = client.matchLocationFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchLocationFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchHyperparameterTuningJobFromHyperparameterTuningJobName', () => { - const result = client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( + fakePath + ); assert.strictEqual(result, 'hyperparameterTuningJobValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1033,12 +1028,11 @@ describe('v1beta1.PredictionServiceClient', () => { location: 'locationValue', model: 'modelValue', }; - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.modelPathTemplate.render = sinon .stub() @@ -1100,12 +1094,11 @@ describe('v1beta1.PredictionServiceClient', () => { model: 'modelValue', evaluation: 'evaluationValue', }; - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.modelEvaluationPathTemplate.render = sinon .stub() @@ -1179,12 +1172,11 @@ describe('v1beta1.PredictionServiceClient', () => { evaluation: 'evaluationValue', slice: 'sliceValue', }; - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.modelEvaluationSlicePathTemplate.render = sinon .stub() @@ -1203,34 +1195,38 @@ describe('v1beta1.PredictionServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .render as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromModelEvaluationSliceName', () => { - const result = client.matchProjectFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchProjectFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromModelEvaluationSliceName', () => { - const result = client.matchLocationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchLocationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1240,21 +1236,24 @@ describe('v1beta1.PredictionServiceClient', () => { const result = client.matchModelFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'modelValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchEvaluationFromModelEvaluationSliceName', () => { - const result = client.matchEvaluationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchEvaluationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'evaluationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1264,8 +1263,10 @@ describe('v1beta1.PredictionServiceClient', () => { const result = client.matchSliceFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'sliceValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1279,12 +1280,11 @@ describe('v1beta1.PredictionServiceClient', () => { location: 'locationValue', specialist_pool: 'specialistPoolValue', }; - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.specialistPoolPathTemplate.render = sinon .stub() @@ -1328,9 +1328,8 @@ describe('v1beta1.PredictionServiceClient', () => { }); it('matchSpecialistPoolFromSpecialistPoolName', () => { - const result = client.matchSpecialistPoolFromSpecialistPoolName( - fakePath - ); + const result = + client.matchSpecialistPoolFromSpecialistPoolName(fakePath); assert.strictEqual(result, 'specialistPoolValue'); assert( (client.pathTemplates.specialistPoolPathTemplate.match as SinonStub) @@ -1347,12 +1346,11 @@ describe('v1beta1.PredictionServiceClient', () => { location: 'locationValue', study: 'studyValue', }; - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.studyPathTemplate.render = sinon .stub() @@ -1413,12 +1411,11 @@ describe('v1beta1.PredictionServiceClient', () => { location: 'locationValue', training_pipeline: 'trainingPipelineValue', }; - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.trainingPipelinePathTemplate.render = sinon .stub() @@ -1435,8 +1432,10 @@ describe('v1beta1.PredictionServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.trainingPipelinePathTemplate - .render as SinonStub) + ( + client.pathTemplates.trainingPipelinePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -1463,9 +1462,8 @@ describe('v1beta1.PredictionServiceClient', () => { }); it('matchTrainingPipelineFromTrainingPipelineName', () => { - const result = client.matchTrainingPipelineFromTrainingPipelineName( - fakePath - ); + const result = + client.matchTrainingPipelineFromTrainingPipelineName(fakePath); assert.strictEqual(result, 'trainingPipelineValue'); assert( (client.pathTemplates.trainingPipelinePathTemplate.match as SinonStub) @@ -1483,12 +1481,11 @@ describe('v1beta1.PredictionServiceClient', () => { study: 'studyValue', trial: 'trialValue', }; - const client = new predictionserviceModule.v1beta1.PredictionServiceClient( - { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.trialPathTemplate.render = sinon .stub() diff --git a/packages/google-cloud-aiplatform/test/gapic_specialist_pool_service_v1.ts b/packages/google-cloud-aiplatform/test/gapic_specialist_pool_service_v1.ts index 52142e4e994..e07d2f5e041 100644 --- a/packages/google-cloud-aiplatform/test/gapic_specialist_pool_service_v1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_specialist_pool_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; @@ -166,49 +165,46 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('should create a client with no option', () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient(); + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient(); assert(client); }); it('should create a client with gRPC fallback', () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ fallback: true, - } - ); + }); assert(client); }); it('has initialize method and supports deferred initialization', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); assert.strictEqual(client.specialistPoolServiceStub, undefined); await client.initialize(); assert(client.specialistPoolServiceStub); }); it('has close method', () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.close(); }); it('has getProjectId method', async () => { const fakeProjectId = 'fake-project-id'; - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); const result = await client.getProjectId(); assert.strictEqual(result, fakeProjectId); @@ -217,12 +213,11 @@ describe('v1.SpecialistPoolServiceClient', () => { it('has getProjectId method with callback', async () => { const fakeProjectId = 'fake-project-id'; - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.auth.getProjectId = sinon .stub() .callsArgWith(0, null, fakeProjectId); @@ -241,12 +236,11 @@ describe('v1.SpecialistPoolServiceClient', () => { describe('getSpecialistPool', () => { it('invokes getSpecialistPool without error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.GetSpecialistPoolRequest() @@ -274,12 +268,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes getSpecialistPool without error using callback', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.GetSpecialistPoolRequest() @@ -296,9 +289,8 @@ describe('v1.SpecialistPoolServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1.SpecialistPool() ); - client.innerApiCalls.getSpecialistPool = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getSpecialistPool = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getSpecialistPool( request, @@ -324,12 +316,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes getSpecialistPool with error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.GetSpecialistPoolRequest() @@ -359,12 +350,11 @@ describe('v1.SpecialistPoolServiceClient', () => { describe('createSpecialistPool', () => { it('invokes createSpecialistPool without error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.CreateSpecialistPoolRequest() @@ -381,9 +371,8 @@ describe('v1.SpecialistPoolServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createSpecialistPool = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.createSpecialistPool = + stubLongRunningCall(expectedResponse); const [operation] = await client.createSpecialistPool(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -395,12 +384,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes createSpecialistPool without error using callback', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.CreateSpecialistPoolRequest() @@ -417,9 +405,8 @@ describe('v1.SpecialistPoolServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createSpecialistPool = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createSpecialistPool = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createSpecialistPool( request, @@ -452,12 +439,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes createSpecialistPool with call error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.CreateSpecialistPoolRequest() @@ -485,12 +471,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes createSpecialistPool with LRO error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.CreateSpecialistPoolRequest() @@ -520,12 +505,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes checkCreateSpecialistPoolProgress without error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -544,12 +528,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes checkCreateSpecialistPoolProgress with error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedError = new Error('expected'); @@ -567,12 +550,11 @@ describe('v1.SpecialistPoolServiceClient', () => { describe('deleteSpecialistPool', () => { it('invokes deleteSpecialistPool without error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.DeleteSpecialistPoolRequest() @@ -589,9 +571,8 @@ describe('v1.SpecialistPoolServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteSpecialistPool = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteSpecialistPool = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteSpecialistPool(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -603,12 +584,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes deleteSpecialistPool without error using callback', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.DeleteSpecialistPoolRequest() @@ -625,9 +605,8 @@ describe('v1.SpecialistPoolServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteSpecialistPool = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteSpecialistPool = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteSpecialistPool( request, @@ -660,12 +639,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes deleteSpecialistPool with call error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.DeleteSpecialistPoolRequest() @@ -693,12 +671,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes deleteSpecialistPool with LRO error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.DeleteSpecialistPoolRequest() @@ -728,12 +705,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes checkDeleteSpecialistPoolProgress without error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -752,12 +728,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes checkDeleteSpecialistPoolProgress with error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedError = new Error('expected'); @@ -775,12 +750,11 @@ describe('v1.SpecialistPoolServiceClient', () => { describe('updateSpecialistPool', () => { it('invokes updateSpecialistPool without error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.UpdateSpecialistPoolRequest() @@ -798,9 +772,8 @@ describe('v1.SpecialistPoolServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.updateSpecialistPool = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.updateSpecialistPool = + stubLongRunningCall(expectedResponse); const [operation] = await client.updateSpecialistPool(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -812,12 +785,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes updateSpecialistPool without error using callback', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.UpdateSpecialistPoolRequest() @@ -835,9 +807,8 @@ describe('v1.SpecialistPoolServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.updateSpecialistPool = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateSpecialistPool = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateSpecialistPool( request, @@ -870,12 +841,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes updateSpecialistPool with call error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.UpdateSpecialistPoolRequest() @@ -904,12 +874,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes updateSpecialistPool with LRO error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.UpdateSpecialistPoolRequest() @@ -940,12 +909,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes checkUpdateSpecialistPoolProgress without error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -964,12 +932,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes checkUpdateSpecialistPoolProgress with error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedError = new Error('expected'); @@ -987,12 +954,11 @@ describe('v1.SpecialistPoolServiceClient', () => { describe('listSpecialistPools', () => { it('invokes listSpecialistPools without error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.ListSpecialistPoolsRequest() @@ -1017,9 +983,8 @@ describe('v1.SpecialistPoolServiceClient', () => { new protos.google.cloud.aiplatform.v1.SpecialistPool() ), ]; - client.innerApiCalls.listSpecialistPools = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listSpecialistPools = + stubSimpleCall(expectedResponse); const [response] = await client.listSpecialistPools(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1030,12 +995,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes listSpecialistPools without error using callback', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.ListSpecialistPoolsRequest() @@ -1060,9 +1024,8 @@ describe('v1.SpecialistPoolServiceClient', () => { new protos.google.cloud.aiplatform.v1.SpecialistPool() ), ]; - client.innerApiCalls.listSpecialistPools = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listSpecialistPools = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listSpecialistPools( request, @@ -1088,12 +1051,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes listSpecialistPools with error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.ListSpecialistPoolsRequest() @@ -1121,12 +1083,11 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('invokes listSpecialistPoolsStream without error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.ListSpecialistPoolsRequest() @@ -1144,12 +1105,12 @@ describe('v1.SpecialistPoolServiceClient', () => { new protos.google.cloud.aiplatform.v1.SpecialistPool() ), ]; - client.descriptors.page.listSpecialistPools.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listSpecialistPools.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listSpecialistPoolsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1.SpecialistPool[] = []; + const responses: protos.google.cloud.aiplatform.v1.SpecialistPool[] = + []; stream.on( 'data', (response: protos.google.cloud.aiplatform.v1.SpecialistPool) => { @@ -1171,21 +1132,19 @@ describe('v1.SpecialistPoolServiceClient', () => { .calledWith(client.innerApiCalls.listSpecialistPools, request) ); assert.strictEqual( - (client.descriptors.page.listSpecialistPools - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listSpecialistPools.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); it('invokes listSpecialistPoolsStream with error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.ListSpecialistPoolsRequest() @@ -1193,13 +1152,12 @@ describe('v1.SpecialistPoolServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listSpecialistPools.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listSpecialistPools.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listSpecialistPoolsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1.SpecialistPool[] = []; + const responses: protos.google.cloud.aiplatform.v1.SpecialistPool[] = + []; stream.on( 'data', (response: protos.google.cloud.aiplatform.v1.SpecialistPool) => { @@ -1220,21 +1178,19 @@ describe('v1.SpecialistPoolServiceClient', () => { .calledWith(client.innerApiCalls.listSpecialistPools, request) ); assert.strictEqual( - (client.descriptors.page.listSpecialistPools - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listSpecialistPools.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); it('uses async iteration with listSpecialistPools without error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.ListSpecialistPoolsRequest() @@ -1252,9 +1208,8 @@ describe('v1.SpecialistPoolServiceClient', () => { new protos.google.cloud.aiplatform.v1.SpecialistPool() ), ]; - client.descriptors.page.listSpecialistPools.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listSpecialistPools.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.aiplatform.v1.ISpecialistPool[] = []; const iterable = client.listSpecialistPoolsAsync(request); for await (const resource of iterable) { @@ -1262,26 +1217,25 @@ describe('v1.SpecialistPoolServiceClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listSpecialistPools - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listSpecialistPools.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listSpecialistPools - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listSpecialistPools.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); it('uses async iteration with listSpecialistPools with error', async () => { - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1.ListSpecialistPoolsRequest() @@ -1289,27 +1243,26 @@ describe('v1.SpecialistPoolServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listSpecialistPools.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listSpecialistPools.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listSpecialistPoolsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1.ISpecialistPool[] = []; + const responses: protos.google.cloud.aiplatform.v1.ISpecialistPool[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listSpecialistPools - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listSpecialistPools.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listSpecialistPools - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listSpecialistPools.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1325,12 +1278,11 @@ describe('v1.SpecialistPoolServiceClient', () => { data_item: 'dataItemValue', annotation: 'annotationValue', }; - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.annotationPathTemplate.render = sinon .stub() @@ -1414,12 +1366,11 @@ describe('v1.SpecialistPoolServiceClient', () => { dataset: 'datasetValue', annotation_spec: 'annotationSpecValue', }; - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.annotationSpecPathTemplate.render = sinon .stub() @@ -1474,9 +1425,8 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('matchAnnotationSpecFromAnnotationSpecName', () => { - const result = client.matchAnnotationSpecFromAnnotationSpecName( - fakePath - ); + const result = + client.matchAnnotationSpecFromAnnotationSpecName(fakePath); assert.strictEqual(result, 'annotationSpecValue'); assert( (client.pathTemplates.annotationSpecPathTemplate.match as SinonStub) @@ -1493,12 +1443,11 @@ describe('v1.SpecialistPoolServiceClient', () => { location: 'locationValue', batch_prediction_job: 'batchPredictionJobValue', }; - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.batchPredictionJobPathTemplate.render = sinon .stub() @@ -1515,8 +1464,10 @@ describe('v1.SpecialistPoolServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -1526,8 +1477,10 @@ describe('v1.SpecialistPoolServiceClient', () => { const result = client.matchProjectFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1537,21 +1490,24 @@ describe('v1.SpecialistPoolServiceClient', () => { const result = client.matchLocationFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchBatchPredictionJobFromBatchPredictionJobName', () => { - const result = client.matchBatchPredictionJobFromBatchPredictionJobName( - fakePath - ); + const result = + client.matchBatchPredictionJobFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'batchPredictionJobValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1565,12 +1521,11 @@ describe('v1.SpecialistPoolServiceClient', () => { location: 'locationValue', custom_job: 'customJobValue', }; - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.customJobPathTemplate.render = sinon .stub() @@ -1632,12 +1587,11 @@ describe('v1.SpecialistPoolServiceClient', () => { dataset: 'datasetValue', data_item: 'dataItemValue', }; - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.dataItemPathTemplate.render = sinon .stub() @@ -1709,12 +1663,11 @@ describe('v1.SpecialistPoolServiceClient', () => { location: 'locationValue', data_labeling_job: 'dataLabelingJobValue', }; - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.dataLabelingJobPathTemplate.render = sinon .stub() @@ -1758,9 +1711,8 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('matchDataLabelingJobFromDataLabelingJobName', () => { - const result = client.matchDataLabelingJobFromDataLabelingJobName( - fakePath - ); + const result = + client.matchDataLabelingJobFromDataLabelingJobName(fakePath); assert.strictEqual(result, 'dataLabelingJobValue'); assert( (client.pathTemplates.dataLabelingJobPathTemplate.match as SinonStub) @@ -1777,12 +1729,11 @@ describe('v1.SpecialistPoolServiceClient', () => { location: 'locationValue', dataset: 'datasetValue', }; - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.datasetPathTemplate.render = sinon .stub() @@ -1843,12 +1794,11 @@ describe('v1.SpecialistPoolServiceClient', () => { location: 'locationValue', endpoint: 'endpointValue', }; - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.endpointPathTemplate.render = sinon .stub() @@ -1909,12 +1859,11 @@ describe('v1.SpecialistPoolServiceClient', () => { location: 'locationValue', hyperparameter_tuning_job: 'hyperparameterTuningJobValue', }; - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.hyperparameterTuningJobPathTemplate.render = sinon .stub() @@ -1931,47 +1880,54 @@ describe('v1.SpecialistPoolServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromHyperparameterTuningJobName', () => { - const result = client.matchProjectFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchProjectFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromHyperparameterTuningJobName', () => { - const result = client.matchLocationFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchLocationFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchHyperparameterTuningJobFromHyperparameterTuningJobName', () => { - const result = client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( + fakePath + ); assert.strictEqual(result, 'hyperparameterTuningJobValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1984,12 +1940,11 @@ describe('v1.SpecialistPoolServiceClient', () => { project: 'projectValue', location: 'locationValue', }; - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.locationPathTemplate.render = sinon .stub() @@ -2036,12 +1991,11 @@ describe('v1.SpecialistPoolServiceClient', () => { location: 'locationValue', model: 'modelValue', }; - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.modelPathTemplate.render = sinon .stub() @@ -2103,12 +2057,11 @@ describe('v1.SpecialistPoolServiceClient', () => { model: 'modelValue', evaluation: 'evaluationValue', }; - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.modelEvaluationPathTemplate.render = sinon .stub() @@ -2182,12 +2135,11 @@ describe('v1.SpecialistPoolServiceClient', () => { evaluation: 'evaluationValue', slice: 'sliceValue', }; - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.modelEvaluationSlicePathTemplate.render = sinon .stub() @@ -2206,34 +2158,38 @@ describe('v1.SpecialistPoolServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .render as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromModelEvaluationSliceName', () => { - const result = client.matchProjectFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchProjectFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromModelEvaluationSliceName', () => { - const result = client.matchLocationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchLocationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2243,21 +2199,24 @@ describe('v1.SpecialistPoolServiceClient', () => { const result = client.matchModelFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'modelValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchEvaluationFromModelEvaluationSliceName', () => { - const result = client.matchEvaluationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchEvaluationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'evaluationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2267,8 +2226,10 @@ describe('v1.SpecialistPoolServiceClient', () => { const result = client.matchSliceFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'sliceValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2282,12 +2243,11 @@ describe('v1.SpecialistPoolServiceClient', () => { location: 'locationValue', specialist_pool: 'specialistPoolValue', }; - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.specialistPoolPathTemplate.render = sinon .stub() @@ -2331,9 +2291,8 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('matchSpecialistPoolFromSpecialistPoolName', () => { - const result = client.matchSpecialistPoolFromSpecialistPoolName( - fakePath - ); + const result = + client.matchSpecialistPoolFromSpecialistPoolName(fakePath); assert.strictEqual(result, 'specialistPoolValue'); assert( (client.pathTemplates.specialistPoolPathTemplate.match as SinonStub) @@ -2350,12 +2309,11 @@ describe('v1.SpecialistPoolServiceClient', () => { location: 'locationValue', training_pipeline: 'trainingPipelineValue', }; - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.trainingPipelinePathTemplate.render = sinon .stub() @@ -2372,8 +2330,10 @@ describe('v1.SpecialistPoolServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.trainingPipelinePathTemplate - .render as SinonStub) + ( + client.pathTemplates.trainingPipelinePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -2400,9 +2360,8 @@ describe('v1.SpecialistPoolServiceClient', () => { }); it('matchTrainingPipelineFromTrainingPipelineName', () => { - const result = client.matchTrainingPipelineFromTrainingPipelineName( - fakePath - ); + const result = + client.matchTrainingPipelineFromTrainingPipelineName(fakePath); assert.strictEqual(result, 'trainingPipelineValue'); assert( (client.pathTemplates.trainingPipelinePathTemplate.match as SinonStub) @@ -2420,12 +2379,11 @@ describe('v1.SpecialistPoolServiceClient', () => { study: 'studyValue', trial: 'trialValue', }; - const client = new specialistpoolserviceModule.v1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.trialPathTemplate.render = sinon .stub() diff --git a/packages/google-cloud-aiplatform/test/gapic_specialist_pool_service_v1beta1.ts b/packages/google-cloud-aiplatform/test/gapic_specialist_pool_service_v1beta1.ts index a45af699dbe..490ecde36ea 100644 --- a/packages/google-cloud-aiplatform/test/gapic_specialist_pool_service_v1beta1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_specialist_pool_service_v1beta1.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; @@ -168,49 +167,46 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('should create a client with no option', () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient(); + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient(); assert(client); }); it('should create a client with gRPC fallback', () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ fallback: true, - } - ); + }); assert(client); }); it('has initialize method and supports deferred initialization', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); assert.strictEqual(client.specialistPoolServiceStub, undefined); await client.initialize(); assert(client.specialistPoolServiceStub); }); it('has close method', () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.close(); }); it('has getProjectId method', async () => { const fakeProjectId = 'fake-project-id'; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); const result = await client.getProjectId(); assert.strictEqual(result, fakeProjectId); @@ -219,12 +215,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { it('has getProjectId method with callback', async () => { const fakeProjectId = 'fake-project-id'; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.auth.getProjectId = sinon .stub() .callsArgWith(0, null, fakeProjectId); @@ -243,12 +238,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { describe('getSpecialistPool', () => { it('invokes getSpecialistPool without error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.GetSpecialistPoolRequest() @@ -276,12 +270,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes getSpecialistPool without error using callback', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.GetSpecialistPoolRequest() @@ -298,9 +291,8 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.SpecialistPool() ); - client.innerApiCalls.getSpecialistPool = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getSpecialistPool = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getSpecialistPool( request, @@ -326,12 +318,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes getSpecialistPool with error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.GetSpecialistPoolRequest() @@ -361,12 +352,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { describe('createSpecialistPool', () => { it('invokes createSpecialistPool without error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.CreateSpecialistPoolRequest() @@ -383,9 +373,8 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createSpecialistPool = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.createSpecialistPool = + stubLongRunningCall(expectedResponse); const [operation] = await client.createSpecialistPool(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -397,12 +386,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes createSpecialistPool without error using callback', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.CreateSpecialistPoolRequest() @@ -419,9 +407,8 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createSpecialistPool = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createSpecialistPool = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createSpecialistPool( request, @@ -454,12 +441,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes createSpecialistPool with call error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.CreateSpecialistPoolRequest() @@ -487,12 +473,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes createSpecialistPool with LRO error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.CreateSpecialistPoolRequest() @@ -522,12 +507,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes checkCreateSpecialistPoolProgress without error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -546,12 +530,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes checkCreateSpecialistPoolProgress with error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedError = new Error('expected'); @@ -569,12 +552,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { describe('deleteSpecialistPool', () => { it('invokes deleteSpecialistPool without error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.DeleteSpecialistPoolRequest() @@ -591,9 +573,8 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteSpecialistPool = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteSpecialistPool = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteSpecialistPool(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -605,12 +586,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes deleteSpecialistPool without error using callback', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.DeleteSpecialistPoolRequest() @@ -627,9 +607,8 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteSpecialistPool = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteSpecialistPool = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteSpecialistPool( request, @@ -662,12 +641,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes deleteSpecialistPool with call error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.DeleteSpecialistPoolRequest() @@ -695,12 +673,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes deleteSpecialistPool with LRO error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.DeleteSpecialistPoolRequest() @@ -730,12 +707,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes checkDeleteSpecialistPoolProgress without error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -754,12 +730,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes checkDeleteSpecialistPoolProgress with error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedError = new Error('expected'); @@ -777,12 +752,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { describe('updateSpecialistPool', () => { it('invokes updateSpecialistPool without error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.UpdateSpecialistPoolRequest() @@ -800,9 +774,8 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.updateSpecialistPool = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.updateSpecialistPool = + stubLongRunningCall(expectedResponse); const [operation] = await client.updateSpecialistPool(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -814,12 +787,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes updateSpecialistPool without error using callback', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.UpdateSpecialistPoolRequest() @@ -837,9 +809,8 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.updateSpecialistPool = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateSpecialistPool = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateSpecialistPool( request, @@ -872,12 +843,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes updateSpecialistPool with call error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.UpdateSpecialistPoolRequest() @@ -906,12 +876,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes updateSpecialistPool with LRO error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.UpdateSpecialistPoolRequest() @@ -942,12 +911,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes checkUpdateSpecialistPoolProgress without error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -966,12 +934,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes checkUpdateSpecialistPoolProgress with error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedError = new Error('expected'); @@ -989,12 +956,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { describe('listSpecialistPools', () => { it('invokes listSpecialistPools without error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.ListSpecialistPoolsRequest() @@ -1019,9 +985,8 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.SpecialistPool() ), ]; - client.innerApiCalls.listSpecialistPools = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listSpecialistPools = + stubSimpleCall(expectedResponse); const [response] = await client.listSpecialistPools(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1032,12 +997,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes listSpecialistPools without error using callback', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.ListSpecialistPoolsRequest() @@ -1062,9 +1026,8 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.SpecialistPool() ), ]; - client.innerApiCalls.listSpecialistPools = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listSpecialistPools = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listSpecialistPools( request, @@ -1092,12 +1055,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes listSpecialistPools with error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.ListSpecialistPoolsRequest() @@ -1125,12 +1087,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('invokes listSpecialistPoolsStream without error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.ListSpecialistPoolsRequest() @@ -1148,12 +1109,12 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.SpecialistPool() ), ]; - client.descriptors.page.listSpecialistPools.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listSpecialistPools.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listSpecialistPoolsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.SpecialistPool[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.SpecialistPool[] = + []; stream.on( 'data', (response: protos.google.cloud.aiplatform.v1beta1.SpecialistPool) => { @@ -1175,21 +1136,19 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { .calledWith(client.innerApiCalls.listSpecialistPools, request) ); assert.strictEqual( - (client.descriptors.page.listSpecialistPools - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listSpecialistPools.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); it('invokes listSpecialistPoolsStream with error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.ListSpecialistPoolsRequest() @@ -1197,13 +1156,12 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listSpecialistPools.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listSpecialistPools.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listSpecialistPoolsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.aiplatform.v1beta1.SpecialistPool[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.SpecialistPool[] = + []; stream.on( 'data', (response: protos.google.cloud.aiplatform.v1beta1.SpecialistPool) => { @@ -1224,21 +1182,19 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { .calledWith(client.innerApiCalls.listSpecialistPools, request) ); assert.strictEqual( - (client.descriptors.page.listSpecialistPools - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listSpecialistPools.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); it('uses async iteration with listSpecialistPools without error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.ListSpecialistPoolsRequest() @@ -1256,36 +1212,35 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.SpecialistPool() ), ]; - client.descriptors.page.listSpecialistPools.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.aiplatform.v1beta1.ISpecialistPool[] = []; + client.descriptors.page.listSpecialistPools.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.aiplatform.v1beta1.ISpecialistPool[] = + []; const iterable = client.listSpecialistPoolsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listSpecialistPools - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listSpecialistPools.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listSpecialistPools - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listSpecialistPools.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); it('uses async iteration with listSpecialistPools with error', async () => { - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.ListSpecialistPoolsRequest() @@ -1293,27 +1248,26 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listSpecialistPools.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listSpecialistPools.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listSpecialistPoolsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.aiplatform.v1beta1.ISpecialistPool[] = []; + const responses: protos.google.cloud.aiplatform.v1beta1.ISpecialistPool[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listSpecialistPools - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listSpecialistPools.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listSpecialistPools - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listSpecialistPools.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1329,12 +1283,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { data_item: 'dataItemValue', annotation: 'annotationValue', }; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.annotationPathTemplate.render = sinon .stub() @@ -1418,12 +1371,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { dataset: 'datasetValue', annotation_spec: 'annotationSpecValue', }; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.annotationSpecPathTemplate.render = sinon .stub() @@ -1478,9 +1430,8 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('matchAnnotationSpecFromAnnotationSpecName', () => { - const result = client.matchAnnotationSpecFromAnnotationSpecName( - fakePath - ); + const result = + client.matchAnnotationSpecFromAnnotationSpecName(fakePath); assert.strictEqual(result, 'annotationSpecValue'); assert( (client.pathTemplates.annotationSpecPathTemplate.match as SinonStub) @@ -1497,12 +1448,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { location: 'locationValue', batch_prediction_job: 'batchPredictionJobValue', }; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.batchPredictionJobPathTemplate.render = sinon .stub() @@ -1519,8 +1469,10 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -1530,8 +1482,10 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { const result = client.matchProjectFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1541,21 +1495,24 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { const result = client.matchLocationFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchBatchPredictionJobFromBatchPredictionJobName', () => { - const result = client.matchBatchPredictionJobFromBatchPredictionJobName( - fakePath - ); + const result = + client.matchBatchPredictionJobFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'batchPredictionJobValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1569,12 +1526,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { location: 'locationValue', custom_job: 'customJobValue', }; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.customJobPathTemplate.render = sinon .stub() @@ -1636,12 +1592,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { dataset: 'datasetValue', data_item: 'dataItemValue', }; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.dataItemPathTemplate.render = sinon .stub() @@ -1713,12 +1668,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { location: 'locationValue', data_labeling_job: 'dataLabelingJobValue', }; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.dataLabelingJobPathTemplate.render = sinon .stub() @@ -1762,9 +1716,8 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('matchDataLabelingJobFromDataLabelingJobName', () => { - const result = client.matchDataLabelingJobFromDataLabelingJobName( - fakePath - ); + const result = + client.matchDataLabelingJobFromDataLabelingJobName(fakePath); assert.strictEqual(result, 'dataLabelingJobValue'); assert( (client.pathTemplates.dataLabelingJobPathTemplate.match as SinonStub) @@ -1781,12 +1734,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { location: 'locationValue', dataset: 'datasetValue', }; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.datasetPathTemplate.render = sinon .stub() @@ -1847,12 +1799,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { location: 'locationValue', endpoint: 'endpointValue', }; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.endpointPathTemplate.render = sinon .stub() @@ -1913,12 +1864,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { location: 'locationValue', hyperparameter_tuning_job: 'hyperparameterTuningJobValue', }; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.hyperparameterTuningJobPathTemplate.render = sinon .stub() @@ -1935,47 +1885,54 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromHyperparameterTuningJobName', () => { - const result = client.matchProjectFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchProjectFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromHyperparameterTuningJobName', () => { - const result = client.matchLocationFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchLocationFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchHyperparameterTuningJobFromHyperparameterTuningJobName', () => { - const result = client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( + fakePath + ); assert.strictEqual(result, 'hyperparameterTuningJobValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -1988,12 +1945,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { project: 'projectValue', location: 'locationValue', }; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.locationPathTemplate.render = sinon .stub() @@ -2040,12 +1996,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { location: 'locationValue', model: 'modelValue', }; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.modelPathTemplate.render = sinon .stub() @@ -2107,12 +2062,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { model: 'modelValue', evaluation: 'evaluationValue', }; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.modelEvaluationPathTemplate.render = sinon .stub() @@ -2186,12 +2140,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { evaluation: 'evaluationValue', slice: 'sliceValue', }; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.modelEvaluationSlicePathTemplate.render = sinon .stub() @@ -2210,34 +2163,38 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .render as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromModelEvaluationSliceName', () => { - const result = client.matchProjectFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchProjectFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromModelEvaluationSliceName', () => { - const result = client.matchLocationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchLocationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2247,21 +2204,24 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { const result = client.matchModelFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'modelValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchEvaluationFromModelEvaluationSliceName', () => { - const result = client.matchEvaluationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchEvaluationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'evaluationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2271,8 +2231,10 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { const result = client.matchSliceFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'sliceValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2286,12 +2248,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { location: 'locationValue', specialist_pool: 'specialistPoolValue', }; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.specialistPoolPathTemplate.render = sinon .stub() @@ -2335,9 +2296,8 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('matchSpecialistPoolFromSpecialistPoolName', () => { - const result = client.matchSpecialistPoolFromSpecialistPoolName( - fakePath - ); + const result = + client.matchSpecialistPoolFromSpecialistPoolName(fakePath); assert.strictEqual(result, 'specialistPoolValue'); assert( (client.pathTemplates.specialistPoolPathTemplate.match as SinonStub) @@ -2354,12 +2314,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { location: 'locationValue', study: 'studyValue', }; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.studyPathTemplate.render = sinon .stub() @@ -2420,12 +2379,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { location: 'locationValue', training_pipeline: 'trainingPipelineValue', }; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.trainingPipelinePathTemplate.render = sinon .stub() @@ -2442,8 +2400,10 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.trainingPipelinePathTemplate - .render as SinonStub) + ( + client.pathTemplates.trainingPipelinePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -2470,9 +2430,8 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { }); it('matchTrainingPipelineFromTrainingPipelineName', () => { - const result = client.matchTrainingPipelineFromTrainingPipelineName( - fakePath - ); + const result = + client.matchTrainingPipelineFromTrainingPipelineName(fakePath); assert.strictEqual(result, 'trainingPipelineValue'); assert( (client.pathTemplates.trainingPipelinePathTemplate.match as SinonStub) @@ -2490,12 +2449,11 @@ describe('v1beta1.SpecialistPoolServiceClient', () => { study: 'studyValue', trial: 'trialValue', }; - const client = new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient( - { + const client = + new specialistpoolserviceModule.v1beta1.SpecialistPoolServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.trialPathTemplate.render = sinon .stub() diff --git a/packages/google-cloud-aiplatform/test/gapic_vizier_service_v1beta1.ts b/packages/google-cloud-aiplatform/test/gapic_vizier_service_v1beta1.ts index c79a90cdb73..d80599306c2 100644 --- a/packages/google-cloud-aiplatform/test/gapic_vizier_service_v1beta1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_vizier_service_v1beta1.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; @@ -281,9 +280,8 @@ describe('v1beta1.VizierServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.Study() ); - client.innerApiCalls.createStudy = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createStudy = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createStudy( request, @@ -393,9 +391,8 @@ describe('v1beta1.VizierServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.Study() ); - client.innerApiCalls.getStudy = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getStudy = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getStudy( request, @@ -502,9 +499,8 @@ describe('v1beta1.VizierServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.deleteStudy = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteStudy = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteStudy( request, @@ -614,9 +610,8 @@ describe('v1beta1.VizierServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.Study() ); - client.innerApiCalls.lookupStudy = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.lookupStudy = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.lookupStudy( request, @@ -726,9 +721,8 @@ describe('v1beta1.VizierServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.Trial() ); - client.innerApiCalls.createTrial = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createTrial = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createTrial( request, @@ -838,9 +832,8 @@ describe('v1beta1.VizierServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.Trial() ); - client.innerApiCalls.getTrial = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getTrial = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getTrial( request, @@ -916,9 +909,8 @@ describe('v1beta1.VizierServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.Trial() ); - client.innerApiCalls.addTrialMeasurement = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.addTrialMeasurement = + stubSimpleCall(expectedResponse); const [response] = await client.addTrialMeasurement(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -949,9 +941,8 @@ describe('v1beta1.VizierServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.Trial() ); - client.innerApiCalls.addTrialMeasurement = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.addTrialMeasurement = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.addTrialMeasurement( request, @@ -1061,9 +1052,8 @@ describe('v1beta1.VizierServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.Trial() ); - client.innerApiCalls.completeTrial = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.completeTrial = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.completeTrial( request, @@ -1173,9 +1163,8 @@ describe('v1beta1.VizierServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.deleteTrial = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteTrial = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteTrial( request, @@ -1285,9 +1274,8 @@ describe('v1beta1.VizierServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.Trial() ); - client.innerApiCalls.stopTrial = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.stopTrial = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.stopTrial( request, @@ -1394,9 +1382,8 @@ describe('v1beta1.VizierServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.aiplatform.v1beta1.ListOptimalTrialsResponse() ); - client.innerApiCalls.listOptimalTrials = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listOptimalTrials = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listOptimalTrials( request, @@ -1475,9 +1462,8 @@ describe('v1beta1.VizierServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.suggestTrials = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.suggestTrials = + stubLongRunningCall(expectedResponse); const [operation] = await client.suggestTrials(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -1509,9 +1495,8 @@ describe('v1beta1.VizierServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.suggestTrials = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.suggestTrials = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.suggestTrials( request, @@ -1671,9 +1656,8 @@ describe('v1beta1.VizierServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.checkTrialEarlyStoppingState = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.checkTrialEarlyStoppingState = + stubLongRunningCall(expectedResponse); const [operation] = await client.checkTrialEarlyStoppingState(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -1705,9 +1689,8 @@ describe('v1beta1.VizierServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.checkTrialEarlyStoppingState = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.checkTrialEarlyStoppingState = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.checkTrialEarlyStoppingState( request, @@ -1820,9 +1803,10 @@ describe('v1beta1.VizierServiceClient', () => { expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCheckTrialEarlyStoppingStateProgress( - expectedResponse.name - ); + const decodedOperation = + await client.checkCheckTrialEarlyStoppingStateProgress( + expectedResponse.name + ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); assert(decodedOperation.metadata); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); @@ -1917,9 +1901,8 @@ describe('v1beta1.VizierServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.Study() ), ]; - client.innerApiCalls.listStudies = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listStudies = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listStudies( request, @@ -1997,9 +1980,8 @@ describe('v1beta1.VizierServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.Study() ), ]; - client.descriptors.page.listStudies.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listStudies.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listStudiesStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.aiplatform.v1beta1.Study[] = []; @@ -2099,9 +2081,8 @@ describe('v1beta1.VizierServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.Study() ), ]; - client.descriptors.page.listStudies.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listStudies.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.aiplatform.v1beta1.IStudy[] = []; const iterable = client.listStudiesAsync(request); for await (const resource of iterable) { @@ -2229,9 +2210,8 @@ describe('v1beta1.VizierServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.Trial() ), ]; - client.innerApiCalls.listTrials = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listTrials = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listTrials( request, @@ -2309,9 +2289,8 @@ describe('v1beta1.VizierServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.Trial() ), ]; - client.descriptors.page.listTrials.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listTrials.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listTrialsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.aiplatform.v1beta1.Trial[] = []; @@ -2411,9 +2390,8 @@ describe('v1beta1.VizierServiceClient', () => { new protos.google.cloud.aiplatform.v1beta1.Trial() ), ]; - client.descriptors.page.listTrials.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listTrials.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.aiplatform.v1beta1.ITrial[] = []; const iterable = client.listTrialsAsync(request); for await (const resource of iterable) { @@ -2627,9 +2605,8 @@ describe('v1beta1.VizierServiceClient', () => { }); it('matchAnnotationSpecFromAnnotationSpecName', () => { - const result = client.matchAnnotationSpecFromAnnotationSpecName( - fakePath - ); + const result = + client.matchAnnotationSpecFromAnnotationSpecName(fakePath); assert.strictEqual(result, 'annotationSpecValue'); assert( (client.pathTemplates.annotationSpecPathTemplate.match as SinonStub) @@ -2666,8 +2643,10 @@ describe('v1beta1.VizierServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -2677,8 +2656,10 @@ describe('v1beta1.VizierServiceClient', () => { const result = client.matchProjectFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2688,21 +2669,24 @@ describe('v1beta1.VizierServiceClient', () => { const result = client.matchLocationFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchBatchPredictionJobFromBatchPredictionJobName', () => { - const result = client.matchBatchPredictionJobFromBatchPredictionJobName( - fakePath - ); + const result = + client.matchBatchPredictionJobFromBatchPredictionJobName(fakePath); assert.strictEqual(result, 'batchPredictionJobValue'); assert( - (client.pathTemplates.batchPredictionJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.batchPredictionJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -2903,9 +2887,8 @@ describe('v1beta1.VizierServiceClient', () => { }); it('matchDataLabelingJobFromDataLabelingJobName', () => { - const result = client.matchDataLabelingJobFromDataLabelingJobName( - fakePath - ); + const result = + client.matchDataLabelingJobFromDataLabelingJobName(fakePath); assert.strictEqual(result, 'dataLabelingJobValue'); assert( (client.pathTemplates.dataLabelingJobPathTemplate.match as SinonStub) @@ -3070,47 +3053,54 @@ describe('v1beta1.VizierServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .render as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromHyperparameterTuningJobName', () => { - const result = client.matchProjectFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchProjectFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromHyperparameterTuningJobName', () => { - const result = client.matchLocationFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchLocationFromHyperparameterTuningJobName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchHyperparameterTuningJobFromHyperparameterTuningJobName', () => { - const result = client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( - fakePath - ); + const result = + client.matchHyperparameterTuningJobFromHyperparameterTuningJobName( + fakePath + ); assert.strictEqual(result, 'hyperparameterTuningJobValue'); assert( - (client.pathTemplates.hyperparameterTuningJobPathTemplate - .match as SinonStub) + ( + client.pathTemplates.hyperparameterTuningJobPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3337,34 +3327,38 @@ describe('v1beta1.VizierServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .render as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); }); it('matchProjectFromModelEvaluationSliceName', () => { - const result = client.matchProjectFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchProjectFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchLocationFromModelEvaluationSliceName', () => { - const result = client.matchLocationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchLocationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3374,21 +3368,24 @@ describe('v1beta1.VizierServiceClient', () => { const result = client.matchModelFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'modelValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); }); it('matchEvaluationFromModelEvaluationSliceName', () => { - const result = client.matchEvaluationFromModelEvaluationSliceName( - fakePath - ); + const result = + client.matchEvaluationFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'evaluationValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3398,8 +3395,10 @@ describe('v1beta1.VizierServiceClient', () => { const result = client.matchSliceFromModelEvaluationSliceName(fakePath); assert.strictEqual(result, 'sliceValue'); assert( - (client.pathTemplates.modelEvaluationSlicePathTemplate - .match as SinonStub) + ( + client.pathTemplates.modelEvaluationSlicePathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -3460,9 +3459,8 @@ describe('v1beta1.VizierServiceClient', () => { }); it('matchSpecialistPoolFromSpecialistPoolName', () => { - const result = client.matchSpecialistPoolFromSpecialistPoolName( - fakePath - ); + const result = + client.matchSpecialistPoolFromSpecialistPoolName(fakePath); assert.strictEqual(result, 'specialistPoolValue'); assert( (client.pathTemplates.specialistPoolPathTemplate.match as SinonStub) @@ -3563,8 +3561,10 @@ describe('v1beta1.VizierServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.trainingPipelinePathTemplate - .render as SinonStub) + ( + client.pathTemplates.trainingPipelinePathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -3591,9 +3591,8 @@ describe('v1beta1.VizierServiceClient', () => { }); it('matchTrainingPipelineFromTrainingPipelineName', () => { - const result = client.matchTrainingPipelineFromTrainingPipelineName( - fakePath - ); + const result = + client.matchTrainingPipelineFromTrainingPipelineName(fakePath); assert.strictEqual(result, 'trainingPipelineValue'); assert( (client.pathTemplates.trainingPipelinePathTemplate.match as SinonStub) diff --git a/packages/google-cloud-aiplatform/test/helpers.test.ts b/packages/google-cloud-aiplatform/test/helpers.test.ts index 943861f34a5..3fbaf5ff8b5 100644 --- a/packages/google-cloud-aiplatform/test/helpers.test.ts +++ b/packages/google-cloud-aiplatform/test/helpers.test.ts @@ -183,12 +183,10 @@ describe('AI Platform helper methods', () => { }); describe('dynamically assigned methods', () => { - const { - definition, - } = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.trainingjob; - const { - instance, - } = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.predict; + const {definition} = + aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.trainingjob; + const {instance} = + aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.predict; describe('toValue', () => { const imageClassificationTrainingInputs = { @@ -203,17 +201,20 @@ describe('AI Platform helper methods', () => { }; it('exposes toValue() on instances of enhanced types', () => { - const actualTrainingTaskInputs = new definition.AutoMlImageClassificationInputs(); + const actualTrainingTaskInputs = + new definition.AutoMlImageClassificationInputs(); assert.ok(actualTrainingTaskInputs.toValue); }); it('converts an enhanced type to a protobuf-formatted object', () => { - const trainingTaskInputs = new definition.AutoMlImageClassificationInputs( - imageClassificationTrainingInputs - ); - const predictionInstance = new instance.TextClassificationPredictionInstance( - textClassificationPredictionInstance - ); + const trainingTaskInputs = + new definition.AutoMlImageClassificationInputs( + imageClassificationTrainingInputs + ); + const predictionInstance = + new instance.TextClassificationPredictionInstance( + textClassificationPredictionInstance + ); const actualTrainingTaskInputValue = trainingTaskInputs.toValue(); const actualPredictionInstanceValue = predictionInstance.toValue(); @@ -295,12 +296,14 @@ describe('AI Platform helper methods', () => { }); it('converts protobuf-formatted objects into instanced of enhanced types', () => { - const actualTrainingTaskInputs = definition.AutoMlImageClassificationInputs.fromValue( - imageClassificationTrainingInputs - ); - const actualPredictionInstance = instance.TextClassificationPredictionInstance.fromValue( - textClassificationPredictionInstance - ); + const actualTrainingTaskInputs = + definition.AutoMlImageClassificationInputs.fromValue( + imageClassificationTrainingInputs + ); + const actualPredictionInstance = + instance.TextClassificationPredictionInstance.fromValue( + textClassificationPredictionInstance + ); assert.strictEqual(actualTrainingTaskInputs.budgetMilliNodeHours, 8000); assert.strictEqual( diff --git a/packages/google-cloud-aiplatform/test/index.test.ts b/packages/google-cloud-aiplatform/test/index.test.ts index cf3578c0c62..3a861e39372 100644 --- a/packages/google-cloud-aiplatform/test/index.test.ts +++ b/packages/google-cloud-aiplatform/test/index.test.ts @@ -39,14 +39,10 @@ describe('AI Platform enhanced types', () => { const predictResultTypeNames = enhancedTypes.v1beta1.schema.predict.prediction; - const { - definition, - } = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.trainingjob; - const { - instance, - params, - prediction, - } = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.predict; + const {definition} = + aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.trainingjob; + const {instance, params, prediction} = + aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.predict; it('adds training job definition types', () => { testNamespaceAgainstArray(definition, definitionTypeNames); @@ -71,14 +67,10 @@ describe('AI Platform enhanced types', () => { const predictParamsTypeNames = enhancedTypes.v1.schema.predict.params; const predictResultTypeNames = enhancedTypes.v1.schema.predict.prediction; - const { - definition, - } = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; - const { - instance, - params, - prediction, - } = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict; + const {definition} = + aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob; + const {instance, params, prediction} = + aiplatform.protos.google.cloud.aiplatform.v1.schema.predict; it('adds training job definition types', () => { testNamespaceAgainstArray(definition, definitionTypeNames);